mirror of
https://github.com/moparisthebest/xeps
synced 2024-08-13 16:53:48 -04:00
tool/xep2md: Record all list metadata items
E.g. lastcall can exist more than once according to the schema, but only one item was kept. Before: ```yaml lastcall: 2017-11-15 ``` After: ```yaml lastcall: - 2021-03-30 - 2017-11-15 ```
This commit is contained in:
parent
40e954b499
commit
29809ef1b5
@ -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
|
||||||
|
events.add_handler(field .. "#text", function(event)
|
||||||
meta[field] = event.text:match("%S.*%S");
|
meta[field] = event.text:match("%S.*%S");
|
||||||
return true;
|
return true;
|
||||||
end);
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user