aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Scripting.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-10-02 21:00:18 +0200
committerJohn MacFarlane <[email protected]>2022-10-03 08:47:32 -0700
commit309163f5bc88884b2f021ce480537d1f8c57e068 (patch)
tree27e998c87c9f0de613850d3c6c12b3b6f60466da /src/Text/Pandoc/Scripting.hs
parent3b0e70072023d519cfb97d25ab668cf0284a5e24 (diff)
[API Change] Base custom writers on Writer type.
The `T.P.Lua.writeCustom` function changed to allow either a TextWriter or ByteStringWriter to be returned. The global variables `PANDOC_DOCUMENT` and `PANDOC_WRITER_OPTIONS` are no longer set when the writer script is loaded. Both variables are still set in classic writers before the conversion is started, so they can be used when they are wrapped in functions.
Diffstat (limited to 'src/Text/Pandoc/Scripting.hs')
-rw-r--r--src/Text/Pandoc/Scripting.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Scripting.hs b/src/Text/Pandoc/Scripting.hs
index ce171c81a..17bc2f972 100644
--- a/src/Text/Pandoc/Scripting.hs
+++ b/src/Text/Pandoc/Scripting.hs
@@ -22,8 +22,9 @@ import Text.Pandoc.Definition (Pandoc)
import Text.Pandoc.Class.PandocMonad (PandocMonad)
import Text.Pandoc.Error (PandocError (PandocNoScriptingEngine))
import Text.Pandoc.Filter.Environment (Environment)
-import Text.Pandoc.Options (ReaderOptions, WriterOptions)
+import Text.Pandoc.Options (ReaderOptions)
import Text.Pandoc.Sources (Sources)
+import Text.Pandoc.Writers (Writer)
-- | Structure to define a scripting engine.
data ScriptingEngine = ScriptingEngine
@@ -39,7 +40,7 @@ data ScriptingEngine = ScriptingEngine
-- ^ Function to parse input into a 'Pandoc' document.
, engineWriteCustom :: forall m. (PandocMonad m, MonadIO m)
- => FilePath -> WriterOptions -> Pandoc -> m Text
+ => FilePath -> m (Writer m)
-- ^ Invoke the given script file to convert to any custom format.
}
@@ -50,6 +51,6 @@ noEngine = ScriptingEngine
throwError PandocNoScriptingEngine
, engineReadCustom = \_fp _ropts _sources ->
throwError PandocNoScriptingEngine
- , engineWriteCustom = \_fp _wopts _doc ->
+ , engineWriteCustom = \_fp ->
throwError PandocNoScriptingEngine
}