From 0e9d3db244ae8cf86ae5342d4cb334577d7e4c7d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 16 Jul 2014 15:17:08 -0700 Subject: Custom writers now work with `--template`. Removed HTML header scaffolding from data/sample.lua. --- data/sample.lua | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'data') diff --git a/data/sample.lua b/data/sample.lua index 486f300e3..f5c17839e 100644 --- a/data/sample.lua +++ b/data/sample.lua @@ -67,28 +67,15 @@ end -- This function is called once for the whole document. Parameters: -- body is a string, metadata is a table, variables is a table. --- One could use some kind of templating --- system here; this just gives you a simple standalone HTML file. +-- This gives you a fragment. You could use the metadata table to +-- fill variables in a custom lua template. Or, pass `--template=...` +-- to pandoc, and pandoc will add do the template processing as +-- usual. function Doc(body, metadata, variables) local buffer = {} local function add(s) table.insert(buffer, s) end - add('') - add('') - add('') - add('' .. (metadata['title'] or '') .. '') - add('') - add('') - if metadata['title'] and metadata['title'] ~= "" then - add('

' .. metadata['title'] .. '

') - end - for _, author in pairs(metadata['author'] or {}) do - add('

' .. author .. '

') - end - if metadata['date'] and metadata['date'] ~= "" then - add('

' .. metadata.date .. '

') - end add(body) if #notes > 0 then add('
    ') @@ -97,8 +84,6 @@ function Doc(body, metadata, variables) end add('
') end - add('') - add('') return table.concat(buffer,'\n') end -- cgit v1.2.3