aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-10-03 19:57:02 +0200
committerAlbert Krewinkel <[email protected]>2022-10-03 19:57:02 +0200
commit59e9df426267dcd5fb303742849a0e9924906f10 (patch)
tree5cfff1a0228ac9ed3648d6d73725a95418aa648d /doc
parent8986c03f20edfb8c6b25fc8c9f1a513f47bd3717 (diff)
doc/lua-filters.md: document pandoc.write_classic.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 6c772ae6a..619d4fe80 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -3543,6 +3543,36 @@ Usage:
local html = pandoc.write(doc, 'html')
assert(html == "<p><strong>Tea</strong></p>")
+### `write_classic (doc[, writer_options])` {#pandoc.write_custom}
+
+Runs a classic custom Lua writer, using the functions defined
+in the current environment.
+
+Parameters:
+
+`doc`
+: document to convert ([Pandoc](#type-pandoc))
+
+`writer_options`
+: options passed to the writer; may be a [WriterOptions] object
+ or a table with a subset of the keys and values of a
+ WriterOptions object; defaults to the default values
+ documented in the manual. ([WriterOptions]|table)
+
+Returns:
+- converted document (string)
+
+Usage:
+
+ -- Adding this function converts a classic writer into a
+ -- new-style custom writer.
+ function Writer (doc, opts)
+ PANDOC_DOCUMENT = doc
+ PANDOC_WRITER_OPTIONS = opts
+ loadfile(PANDOC_SCRIPT_FILE)()
+ return pandoc.write_classic(doc, opts)
+ end
+
[WriterOptions]: #type-writeroptions
# Module pandoc.utils