mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-24 02:02:16 -05:00
Merge pull request #1259 from Zash/xep2md-tool
Fix metadata conversion in markdown scripts
This commit is contained in:
commit
d79c8fafb6
@ -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
|
||||
|
@ -247,11 +247,21 @@ local header_schema = [[
|
||||
supersededby , shortname , schemaloc* , registry? , discuss? ,
|
||||
expires? , author+ , revision+ , councilnote?)
|
||||
]];
|
||||
for field in header_schema:gmatch("%w+") do
|
||||
events.add_handler(field.."#text", function (event)
|
||||
meta[field] = event.text:match("%S.*%S");
|
||||
return true;
|
||||
end);
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user