module Rakka.Wiki.Interpreter ( Interpreter(..) , InterpreterContext(..) , commandName -- private , commandType -- private ) where import Rakka.Page import Rakka.Storage import Rakka.SystemConfig import Rakka.Wiki data Interpreter = InlineCommandInterpreter { iciName :: !String , iciInterpret :: !(InterpreterContext -> InlineCommand -> IO InlineElement) } | BlockCommandInterpreter { bciName :: !String , bciInterpret :: !(InterpreterContext -> BlockCommand -> IO BlockElement) } data InterpreterContext = InterpreterContext { ctxPageName :: !PageName , ctxMainTree :: !(Maybe WikiPage) , ctxTargetTree :: !WikiPage , ctxStorage :: !Storage , ctxSysConf :: !SystemConfig } commandName :: Interpreter -> String commandName (InlineCommandInterpreter name _) = name commandName (BlockCommandInterpreter name _) = name commandType :: Interpreter -> CommandType commandType (InlineCommandInterpreter _ _) = InlineCommandType commandType (BlockCommandInterpreter _ _) = BlockCommandType