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:
Kim Alvefur 2022-12-27 17:01:07 +01:00
parent 40e954b499
commit 29809ef1b5
1 changed files with 15 additions and 5 deletions

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