X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Rakka.git;a=blobdiff_plain;f=Rakka%2FWiki%2FEngine.hs;h=3300181bab098ea913c76240864d0bbc5483d81f;hp=66e2ccc4363cea341c5d8de4cbb82bdea9053219;hb=4608e8de5f9d72f12055494467283b4dea2faeb5;hpb=7c3065043cdfbd96539a9bf6bff9b1d4281c0b2a diff --git a/Rakka/Wiki/Engine.hs b/Rakka/Wiki/Engine.hs index 66e2ccc..3300181 100644 --- a/Rakka/Wiki/Engine.hs +++ b/Rakka/Wiki/Engine.hs @@ -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