Skip to content

How to load a named template in Lua? #9853

Closed Answered by tarleb
jeffvalk asked this question in Q&A
Discussion options

You must be logged in to vote

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})

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jeffvalk
Comment options

@tarleb
Comment options

@jeffvalk
Comment options

Answer selected by jeffvalk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants