1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-24 10:12:19 -05:00

tools/2xep.lua: emit <link> instead of <a>

XEPs don't use <a>.
This commit is contained in:
Matthew Wild 2023-06-28 16:20:17 +01:00
parent 88817709d3
commit f2b88f03ce

View File

@ -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
@ -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)