X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki%2FInterpreter.hs;h=bfaab67b0cd742d2ea0f02b7ebaf7b0913fffa9a;hb=f832f12703d807f5fc3350dc71d8624ffc5b97a5;hp=2abfc45e2947bad4f44627401d288bdc5c1df884;hpb=2ad43b49ecc25bdf87dd19037fd63c12428992ae;p=Rakka.git diff --git a/Rakka/Wiki/Interpreter.hs b/Rakka/Wiki/Interpreter.hs index 2abfc45..bfaab67 100644 --- a/Rakka/Wiki/Interpreter.hs +++ b/Rakka/Wiki/Interpreter.hs @@ -5,6 +5,7 @@ module Rakka.Wiki.Interpreter , commandType -- private , pureInlineInterp + , pureBlockInterp ) where @@ -23,14 +24,24 @@ data Interpreter -> SystemConfig -> IO InlineElement } + | BlockCommandInterpreter { + bciName :: String + , bciInterpret :: BlockCommand + -> Maybe Page + -> Storage + -> SystemConfig + -> IO BlockElement + } commandName :: Interpreter -> String commandName (InlineCommandInterpreter name _) = name +commandName (BlockCommandInterpreter name _) = name commandType :: Interpreter -> CommandType commandType (InlineCommandInterpreter _ _) = InlineCommandType +commandType (BlockCommandInterpreter _ _) = BlockCommandType pureInlineInterp :: String @@ -38,3 +49,10 @@ pureInlineInterp :: String -> Interpreter pureInlineInterp name f = InlineCommandInterpreter name $ \ cmd page _ _ -> return $ f cmd page + + +pureBlockInterp :: String + -> (BlockCommand -> Maybe Page -> BlockElement) + -> Interpreter +pureBlockInterp name f + = BlockCommandInterpreter name $ \ cmd page _ _ -> return $ f cmd page