summaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/test/writer-template.lua
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2022-10-12 21:37:47 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2022-10-14 10:37:37 -0700
commit8900b0f953798b01087e0135a3a9708a95eb7fde (patch)
treeb7221db3118cff0d81daf9282aa33c05536631f6 /pandoc-lua-engine/test/writer-template.lua
parent06ba4e9788eb5d53d566c01ad8e24aa91e104a74 (diff)
Lua: Support built-in default templates for custom writers
Custom writers can define a default template via a global `Template` function; the data directory is no longer searched for a default template. Writer authors can restore the old lookup behavior with ``` lua Template = function () local template return template.compile(template.default(PANDOC_SCRIPT_FILE)) end ```
Diffstat (limited to 'pandoc-lua-engine/test/writer-template.lua')
-rw-r--r--pandoc-lua-engine/test/writer-template.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/pandoc-lua-engine/test/writer-template.lua b/pandoc-lua-engine/test/writer-template.lua
new file mode 100644
index 000000000..c90f7c1ef
--- /dev/null
+++ b/pandoc-lua-engine/test/writer-template.lua
@@ -0,0 +1,7 @@
+function Writer (doc, opts)
+ return pandoc.write(doc, 'gfm', opts)
+end
+
+function Template ()
+ return pandoc.template.compile '<!-- start -->\n$body$\n<!-- stop -->\n'
+end