aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Lua.hs')
-rw-r--r--src/Text/Pandoc/Lua.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs
index 790be47d5..cd7117074 100644
--- a/src/Text/Pandoc/Lua.hs
+++ b/src/Text/Pandoc/Lua.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE NoImplicitPrelude #-}
{-
Copyright © 2017–2018 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -31,13 +32,14 @@ module Text.Pandoc.Lua
, runPandocLua
) where
+import Prelude
import Control.Monad ((>=>))
import Foreign.Lua (FromLuaStack (peek), Lua, LuaException (..),
Status (OK), ToLuaStack (push))
import Text.Pandoc.Class (PandocIO)
import Text.Pandoc.Definition (Pandoc)
import Text.Pandoc.Lua.Filter (LuaFilter, walkMWithLuaFilter)
-import Text.Pandoc.Lua.Init (runPandocLua)
+import Text.Pandoc.Lua.Init (runPandocLua, registerScriptPath)
import Text.Pandoc.Lua.Util (popValue)
import Text.Pandoc.Options (ReaderOptions)
import qualified Foreign.Lua as Lua
@@ -55,11 +57,12 @@ runLuaFilter' :: ReaderOptions -> FilePath -> String
runLuaFilter' ropts filterPath format pd = do
registerFormat
registerReaderOptions
+ registerScriptPath filterPath
top <- Lua.gettop
stat <- Lua.dofile filterPath
if stat /= OK
then do
- luaErrMsg <- peek (-1) <* Lua.pop 1
+ luaErrMsg <- popValue
Lua.throwLuaError luaErrMsg
else do
newtop <- Lua.gettop