Skip to content

Commit

Permalink
Fix affiliation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Sep 5, 2024
1 parent 56f7446 commit 23126bd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions data/defaults/pdf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions data/defaults/preprint.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions data/filters/prepare-affiliations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ function Meta (meta)
-- and meta.author (the processed one)
for _, author in ipairs(meta.authors or {}) do
local xml = "<affiliations>"
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 <institution><institution_name>"
for _, v in ipairs(affiliation.name) do
if v.text then
Expand Down
2 changes: 1 addition & 1 deletion example/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: >-
authors:
- name: Albert Krewinkel
email: [email protected]
affiliation: [1, 2, 4]
affiliation: "1, 2, 4"
orcid: 0000-0002-9455-0796
corresponding: true
- name: Juanjo Bazán
Expand Down

0 comments on commit 23126bd

Please sign in to comment.