]> gitweb @ CieloNegro.org - Rakka.git/blob - Rakka/Wiki/Interpreter/Base.hs
f2fd602fe791e9c02e4bad41a09ea08509b97178
[Rakka.git] / Rakka / Wiki / Interpreter / Base.hs
1 module Rakka.Wiki.Interpreter.Base
2     ( baseInterpreters
3     )
4     where
5
6 import           Rakka.Wiki
7 import           Rakka.Wiki.Interpreter
8 import           Rakka.Wiki.Interpreter.Base.Image
9 import           Rakka.Wiki.Interpreter.Base.Outline
10
11
12 baseInterpreters :: [Interpreter]
13 baseInterpreters = [ lineBreakInterp
14                    , spanInterp
15                    , divInterp
16                    , imageInterp
17                    , imgFrameInterp
18
19                    , pageNameInterp
20                    , outlineInterp
21                    ]
22
23
24 lineBreakInterp :: Interpreter
25 lineBreakInterp = InlineCommandInterpreter {
26                     iciName      = "br"
27                   , iciInterpret
28                       = \ _ (InlineCommand _ attrs _) -> return $ LineBreak attrs
29                   }
30
31
32 spanInterp :: Interpreter
33 spanInterp = InlineCommandInterpreter {
34                iciName      = "span"
35              , iciInterpret
36                  = \ _ (InlineCommand _ attrs contents) -> return $ Span attrs contents
37              }
38
39
40 divInterp :: Interpreter
41 divInterp = BlockCommandInterpreter {
42               bciName      = "div"
43             , bciInterpret
44                 = \ _ (BlockCommand _ attrs contents) -> return $ Div attrs contents
45             }
46
47
48 pageNameInterp :: Interpreter
49 pageNameInterp = InlineCommandInterpreter {
50                    iciName      = "pageName"
51                  , iciInterpret
52                      = \ ctx _ -> return $ Text (ctxPageName ctx)
53                  }