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
add("</remark>");
else
add(("<%s>%s</%s>"):format(field, tostring(sv), field));
add(tostring(sv));
end
add(string.format("</%s>", field));
end

View File

@ -247,11 +247,21 @@ local header_schema = [[
supersededby , shortname , schemaloc* , registry? , discuss? ,
expires? , author+ , revision+ , councilnote?)
]];
for field in header_schema:gmatch("%w+") do
for field, mod in header_schema:gmatch("(%w+)([*+?]?)") do
if mod == "" or mod == "?" then
events.add_handler(field .. "#text", function(event)
meta[field] = event.text:match("%S.*%S");
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
do