feat: add support for flipping the order of role and name in author table

This commit is contained in:
JustAnyone committed 2026-09-28 10:42:49 +03:00
1 parent d0d7d2a197
commit 55a236fe8b
1 file changed
+18 -4
+18 -4
View File
@@ -17,6 +17,7 @@
#let ktu-author-table( #let ktu-author-table(
authors: (), authors: (),
alignment: right, alignment: right,
namesFirst: true, // if false, roles will be displayed first
) = context { ) = context {
// The layout should be a list of lists whose elements are (name, role) pairs. // The layout should be a list of lists whose elements are (name, role) pairs.
assert(authors.len() > 0, message: "author table must have at least one author") assert(authors.len() > 0, message: "author table must have at least one author")
@@ -51,9 +52,13 @@
table.header([]), table.header([]),
..for author in authors { ..for author in authors {
let (name, role) = author let (name, role) = author
name = [*#name*]
if not namesFirst {
(role, name) = (name, role)
}
(align(center)[ (align(center)[
#set block(below: 8pt) #set block(below: 8pt)
#block[*#name*] #block[#name]
#block[#role] #block[#role]
], []) ], [])
@@ -67,9 +72,13 @@
), ),
..for author in authors { ..for author in authors {
let (name, role) = author let (name, role) = author
name = [*#name*]
if not namesFirst {
(role, name) = (name, role)
}
(align(left)[ (align(left)[
#set block(below: 8pt) #set block(below: 8pt)
#block[*#name*] #block[#name]
#block[#role] #block[#role]
], [], [], []) ], [], [], [])
@@ -140,6 +149,7 @@
place: highlight[Kaunas], place: highlight[Kaunas],
year: highlight[#datetime.today().year()], year: highlight[#datetime.today().year()],
centerAuthors: false, centerAuthors: false,
authorNamesFirst: true, // if false, roles will be displayed first
) = { ) = {
let subHeaders = (faculty,) let subHeaders = (faculty,)
if department != none { if department != none {
@@ -155,9 +165,9 @@
) )
v(94pt) v(94pt)
if centerAuthors { if centerAuthors {
ktu-author-table(authors: authors, alignment: center) ktu-author-table(authors: authors, namesFirst: authorNamesFirst, alignment: center)
} else { } else {
ktu-author-table(authors: authors) ktu-author-table(authors: authors, namesFirst: authorNamesFirst)
} }
align(center+bottom, block([*#place, #year*])) align(center+bottom, block([*#place, #year*]))
} }
@@ -171,6 +181,7 @@
(highlight[Vardenis Pavardenis], highlight[Projekto autorius]), (highlight[Vardenis Pavardenis], highlight[Projekto autorius]),
(highlight[Vardenis Pavardenis], highlight[Vadovas]), (highlight[Vardenis Pavardenis], highlight[Vadovas]),
), ),
authorNamesFirst: true, // if false, roles will be displayed first
place: highlight[Kaunas], place: highlight[Kaunas],
year: highlight[#datetime.today().year()], year: highlight[#datetime.today().year()],
) = { ) = {
@@ -183,6 +194,7 @@
place: place, place: place,
year: year, year: year,
centerAuthors: true, centerAuthors: true,
authorNamesFirst: authorNamesFirst,
) )
} }
@@ -195,6 +207,7 @@
(highlight[Vardenis Pavardenis], highlight[Projekto autorius]), (highlight[Vardenis Pavardenis], highlight[Projekto autorius]),
(highlight[Vardenis Pavardenis], highlight[Vadovas]), (highlight[Vardenis Pavardenis], highlight[Vadovas]),
), ),
authorNamesFirst: true, // if false, roles will be displayed first
place: highlight[Kaunas], place: highlight[Kaunas],
year: highlight[#datetime.today().year()], year: highlight[#datetime.today().year()],
) = { ) = {
@@ -207,6 +220,7 @@
place: place, place: place,
year: year, year: year,
centerAuthors: false, centerAuthors: false,
authorNamesFirst: authorNamesFirst,
) )
} }