aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2025-07-31 11:49:20 +0200
committerJohn MacFarlane <[email protected]>2025-08-01 10:04:14 -0700
commit75aee7a23c96ff31aa9fcb7608891c33a011d6a1 (patch)
tree155da93d4f6b5e262498aba353e6e92447fb2dc9 /pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs
parent57e7d895db367eb09cb4cb31678ac3b5f6dc9ef7 (diff)
Lua: use proper interface functions to access the CommonState.
- The `PANDOC_STATE` is no longer a userdata object, but a table that behaves like the old object. - Log messages in `PANDOC_STATE.log` are now in temporal order.
Diffstat (limited to 'pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs
index f3bc6ebdd..19c2d0241 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Run.hs
@@ -61,7 +61,7 @@ runPandocLuaWith :: (PandocMonad m, MonadIO m)
-> m a
runPandocLuaWith runner pLua = do
origState <- getCommonState
- globals <- defaultGlobals
+ let globals = defaultGlobals
(result, newState) <- liftIO . runner . unPandocLua $ do
putCommonState origState
liftPandocLua $ setGlobals globals
@@ -72,11 +72,9 @@ runPandocLuaWith runner pLua = do
return result
-- | Global variables which should always be set.
-defaultGlobals :: PandocMonad m => m [Global]
-defaultGlobals = do
- commonState <- getCommonState
- return
- [ PANDOC_API_VERSION
- , PANDOC_STATE commonState
- , PANDOC_VERSION
- ]
+defaultGlobals :: [Global]
+defaultGlobals =
+ [ PANDOC_API_VERSION
+ , PANDOC_STATE
+ , PANDOC_VERSION
+ ]