1 module Rakka.Wiki.Interpreter
3 , InterpreterContext(..)
5 , commandName -- private
6 , commandType -- private
12 import Rakka.SystemConfig
17 = InlineCommandInterpreter {
19 , iciInterpret :: !(InterpreterContext -> InlineCommand -> IO InlineElement)
21 | BlockCommandInterpreter {
23 , bciInterpret :: !(InterpreterContext -> BlockCommand -> IO BlockElement)
27 data InterpreterContext
28 = InterpreterContext {
29 ctxPageName :: !PageName
30 , ctxMainTree :: !(Maybe WikiPage)
31 , ctxTargetTree :: !WikiPage
32 , ctxStorage :: !Storage
33 , ctxSysConf :: !SystemConfig
37 commandName :: Interpreter -> String
38 commandName (InlineCommandInterpreter name _) = name
39 commandName (BlockCommandInterpreter name _) = name
42 commandType :: Interpreter -> CommandType
43 commandType (InlineCommandInterpreter _ _) = InlineCommandType
44 commandType (BlockCommandInterpreter _ _) = BlockCommandType