summaryrefslogtreecommitdiff
path: root/prose.lua
diff options
context:
space:
mode:
Diffstat (limited to 'prose.lua')
-rw-r--r--prose.lua19
1 files changed, 13 insertions, 6 deletions
diff --git a/prose.lua b/prose.lua
index ceadec0..99e298a 100644
--- a/prose.lua
+++ b/prose.lua
@@ -1,4 +1,5 @@
-local html = require'html'
+local html = require'garkup.html'
+local T = html.T
local extensions = {}
@@ -20,7 +21,7 @@ local function prose(S, text)
local function simple_sub(delim, tagname)
return {
"(%s)"..delim..'(.-)'..delim..'(%W)', -- wo wimple
- function(a,x,b) return a..emplace(html.T[tagname](x))..b end
+ function(a,x,b) return a..emplace(T[tagname](x))..b end
}
end
@@ -76,15 +77,21 @@ extensions.fn = function(S,text)
local n = #S.footnotes + 1
local link_id = "fnref_"..n
local note_id = "fn_"..n
- S.footnotes[n] = html.T.li({id=note_id}, {
+ S.footnotes[n] = true -- for nested footnotes
+ S.footnotes[n] = T.li({id=note_id}, {
prose(S,text), html.safe" ",
- html.T.a({href="#"..link_id, role="doc-backlink"}, html.safe"↩︎")})
- return html.T.sup({id=link_id}, html.T.a({href="#"..note_id, role='doc-noteref'}, '('..n..')'))
+ T.a({href="#"..link_id, role="doc-backlink"}, html.safe"↩︎")})
+ return T.sup({id=link_id}, T.a({href="#"..note_id, role='doc-noteref'}, '('..n..')'))
end
extensions.fns = function(S)
if not S.footnotes then return "" end
- return {html.T.hr{}, html.T.ol(S.footnotes)}
+ return {T.hr"", T.ol(S.footnotes)}
+end
+
+extensions.meta = function(S,text)
+ local fn = assert(load(string.format("return {%s}", text),"meta", "t"))
+ S.meta = fn()
end
return prose