module Rakka.Wiki.Interpreter.Base
- ( baseInterpreters
+ ( interpreters
)
where
-import Rakka.Wiki.Interpreter
import Rakka.Wiki
+import Rakka.Wiki.Interpreter
-baseInterpreters :: [Interpreter]
-baseInterpreters = [ lineBreakInterp ]
+interpreters :: [Interpreter]
+interpreters = [ lineBreakInterp
+ , spanInterp
+ , divInterp
+ , pageNameInterp
+ ]
lineBreakInterp :: Interpreter
-lineBreakInterp = pureInlineInterp "br" interpret
- where
- interpret (InlineCommand _ attrs _) _ = LineBreak attrs
+lineBreakInterp = InlineCommandInterpreter {
+ iciName = "br"
+ , iciInterpret
+ = \ _ (InlineCommand _ attrs _) -> return $ LineBreak attrs
+ }
+
+
+spanInterp :: Interpreter
+spanInterp = InlineCommandInterpreter {
+ iciName = "span"
+ , iciInterpret
+ = \ _ (InlineCommand _ attrs contents) -> return $ Span attrs contents
+ }
+
+
+divInterp :: Interpreter
+divInterp = BlockCommandInterpreter {
+ bciName = "div"
+ , bciInterpret
+ = \ _ (BlockCommand _ attrs contents) -> return $ Div attrs contents
+ }
+
+
+pageNameInterp :: Interpreter
+pageNameInterp = InlineCommandInterpreter {
+ iciName = "pageName"
+ , iciInterpret
+ = \ ctx _ -> return $ Text (ctxPageName ctx)
+ }