-
How does one load an arbitrarily named template in Lua, assuming the template is in the data directory? I'm imagining something like the following, which (almost) works: local template_text = pandoc.template.default("my_template.html")
local options = {template = pandoc.template.compile(template_text)}
pandoc.write(doc, "html", options) ...except that it searches for a template named |
Beta Was this translation helpful? Give feedback.
Answered by
tarleb
Jun 7, 2024
Replies: 1 comment 3 replies
-
There's no special function for that, so it's down to basic Lua functions: local path = require 'pandoc.path'
local template_path = path.join{PANDOC_STATE.user_data_dir, 'template', 'my_template.html'}
local template_text = io:open(template_path):read 'a'
pandoc.write(doc, 'html', {template = template_text}) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
jeffvalk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's no special function for that, so it's down to basic Lua functions: