1 module Rakka.Wiki.Interpreter
3 , InterpreterContext(..)
5 , commandName -- private
6 , commandType -- private
12 import Rakka.SystemConfig
14 import Text.XML.HXT.DOM.TypeDefs
18 = InlineCommandInterpreter {
20 , iciInterpret :: !(InterpreterContext -> InlineCommand -> IO InlineElement)
22 | BlockCommandInterpreter {
24 , bciInterpret :: !(InterpreterContext -> BlockCommand -> IO BlockElement)
28 data InterpreterContext
29 = InterpreterContext {
30 ctxPageName :: !PageName
31 , ctxMainPage :: !(Maybe XmlTree)
32 , ctxMainWiki :: !(Maybe WikiPage)
33 , ctxTargetWiki :: !WikiPage
34 , ctxStorage :: !Storage
35 , ctxSysConf :: !SystemConfig
39 commandName :: Interpreter -> String
40 commandName (InlineCommandInterpreter name _) = name
41 commandName (BlockCommandInterpreter name _) = name
44 commandType :: Interpreter -> CommandType
45 commandType (InlineCommandInterpreter _ _) = InlineCommandType
46 commandType (BlockCommandInterpreter _ _) = BlockCommandType