git.iko.soy/typeable/pandoc
on master help sign in
Lua: set "arg" instead of "PandocParameters".
3fe4aadJohn MacFarlane
src/Text/Pandoc/Lua.hs+2−2
@@ -57,6 +57,8 @@ runLuaFilter datadir filterPath args pd = liftIO . Lua.runLua $ do
57 -- store module in global "pandoc"
57 -- store module in global "pandoc"
58 pushPandocModule datadir
58 pushPandocModule datadir
59 Lua.setglobal "pandoc"
59 Lua.setglobal "pandoc"
60+ push args
61+ Lua.setglobal "arg"
60 top <- Lua.gettop
62 top <- Lua.gettop
61 stat <- Lua.dofile filterPath
63 stat <- Lua.dofile filterPath
62 if stat /= OK
64 if stat /= OK
@@ -68,8 +70,6 @@ runLuaFilter datadir filterPath args pd = liftIO . Lua.runLua $ do
68 -- Use the implicitly defined global filter if nothing was returned
70 -- Use the implicitly defined global filter if nothing was returned
69 when (newtop - top < 1) pushGlobalFilter
71 when (newtop - top < 1) pushGlobalFilter
70 luaFilters <- peek (-1)
72 luaFilters <- peek (-1)
71− push args
72− Lua.setglobal "PandocParameters"
73 runAll luaFilters pd
73 runAll luaFilters pd
74
74
75pushGlobalFilter :: Lua ()
75pushGlobalFilter :: Lua ()