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