diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-07-16 15:17:08 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-07-16 15:17:08 -0700 |
commit | 0e9d3db244ae8cf86ae5342d4cb334577d7e4c7d (patch) | |
tree | bc6909208284ec605e76f379a1a50439c193e77d /data | |
parent | aa1ac5a0af11bd8dbcb09760dc5f2c7e86c5947b (diff) | |
download | pandoc-0e9d3db244ae8cf86ae5342d4cb334577d7e4c7d.tar.gz |
Custom writers now work with `--template`.
Removed HTML header scaffolding from data/sample.lua.
Diffstat (limited to 'data')
-rw-r--r-- | data/sample.lua | 23 |
1 files changed, 4 insertions, 19 deletions
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('<!DOCTYPE html>') - add('<html>') - add('<head>') - add('<title>' .. (metadata['title'] or '') .. '</title>') - add('</head>') - add('<body>') - if metadata['title'] and metadata['title'] ~= "" then - add('<h1 class="title">' .. metadata['title'] .. '</h1>') - end - for _, author in pairs(metadata['author'] or {}) do - add('<h2 class="author">' .. author .. '</h2>') - end - if metadata['date'] and metadata['date'] ~= "" then - add('<h3 class="date">' .. metadata.date .. '</h3>') - end add(body) if #notes > 0 then add('<ol class="footnotes">') @@ -97,8 +84,6 @@ function Doc(body, metadata, variables) end add('</ol>') end - add('</body>') - add('</html>') return table.concat(buffer,'\n') end |