From 0e8d9d66f380cbeae8123f9c19761e8eda97d436 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 6 Nov 2024 20:29:34 +0100 Subject: [PATCH] HTML-escape institution names in CrossRef XML --- data/filters/prepare-affiliations.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/filters/prepare-affiliations.lua b/data/filters/prepare-affiliations.lua index ea657d4..0871b71 100644 --- a/data/filters/prepare-affiliations.lua +++ b/data/filters/prepare-affiliations.lua @@ -10,10 +10,14 @@ local function prepare_affiliations (meta) for i, affiliation_index in ipairs(author.affiliation) do affiliation_index = tonumber(pandoc.utils.stringify(affiliation_index)) local affiliation = meta.affiliations[affiliation_index] + local function html_escape(str) + local doc = pandoc.Pandoc{pandoc.Str(str)} + return pandoc.write(doc, 'html') + end xml = xml.. "\n " for _, v in ipairs(affiliation.name) do if v.text then - xml = xml .. v.text + xml = xml .. html_escape(v.text) else xml = xml .. " " end