From 9b906603539f2db8bca606441e0a9f5fcc86af26 Mon Sep 17 00:00:00 2001 From: servostar Date: Tue, 19 Nov 2024 11:14:04 +0100 Subject: [PATCH] feat: add support for multiple authors --- src/conf.typ | 32 +++++++--- src/lib.typ | 2 +- src/pages/confidentiality-statement.typ | 1 - src/pages/declaration-of-authorship.typ | 1 - src/pages/titlepage.typ | 78 ++++++++++++++++--------- 5 files changed, 74 insertions(+), 40 deletions(-) diff --git a/src/conf.typ b/src/conf.typ index 75f9235..299035f 100644 --- a/src/conf.typ +++ b/src/conf.typ @@ -18,16 +18,28 @@ // Adds preleminarry note page and watermark draft: true, // information about author(s) - author: ( - name: "Sven Vogel", - semester: 4, + university: ( program: "Informationtechnology", - course: "TINF19IT1", faculty: "Technik", - university: "DHBW Mannheim", - company: "ABB AG", - supervisor: "Benny Goodman", - matriculation-number: 123456789), + name: "dualen Hochschule Baden-Württemberg", + campus: "Eppelheim" + ), + authors: ( + ( + name: "Sven Vogel", + course: "TINF19IT1", + company: "ABB AG", + supervisor: "Benny Goodman", + matriculation-number: 123456789 + ), + ( + name: "Kurt Jammer", + course: "TINF24AI2", + company: "Siemens", + supervisor: "Henry Badman", + matriculation-number: 478568763 + ), + ), // information about thesis thesis: ( title: "Unofficial ABB/DHBW Typst template", @@ -87,7 +99,9 @@ if key in update { let update_val = update.at(key) - if type(val) == dictionary and type(update_val) == dictionary { + if type(val) == array { + // ignore checking arraay + } else if type(val) == dictionary and type(update_val) == dictionary { base.insert(key, deep-insert-checked(val, update_val)) } else if val == none or type(val) == type(update_val) { base.insert(key, update_val) diff --git a/src/lib.typ b/src/lib.typ index 88a7452..18f269d 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -71,7 +71,7 @@ // set document properties #set document( - author: config.author.name, + // author: config.author.name, keywords: config.thesis.keywords, title: config.thesis.title, ) diff --git a/src/pages/confidentiality-statement.typ b/src/pages/confidentiality-statement.typ index 8a6c272..474a8f6 100644 --- a/src/pages/confidentiality-statement.typ +++ b/src/pages/confidentiality-statement.typ @@ -12,7 +12,6 @@ pagebreak(weak: true) let thesis = config.thesis - let author = config.author if text.lang == "de" [ #heading(level: 1, "Sperrvermerk") diff --git a/src/pages/declaration-of-authorship.typ b/src/pages/declaration-of-authorship.typ index 81b0c53..ca4ff75 100644 --- a/src/pages/declaration-of-authorship.typ +++ b/src/pages/declaration-of-authorship.typ @@ -12,7 +12,6 @@ pagebreak(weak: true) let thesis = config.thesis - let author = config.author if text.lang == "de" [ #heading("Selbständigkeitserklärung") diff --git a/src/pages/titlepage.typ b/src/pages/titlepage.typ index ce102f8..2177c8d 100644 --- a/src/pages/titlepage.typ +++ b/src/pages/titlepage.typ @@ -10,7 +10,6 @@ context [ #let thesis = config.thesis - #let author = config.author #set align(center) @@ -31,13 +30,9 @@ // faculty #pad()[ #if text.lang == "de" [ - Praxisphase des #author.semester Semesters an der Fakultät für #author.faculty - #linebreak() - im Studiengang #author.program + aus dem Studiengang #config.university.program | #config.university.faculty ] else if text.lang == "en" [ - Practical phase of the #author.semester semester at the Faculty of #author.faculty - #linebreak() - in the degree program #author.program + from the course of studies #config.university.program | #config.university.faculty ] else [ #context panic("no translation for language: ", text.lang) ] @@ -52,41 +47,68 @@ ] else [ #context panic("no translation for language: ", text.lang) ] + #config.university.name #linebreak() - #author.university + #config.university.campus + ] + + #pad(top: 1em)[ + #let names = () + #for author in config.authors { + names.push(author.name) + } + #if text.lang == "de" [ + von + ] else if text.lang == "en" [ + by + ] else [ + #context panic("no translation for language: ", text.lang) + ] + #set text(size: 16pt) + #grid(columns: 1, row-gutter: 1em, ..names) + ] + + #pad(top: 1em)[ + #thesis.timeframe ] #set align(bottom + left) #if text.lang == "de" [ - #table( + #grid( columns: 2, column-gutter: 1cm, - align: left, + row-gutter: 0.5cm, + align: top + left, stroke: none, - [*Verfasser:*], author.name, - [*Bearbeitungszeitraum:*], thesis.timeframe, - [*Matrikelnummer, Kurs:*], - str(author.matriculation-number) + ", " + author.course, - - [*Ausbildungsbetrieb:*], author.company, - [*Betrieblicher Betreuer:*], author.supervisor, - [*Abgabedatum:*], thesis.submission-date, + [Matrikelnummer, Kurs:], + par(leading: 0.5em, for author in config.authors { + str(author.matriculation-number) + ", " + author.course + linebreak() + }), + [Betrieb, Betreuer:], + par(leading: 0.5em, for author in config.authors { + author.company + ", " + author.supervisor + linebreak() + }), ) ] else if text.lang == "en" [ - #table( + #grid( columns: 2, column-gutter: 1cm, - align: left, + row-gutter: 0.5cm, + align: top + left, stroke: none, - [*Author:*], author.name, - [*Editing period:*], thesis.timeframe, - [*Matriculation number, course:*], - str(author.matriculation-number) + ", " + author.course, - - [*Training company:*], author.company, - [*Company supervisor:*], author.supervisor, - [*Submission date:*], thesis.submission-date, + [Student ID, Course:], + par(leading: 0.5em, for author in config.authors { + str(author.matriculation-number) + ", " + author.course + linebreak() + }), + [Company, Supervisor:], + par(leading: 0.5em, for author in config.authors { + author.company + ", " + author.supervisor + linebreak() + }), ) ] else [ #context panic("no translation for language: ", text.lang)