]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Interpreter.hs
Implemented block commands
[Rakka.git] / Rakka / Wiki / Interpreter.hs
index 2abfc45e2947bad4f44627401d288bdc5c1df884..bfaab67b0cd742d2ea0f02b7ebaf7b0913fffa9a 100644 (file)
@@ -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