I’m trying to recover, before trying to rewrite, a “classic” pandoc custom writer called tba.lua
.
Thus far, I’ve managed to make it work by adding the prescribed patch in the form
function Writer (doc, opts)
PANDOC_DOCUMENT = doc
PANDOC_WRITER_OPTIONS = opts
loadfile(PANDOC_SCRIPT_FILE)()
return pandoc.write_classic(doc, opts)
end
as stated in the documentation.
But then, I need to add always a --template
option to load the template, as the writer in standalone mode complains about
No template defined in tba.lua
While seeing another example in the documentation, I tried to define the template in the writer by adding
function Template ()
local template = pandoc.template
return template.compile(template.default 'tba.lua')
end
Pandoc now can find the template default.tba.lua
in the --data-dir
directory, but now complains that
Error running Lua:
string expected, got pandoc Template
I thought that template.compile
would return the string, so I don’t know what went wrong.