aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Lua.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs
index 0d1c6cf45..ffc57c9c2 100644
--- a/src/Text/Pandoc/Lua.hs
+++ b/src/Text/Pandoc/Lua.hs
@@ -75,7 +75,8 @@ runAll (x:xs) = walkMWithLuaFilter x >=> runAll xs
walkMWithLuaFilter :: LuaFilter -> Pandoc -> IO Pandoc
walkMWithLuaFilter (LuaFilter lua fnMap) =
walkM (execInlineLuaFilter lua fnMap) >=>
- walkM (execBlockLuaFilter lua fnMap) >=>
+ walkM (execBlockLuaFilter lua fnMap) >=>
+ walkM (execMetaLuaFilter lua fnMap) >=>
walkM (execDocLuaFilter lua fnMap)
type FunctionMap = Map String LuaFilterFunction
@@ -92,6 +93,17 @@ execDocLuaFilter lua fnMap x = do
Nothing -> return x
Just fn -> runLuaFilterFunction lua fn x
+execMetaLuaFilter :: LuaState
+ -> FunctionMap
+ -> Pandoc -> IO Pandoc
+execMetaLuaFilter lua fnMap pd@(Pandoc meta blks) = do
+ let metaFnName = "Meta"
+ case Map.lookup metaFnName fnMap of
+ Nothing -> return pd
+ Just fn -> do
+ meta' <- runLuaFilterFunction lua fn meta
+ return $ Pandoc meta' blks
+
execBlockLuaFilter :: LuaState
-> FunctionMap
-> Block -> IO Block