1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-24 10:12:19 -05:00

xep2md: Fix collection of date for simple metadata

Thanks jonas’

Another hook collected revision dates before this one
This commit is contained in:
Kim Alvefur 2021-03-02 17:40:14 +01:00
parent d3d6c62426
commit e6afb36d92

View File

@ -240,8 +240,13 @@ events.add_handler("#text", function (event)
return true;
end);
local metafields = "title abstract number status lastcall type sig shortname"
for field in metafields:gmatch("%S+") do
local header_schema = [[
(title , abstract , legal , number , status , lastcall* ,
interim* , type , sig , approver* , dependencies , supersedes ,
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;
@ -326,7 +331,7 @@ events.add_handler("date#text", function (event)
if meta and not meta.date then
meta.date = event.text;
end
end);
end, 1);
events.add_handler("spec#text", function (event)
if not meta then return end
@ -357,9 +362,11 @@ events.add_handler("header/", function (event)
else
print("% ");
end
if meta.date then
print("% "..meta.date);
end
end
end
return true;
end);