1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-21 16:55:07 -05:00

Merge pull request #1259 from Zash/xep2md-tool

Fix metadata conversion in markdown scripts
This commit is contained in:
Jonas Schäfer 2022-12-27 19:44:24 +01:00 committed by GitHub
commit d79c8fafb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -115,7 +115,7 @@ function Doc(body, metadata, variables)
end end
add("</remark>"); add("</remark>");
else else
add(("<%s>%s</%s>"):format(field, tostring(sv), field)); add(tostring(sv));
end end
add(string.format("</%s>", field)); add(string.format("</%s>", field));
end end

View File

@ -247,11 +247,21 @@ local header_schema = [[
supersededby , shortname , schemaloc* , registry? , discuss? , supersededby , shortname , schemaloc* , registry? , discuss? ,
expires? , author+ , revision+ , councilnote?) expires? , author+ , revision+ , councilnote?)
]]; ]];
for field in header_schema:gmatch("%w+") do for field, mod in header_schema:gmatch("(%w+)([*+?]?)") do
events.add_handler(field.."#text", function (event) if mod == "" or mod == "?" then
meta[field] = event.text:match("%S.*%S"); events.add_handler(field .. "#text", function(event)
return true; meta[field] = event.text:match("%S.*%S");
end); return true;
end);
elseif mod == "*" or mod == "+" then
events.add_handler(field .. "#text", function(event)
if not meta[field] then
meta[field] = {};
end
table.insert(meta[field], event.text:match("%S.*%S"));
return true;
end);
end
end end
do do