aboutsummaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/test/extensions.lua
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-10-07 21:37:57 +0200
committerJohn MacFarlane <[email protected]>2022-10-10 09:39:18 -0700
commita088cbf5637596a461ba9f99b49210235d6c0a68 (patch)
treed4703d158cf07e4dd45b96fff16166d5ea9abf31 /pandoc-lua-engine/test/extensions.lua
parente1e07cce65a0bb007da934245e74be1b1c8a0f6e (diff)
Lua: support extensions in custom writers
Custom writers can define the extensions that they support via the global `writer_extensions`. The variable's value must be a table with all supported extensions as keys, and their default status as values. E.g., the below specifies that the writer support the extensions `smart` and `sourcepos`, but only the `smart` extension is enabled by default: writer_extensions = { smart = true, sourcepos = false, }
Diffstat (limited to 'pandoc-lua-engine/test/extensions.lua')
-rw-r--r--pandoc-lua-engine/test/extensions.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/pandoc-lua-engine/test/extensions.lua b/pandoc-lua-engine/test/extensions.lua
new file mode 100644
index 000000000..cea9a45a1
--- /dev/null
+++ b/pandoc-lua-engine/test/extensions.lua
@@ -0,0 +1,12 @@
+function Writer (doc, opts)
+ local output = 'smart extension is %s;\ncitations extension is %s\n'
+ local status = function (ext)
+ return opts.extensions:includes(ext) and 'enabled' or 'disabled'
+ end
+ return output:format(status('smart'), status('citations'))
+end
+
+writer_extensions = {
+ smart = true,
+ citations = false,
+}