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