From 23126bd14531c59e6a14e3c248a740d578a6a452 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Thu, 5 Sep 2024 12:28:13 +0200 Subject: [PATCH] Fix affiliation issue --- data/defaults/pdf.yaml | 2 ++ data/defaults/preprint.yaml | 3 +++ data/filters/prepare-affiliations.lua | 6 +++--- example/paper.md | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/data/defaults/pdf.yaml b/data/defaults/pdf.yaml index 01b2096..58ac67a 100644 --- a/data/defaults/pdf.yaml +++ b/data/defaults/pdf.yaml @@ -11,6 +11,8 @@ filters: path: self-citation.lua - type: lua path: fix-bibentry-spacing.lua + - type: lua + path: prepare-affiliations.lua variables: # styling options colorlinks: true diff --git a/data/defaults/preprint.yaml b/data/defaults/preprint.yaml index be33e27..b789993 100644 --- a/data/defaults/preprint.yaml +++ b/data/defaults/preprint.yaml @@ -1,6 +1,9 @@ to: latex output-file: paper.preprint.tex template: preprint.latex +filters: + - type: lua + path: prepare-affiliations.lua variables: # styling options colorlinks: true diff --git a/data/filters/prepare-affiliations.lua b/data/filters/prepare-affiliations.lua index b7c8656..0ff678e 100644 --- a/data/filters/prepare-affiliations.lua +++ b/data/filters/prepare-affiliations.lua @@ -7,9 +7,9 @@ function Meta (meta) -- and meta.author (the processed one) for _, author in ipairs(meta.authors or {}) do local xml = "" - for i, affiliation_list in ipairs(author.affiliation) do - local index = tonumber(affiliation_list[1].text) - local affiliation = meta.affiliations[index] + for i, affiliation_index in ipairs(author.affiliation) do + affiliation_index = tonumber(pandoc.utils.stringify(affiliation_index)) + local affiliation = meta.affiliations[affiliation_index] xml = xml.. "\n " for _, v in ipairs(affiliation.name) do if v.text then diff --git a/example/paper.md b/example/paper.md index 9bb0a33..1e37dc4 100644 --- a/example/paper.md +++ b/example/paper.md @@ -4,7 +4,7 @@ title: >- authors: - name: Albert Krewinkel email: albert@zeitkraut.de - affiliation: [1, 2, 4] + affiliation: "1, 2, 4" orcid: 0000-0002-9455-0796 corresponding: true - name: Juanjo Bazán