]> gitweb @ CieloNegro.org - Rakka.git/blob - Rakka/Wiki/Interpreter.hs
Implemented more features
[Rakka.git] / Rakka / Wiki / Interpreter.hs
1 module Rakka.Wiki.Interpreter
2     ( Interpreter(..)
3
4     , commandName -- private
5     , commandType -- private
6
7     , pureInlineInterp
8     )
9     where
10
11 import           Rakka.Page
12 import           Rakka.Storage
13 import           Rakka.SystemConfig
14 import           Rakka.Wiki
15
16
17 data Interpreter
18     = InlineCommandInterpreter {
19         iciName      :: String
20       , iciInterpret :: InlineCommand
21                      -> Maybe Page
22                      -> Storage
23                      -> SystemConfig
24                      -> IO InlineElement
25       }
26
27
28 commandName :: Interpreter -> String
29 commandName (InlineCommandInterpreter name _) = name
30
31
32 commandType :: Interpreter -> CommandType
33 commandType (InlineCommandInterpreter _ _) = InlineCommandType
34
35
36 pureInlineInterp :: String
37                  -> (InlineCommand -> Maybe Page -> InlineElement)
38                  -> Interpreter
39 pureInlineInterp name f
40     = InlineCommandInterpreter name $ \ cmd page _ _ -> return $ f cmd page