diff --git a/tools/2xep.lua b/tools/2xep.lua
index 34c46902..4a6e0b95 100644
--- a/tools/2xep.lua
+++ b/tools/2xep.lua
@@ -95,8 +95,11 @@ function Doc(body, metadata, variables)
local first, last = sv:match("(%S+)%s+(%S+)"); -- Names are hard
add(("%s"):format(first));
add(("%s"):format(last));
- -- Why is there HTML in the thing?
- for typ, addr in sv:gmatch("%shref='(%a+):([^']+)") do
+ -- The values have already be converted to the output format.
+ -- This means author entries with e.g. will already
+ -- have been converted into by the
+ -- Link() function. Hence this hacky parser to get back the original info.
+ for typ, addr in sv:gmatch("%surl='(%a+):([^']+)") do
if typ == "mailto" then
add(("%s"):format(addr));
elseif typ == "xmpp" then
@@ -126,7 +129,7 @@ function Doc(body, metadata, variables)
end
add("");
add(body)
- for i = 1, #sectionstack do
+ for i = #sectionstack, 1, -1 do
add("");
end
add("\n");
@@ -180,8 +183,7 @@ function Strikeout(s)
end
function Link(s, src, tit, attr)
- return "" .. s .. ""
+ return "" .. s .. ""
end
function Image(s, src, tit, attr)
@@ -286,10 +288,10 @@ local function has(haystack, needle) --> boolean
end
function CodeBlock(s, attr)
- if attr and attr.class and has(attr.class, "example") then
+ if attr and attr.class and (has(attr.class, "example") or has(attr.class, "xml")) then
return ""
else
- return ""
+ return ""
end
end