aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2026-01-02 13:30:47 +0100
committerJohn MacFarlane <[email protected]>2026-01-02 11:10:09 -0500
commit8f8ea44d02b6a3ca0c3e80eaf78e926889f29c9b (patch)
treed5c93a91e98838bcb916f24b8ca8b97fbc09d699 /pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs
parente8d140f41feb0ad023c0b7f22355fec96207dfee (diff)
Lua: add function `pandoc.with_state`
The function allows to run a callback with a modified pandoc state. This provides the ability to temporarily modify the resource path, the user data directory, and the HTTP request headers. Closes: #10859
Diffstat (limited to 'pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs
index 3f705616d..448976868 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/CommonState.hs
@@ -26,8 +26,10 @@ import Text.Pandoc.Class (CommonState)
typeCommonState :: LuaError e => DocumentedType e CommonState
typeCommonState = deftype "CommonState" [] []
+-- | Retrieves the common state from Lua
peekCommonState :: LuaError e => Peeker e CommonState
peekCommonState = peekUD typeCommonState
+-- | Pushes the common pandoc state to the Lua stack.
pushCommonState :: LuaError e => Pusher e CommonState
pushCommonState = pushUD typeCommonState