Skip to content

Commit

Permalink
HTML-escape institution names in CrossRef XML
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Nov 6, 2024
1 parent a3027dc commit 0e8d9d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/filters/prepare-affiliations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 <institution><institution_name>"
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
Expand Down

0 comments on commit 0e8d9d6

Please sign in to comment.