From 29809ef1b58ed94dda4c51c151e4f358d1e9622b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 27 Dec 2022 17:01:07 +0100 Subject: [PATCH 1/2] 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 ``` --- tools/xep2md.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/xep2md.lua b/tools/xep2md.lua index 019710e0..624b3bee 100644 --- a/tools/xep2md.lua +++ b/tools/xep2md.lua @@ -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 From 5a55805a67a51427e3717a90e515b5a2b52173ec Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 27 Dec 2022 17:27:08 +0100 Subject: [PATCH 2/2] tools/2xep: Fix encoding of simple list metadata An extra wrapper element was added ``` 2017-11-15 ``` Correct is one element with text for each item ``` 2017-11-15 ``` --- tools/2xep.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/2xep.lua b/tools/2xep.lua index 3ca9ed37..34c46902 100644 --- a/tools/2xep.lua +++ b/tools/2xep.lua @@ -115,7 +115,7 @@ function Doc(body, metadata, variables) end add(""); else - add(("<%s>%s"):format(field, tostring(sv), field)); + add(tostring(sv)); end add(string.format("", field)); end