1 module Rakka.Wiki.Interpreter
4 , commandName -- private
5 , commandType -- private
14 import Rakka.SystemConfig
19 = InlineCommandInterpreter {
21 , iciInterpret :: InlineCommand
27 | BlockCommandInterpreter {
29 , bciInterpret :: BlockCommand
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
47 pureInlineInterp :: String
48 -> (InlineCommand -> Maybe Page -> InlineElement)
50 pureInlineInterp name f
51 = InlineCommandInterpreter name $ \ cmd page _ _ -> return $ f cmd page
54 pureBlockInterp :: String
55 -> (BlockCommand -> Maybe Page -> BlockElement)
57 pureBlockInterp name f
58 = BlockCommandInterpreter name $ \ cmd page _ _ -> return $ f cmd page