mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-24 18:22:24 -05:00
commit
a12be8ae98
@ -95,8 +95,11 @@ function Doc(body, metadata, variables)
|
|||||||
local first, last = sv:match("(%S+)%s+(%S+)"); -- Names are hard
|
local first, last = sv:match("(%S+)%s+(%S+)"); -- Names are hard
|
||||||
add(("<firstname>%s</firstname>"):format(first));
|
add(("<firstname>%s</firstname>"):format(first));
|
||||||
add(("<surname>%s</surname>"):format(last));
|
add(("<surname>%s</surname>"):format(last));
|
||||||
-- Why is there HTML in the thing?
|
-- The values have already be converted to the output format.
|
||||||
for typ, addr in sv:gmatch("%shref='(%a+):([^']+)") do
|
-- This means author entries with e.g. <user@example.com> will already
|
||||||
|
-- have been converted into <link url='mailto:user@example.com'> 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
|
if typ == "mailto" then
|
||||||
add(("<email>%s</email>"):format(addr));
|
add(("<email>%s</email>"):format(addr));
|
||||||
elseif typ == "xmpp" then
|
elseif typ == "xmpp" then
|
||||||
@ -126,7 +129,7 @@ function Doc(body, metadata, variables)
|
|||||||
end
|
end
|
||||||
add("</header>");
|
add("</header>");
|
||||||
add(body)
|
add(body)
|
||||||
for i = 1, #sectionstack do
|
for i = #sectionstack, 1, -1 do
|
||||||
add("</section"..sectionstack[i]..">");
|
add("</section"..sectionstack[i]..">");
|
||||||
end
|
end
|
||||||
add("</xep>\n");
|
add("</xep>\n");
|
||||||
@ -180,8 +183,7 @@ function Strikeout(s)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Link(s, src, tit, attr)
|
function Link(s, src, tit, attr)
|
||||||
return "<a href='" .. escape(src,true) .. "' title='" ..
|
return "<link url='" .. escape(src,true) .. "'>" .. s .. "</link>"
|
||||||
escape(tit,true) .. "'>" .. s .. "</a>"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Image(s, src, tit, attr)
|
function Image(s, src, tit, attr)
|
||||||
@ -286,10 +288,10 @@ local function has(haystack, needle) --> boolean
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CodeBlock(s, attr)
|
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 "<example><![CDATA[".. s .. "]]></example>"
|
return "<example><![CDATA[".. s .. "]]></example>"
|
||||||
else
|
else
|
||||||
return "<code"..attributes(attr).."><![CDATA[".. s .. "]]></code>"
|
return "<code><![CDATA[".. s .. "]]></code>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user