diff options
| author | John MacFarlane <[email protected]> | 2022-10-20 15:57:40 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-20 19:53:40 -0700 |
| commit | 3fdfa7387e5b1427ccbef741f58e0e778b196c1b (patch) | |
| tree | c10be492a9422826a3e0ad9fce8dca97ece7e000 | |
| parent | ae2b6ee7b9c2299df16a84a1892ced5d3a674dcb (diff) | |
T.P.Scripting: change types of `engineReadCustom`, `engineWriteCustom`.issue8378
Not technically an API change, since these are still unreleased.
Remove the `ExtensionsConf` in the return value, and added an 'ExtensionsDiff'
parameter.
| -rw-r--r-- | src/Text/Pandoc/Scripting.hs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Scripting.hs b/src/Text/Pandoc/Scripting.hs index 5e26b0279..cef050b19 100644 --- a/src/Text/Pandoc/Scripting.hs +++ b/src/Text/Pandoc/Scripting.hs @@ -22,7 +22,7 @@ import Text.Pandoc.Class.PandocMonad (PandocMonad) import Text.Pandoc.Definition (Pandoc) import Text.Pandoc.Error (PandocError (PandocNoScriptingEngine)) import Text.Pandoc.Filter.Environment (Environment) -import Text.Pandoc.Format (ExtensionsConfig) +import Text.Pandoc.Format (ExtensionsDiff) import Text.Pandoc.Templates (Template) import Text.Pandoc.Readers (Reader) import Text.Pandoc.Writers (Writer) @@ -37,23 +37,28 @@ data ScriptingEngine = ScriptingEngine -- ^ Use the scripting engine to run a filter. , engineReadCustom :: forall m. (PandocMonad m, MonadIO m) - => FilePath -> m (Reader m, ExtensionsConfig) - -- ^ Function to parse input into a 'Pandoc' document. + => FilePath -> ExtensionsDiff -> m (Reader m) + -- ^ Use the scripting engine to generate a custom reader + -- based on the script in the 'FilePath'. Pass 'ExtensionsDiff' + -- to the reader to process. , engineWriteCustom :: forall m. (PandocMonad m, MonadIO m) - => FilePath -> m (WriterProperties m) - -- ^ Invoke the given script file to convert to any custom format. + => FilePath -> ExtensionsDiff + -> m (Writer m, m (Template Text)) + -- ^ Use the scripting engine to generate a custom writer + -- based on the script in the 'FilePath'. Pass 'ExtensionsDiff' + -- to the writer to process. + -- The return value includes both a writer and an action to retrieve + -- a default template (defined in the writer). } -type WriterProperties m = (Writer m, ExtensionsConfig, m (Template Text)) - noEngine :: ScriptingEngine noEngine = ScriptingEngine { engineName = "none" , engineApplyFilter = \_env _args _fp _doc -> throwError PandocNoScriptingEngine - , engineReadCustom = \_fp -> + , engineReadCustom = \_ -> throwError PandocNoScriptingEngine - , engineWriteCustom = \_fp -> + , engineWriteCustom = \_ -> throwError PandocNoScriptingEngine } |
