aboutsummaryrefslogtreecommitdiff
path: root/data/sample.lua
diff options
context:
space:
mode:
Diffstat (limited to 'data/sample.lua')
-rw-r--r--data/sample.lua22
1 files changed, 17 insertions, 5 deletions
diff --git a/data/sample.lua b/data/sample.lua
index 36eb9f6ef..a0c3c29a2 100644
--- a/data/sample.lua
+++ b/data/sample.lua
@@ -77,16 +77,16 @@ function Doc(body, metadata, variables)
add('<!DOCTYPE html>')
add('<html>')
add('<head>')
- add('<title>' .. metadata.title .. '</title>')
+ add('<title>' .. (metadata['title'] or '') .. '</title>')
add('</head>')
add('<body>')
- if title ~= "" then
- add('<h1 class="title">' .. metadata.title .. '</h1>')
+ if metadata['title'] and metadata['title'] ~= "" then
+ add('<h1 class="title">' .. metadata['title'] .. '</h1>')
end
- for _, author in pairs(metadata.author) do
+ for _, author in pairs(metadata['author'] or {}) do
add('<h2 class="author">' .. author .. '</h2>')
end
- if date ~= "" then
+ if metadata['date'] and metadata['date'] ~= "" then
add('<h3 class="date">' .. metadata.date .. '</h3>')
end
add(body)
@@ -177,6 +177,14 @@ function Note(s)
'"><sup>' .. num .. '</sup></a>'
end
+function Span(s, attr)
+ return "<span" .. attributes(attr) .. ">" .. s .. "</span>"
+end
+
+function Cite(s)
+ return "<span class=\"cite\">" .. s .. "</span>"
+end
+
function Plain(s)
return s
end
@@ -299,6 +307,10 @@ function Table(caption, aligns, widths, headers, rows)
return table.concat(buffer,'\n')
end
+function Div(s, attr)
+ return "<div" .. attributes(attr) .. ">\n" .. s .. "</div>"
+end
+
-- The following code will produce runtime warnings when you haven't defined
-- all of the functions you need for the custom writer, so it's useful
-- to include when you're working on a writer.