mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-21 16:55:07 -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:
parent
d3d6c62426
commit
e6afb36d92
@ -240,8 +240,13 @@ events.add_handler("#text", function (event)
|
|||||||
return true;
|
return true;
|
||||||
end);
|
end);
|
||||||
|
|
||||||
local metafields = "title abstract number status lastcall type sig shortname"
|
local header_schema = [[
|
||||||
for field in metafields:gmatch("%S+") do
|
(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)
|
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;
|
||||||
@ -326,7 +331,7 @@ events.add_handler("date#text", function (event)
|
|||||||
if meta and not meta.date then
|
if meta and not meta.date then
|
||||||
meta.date = event.text;
|
meta.date = event.text;
|
||||||
end
|
end
|
||||||
end);
|
end, 1);
|
||||||
|
|
||||||
events.add_handler("spec#text", function (event)
|
events.add_handler("spec#text", function (event)
|
||||||
if not meta then return end
|
if not meta then return end
|
||||||
@ -357,7 +362,9 @@ events.add_handler("header/", function (event)
|
|||||||
else
|
else
|
||||||
print("% ");
|
print("% ");
|
||||||
end
|
end
|
||||||
print("% "..meta.date);
|
if meta.date then
|
||||||
|
print("% "..meta.date);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user