4 module Rakka.Wiki.Interpreter
6 , InterpreterContext(..)
8 , commandName -- private
9 , commandType -- private
12 import Data.Text (Text)
15 import Rakka.SystemConfig
17 import Text.XML.HXT.DOM.TypeDefs
20 = InlineCommandInterpreter {
22 , iciInterpret ∷ !(InterpreterContext → InlineCommand → IO InlineElement)
24 | BlockCommandInterpreter {
26 , bciInterpret ∷ !(InterpreterContext → BlockCommand → IO BlockElement)
30 data InterpreterContext
31 = InterpreterContext {
32 ctxPageName :: !(Maybe PageName)
33 , ctxMainPage :: !(Maybe XmlTree)
34 , ctxMainWiki :: !(Maybe WikiPage)
35 , ctxTargetWiki :: !WikiPage
36 , ctxStorage :: !Storage
37 , ctxSysConf :: !SystemConfig
40 commandName ∷ Interpreter → Text
41 commandName (InlineCommandInterpreter name _) = name
42 commandName (BlockCommandInterpreter name _) = name
44 commandType ∷ Interpreter → CommandType
45 commandType (InlineCommandInterpreter _ _) = InlineCommandType
46 commandType (BlockCommandInterpreter _ _) = BlockCommandType