+{-# LANGUAGE
+ UnicodeSyntax
+ #-}
module Rakka.Wiki.Interpreter
( Interpreter(..)
, InterpreterContext(..)
, commandType -- private
)
where
-
-import Rakka.Page
-import Rakka.Storage
-import Rakka.SystemConfig
-import Rakka.Wiki
-
+import Data.Text (Text)
+import Rakka.Page
+import Rakka.Storage
+import Rakka.SystemConfig
+import Rakka.Wiki
+import Text.XML.HXT.DOM.TypeDefs
data Interpreter
= InlineCommandInterpreter {
- iciName :: !String
- , iciInterpret :: !(InterpreterContext -> InlineCommand -> IO InlineElement)
+ iciName ∷ !Text
+ , iciInterpret ∷ !(InterpreterContext → InlineCommand → IO InlineElement)
}
| BlockCommandInterpreter {
- bciName :: !String
- , bciInterpret :: !(InterpreterContext -> BlockCommand -> IO BlockElement)
+ bciName ∷ !Text
+ , bciInterpret ∷ !(InterpreterContext → BlockCommand → IO BlockElement)
}
data InterpreterContext
= InterpreterContext {
- ctxPageName :: !PageName
- , ctxMainTree :: !(Maybe WikiPage)
- , ctxTargetTree :: !WikiPage
+ ctxPageName :: !(Maybe PageName)
+ , ctxMainPage :: !(Maybe XmlTree)
+ , ctxMainWiki :: !(Maybe WikiPage)
+ , ctxTargetWiki :: !WikiPage
, ctxStorage :: !Storage
, ctxSysConf :: !SystemConfig
}
-
-commandName :: Interpreter -> String
+commandName ∷ Interpreter → Text
commandName (InlineCommandInterpreter name _) = name
commandName (BlockCommandInterpreter name _) = name
-
-commandType :: Interpreter -> CommandType
+commandType ∷ Interpreter → CommandType
commandType (InlineCommandInterpreter _ _) = InlineCommandType
commandType (BlockCommandInterpreter _ _) = BlockCommandType