From e7625fa93bec336e655ac2bd42e00959bb00be9d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 2 Mar 2021 17:58:52 +0100 Subject: [PATCH 1/3] Allow dependencies to be missing from metadata xep2md leaves it out if there are zero dependencies in the input, so seems sensible to mirror that in the opposite direction --- tools/2xep.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/2xep.lua b/tools/2xep.lua index 64ced99e..ca985cac 100644 --- a/tools/2xep.lua +++ b/tools/2xep.lua @@ -69,7 +69,7 @@ function Doc(body, metadata, variables) if field == "legal" then add("&LEGALNOTICE;"); goto next; - elseif field == "supersedes" or field == "supersededby" then + elseif field == "supersedes" or field == "supersededby" or field == "dependencies" then add(("<%s/>"):format(field)); goto next; elseif r ~= "*" and r ~= "?" then From 0ccc34d1cf0cfa955b91aa28756a4e1fa252597c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 3 Mar 2021 15:29:17 +0100 Subject: [PATCH 2/3] Reduce error on missing required metadata to yelling on stderr --- tools/2xep.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/2xep.lua b/tools/2xep.lua index ca985cac..85db6756 100644 --- a/tools/2xep.lua +++ b/tools/2xep.lua @@ -73,7 +73,8 @@ function Doc(body, metadata, variables) add(("<%s/>"):format(field)); goto next; elseif r ~= "*" and r ~= "?" then - error(string.format("Missing required metadata field '%s'", field)); + io.stderr:write(string.format("Missing REQUIRED metadata field '%s'\n", field)); + goto next; else io.stderr:write(string.format("Missing optional metadata field '%s'\n", field)); goto next; From e7e1fca3bf04441141b8a13e22f1e06accf79009 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 3 Mar 2021 15:43:00 +0100 Subject: [PATCH 3/3] Pass trough entity references into markdown In order to allow e.g. &xepnnnn; references in text. --- tools/2xep.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/2xep.lua b/tools/2xep.lua index 85db6756..3ca9ed37 100644 --- a/tools/2xep.lua +++ b/tools/2xep.lua @@ -139,6 +139,7 @@ end -- Comments indicate the types of other variables. function Str(s) + if string.match(s, "^&[%w%-.]+;$") then return s; end return escape(s) end