]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Engine.hs
Record before an experiment
[Rakka.git] / Rakka / Wiki / Engine.hs
index 66e2ccc4363cea341c5d8de4cbb82bdea9053219..3300181bab098ea913c76240864d0bbc5483d81f 100644 (file)
@@ -67,6 +67,14 @@ interpretCommands :: Environment -> InterpTable -> Maybe Page -> WikiPage -> IO
 interpretCommands _   _     _    []     = return []
 interpretCommands env table page blocks = mapM interpBlock blocks
     where
+      ctx :: InterpreterContext
+      ctx = InterpreterContext {
+                  ctxPage    = page
+                , ctxTree    = blocks
+                , ctxStorage = envStorage env
+                , ctxSysConf = envSysConf env
+                }
+
       interpBlock :: BlockElement -> IO BlockElement
       interpBlock (List list)           = interpList list >>= return . List
       interpBlock (DefinitionList defs) = mapM interpDefinition defs >>= return . DefinitionList
@@ -101,7 +109,7 @@ interpretCommands env table page blocks = mapM interpBlock blocks
                   -> fail ("no such interpreter: " ++ bCmdName cmd)
 
               Just interp
-                  -> bciInterpret interp cmd page (envStorage env) (envSysConf env)
+                  -> bciInterpret interp ctx cmd
                      >>=
                      interpBlock
 
@@ -119,7 +127,7 @@ interpretCommands env table page blocks = mapM interpBlock blocks
                   -> fail ("no such interpreter: " ++ iCmdName cmd)
 
               Just interp
-                  -> iciInterpret interp cmd page (envStorage env) (envSysConf env)
+                  -> iciInterpret interp ctx cmd
                      >>=
                      interpInline