Compare commits

..

3 Commits

Author SHA1 Message Date
Sven Vogel 093ed09293 fixed format of template for (#13)
Gitea Action for checking typst compilation / run-ci-linux (push) Failing after 1m47s Details
2024-08-27 19:52:07 +02:00
Sven Vogel 946a16fce6 add typstyle check to CI (#13) 2024-08-27 19:50:31 +02:00
Sven Vogel 7ad138dc00 fix CI failing (#18) 2024-08-27 19:50:09 +02:00
10 changed files with 361 additions and 314 deletions

View File

@ -25,7 +25,8 @@ function enter-section() {
printf "\\n" printf "\\n"
eval "$2" eval "$2"
if [ $? -neq $3 ]; then exit_status=$?
if ! [ $exit_status -eq $3 ]; then
abort "command: $2 failed in section: $1" abort "command: $2 failed in section: $1"
fi fi
@ -33,6 +34,7 @@ function enter-section() {
log "INFO" "section $1 completed successfully" log "INFO" "section $1 completed successfully"
} }
enter-section "Typstyle checking" "./run-fmt.sh --check src/lib.typ" 0
enter-section "BUILD: ABB code theme" "./generate-theme.sh" 0 enter-section "BUILD: ABB code theme" "./generate-theme.sh" 0
enter-section "Compiling template..." "typst compile template/main.typ --root . example.pdf" 0 enter-section "Compiling template..." "typst compile template/main.typ --root . example.pdf" 0
enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root ." 0 enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root ." 0

View File

@ -129,7 +129,9 @@ SOFTWARE.*/
// show rule to make the references for glossarium // show rule to make the references for glossarium
#let make-glossary(body) = { #let make-glossary(body) = {
show ref: r => { show ref: r => {
if r.element != none and r.element.func() == figure and r.element.kind == __glossarium_figure { if r.element != none and r.element.func() == figure and r
.element
.kind == __glossarium_figure {
// call to the general citing function // call to the general citing function
gls(str(r.target), suffix: r.citation.supplement) gls(str(r.target), suffix: r.citation.supplement)
} else { } else {
@ -200,25 +202,33 @@ SOFTWARE.*/
if hasLong and hasDesc [:] if hasLong and hasDesc [:]
if hasDesc [ #desc ] else [. ] if hasDesc [ #desc ] else [. ]
if disable-back-references != true { if disable-back-references != true {
term_references.map(x => x.location()).sorted(key: x => x.page()).fold( term_references
(values: (), pages: ()), .map(x => x.location())
((values, pages), x) => if pages.contains(x.page()) { .sorted(key: x => x.page())
(values: values, pages: pages) .fold(
} else { (values: (), pages: ()),
values.push(x) ((values, pages), x) => if pages.contains(
pages.push(x.page()) x.page(),
(values: values, pages: pages) ) {
}, (values: values, pages: pages)
).values.map(x => { } else {
let page-numbering = x.page-numbering() values.push(x)
if page-numbering == none { pages.push(x.page())
page-numbering = "1" (values: values, pages: pages)
} },
link(x)[#numbering( )
page-numbering, .values
..counter(page).at(x), .map(x => {
)] let page-numbering = x.page-numbering()
}).join(", ") if page-numbering == none {
page-numbering = "1"
}
link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
})
.join(", ")
} }
}, },
) )

View File

@ -6,22 +6,24 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let new_abstract(config) = context { #let new_abstract(config) = (
context {
set align(center + horizon) set align(center + horizon)
// only include summary when a language other than english is used // only include summary when a language other than english is used
if text.lang == "de" [ if text.lang == "de" [
// Summary is supposed to be on separate page // Summary is supposed to be on separate page
#pagebreak(weak: true) #pagebreak(weak: true)
= Zusammenfassung = Zusammenfassung
#config.thesis.summary #config.thesis.summary
] ]
// abstract is supposed to be on separate page // abstract is supposed to be on separate page
pagebreak(weak: true) pagebreak(weak: true)
heading("Abstract") heading("Abstract")
config.thesis.abstract config.thesis.abstract
} }
)

View File

@ -6,37 +6,39 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let show-appendix(config: dictionary) = context { #let show-appendix(config: dictionary) = (
counter(heading).update(0) context {
counter(heading).update(0)
let title = if text.lang == "en" { let title = if text.lang == "en" {
"Appendix" "Appendix"
} else { } else {
"Anhang" "Anhang"
}
if "appendices" in config.thesis {
pagebreak(weak: true)
heading(level: 1, numbering: none, title)
v(-2em)
// APA style appendix
show heading: it => {
let number = if it.numbering != none {
counter(heading).display(it.numbering)
}
block()[
#title #number - #it.body
]
} }
show heading.where(level: 1): it => v(2em) + it + v(1em) if "appendices" in config.thesis {
show heading.where(level: 2): it => v(1em) + it + v(0.5em) pagebreak(weak: true)
show heading.where(level: 3): it => v(0.5em) + it + v(0.25em)
set heading(numbering: "A.1", supplement: title) heading(level: 1, numbering: none, title)
v(-2em)
config.thesis.appendices // APA style appendix
show heading: it => {
let number = if it.numbering != none {
counter(heading).display(it.numbering)
}
block()[
#title #number - #it.body
]
}
show heading.where(level: 1): it => v(2em) + it + v(1em)
show heading.where(level: 2): it => v(1em) + it + v(0.5em)
show heading.where(level: 3): it => v(0.5em) + it + v(0.25em)
set heading(numbering: "A.1", supplement: title)
config.thesis.appendices
}
} }
} )

View File

@ -6,51 +6,52 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let new_confidentiality_statement_page(config) = context { #let new_confidentiality_statement_page(config) = (
context {
pagebreak(weak: true) pagebreak(weak: true)
let thesis = config.thesis let thesis = config.thesis
let author = config.author let author = config.author
if text.lang == "de" [ if text.lang == "de" [
#heading(level: 1, "Sperrvermerk", supplement: [special]) #heading(level: 1, "Sperrvermerk", supplement: [special])
] else if text.lang == "en" [ ] else if text.lang == "en" [
#heading(level: 1, "Confidentiality Statement", supplement: [special]) #heading(level: 1, "Confidentiality Statement", supplement: [special])
] ]
if text.lang == "de" [ if text.lang == "de" [
Der Inhalt der dieser Arbeit mit dem Thema Der Inhalt der dieser Arbeit mit dem Thema
] else if text.lang == "en" [ ] else if text.lang == "en" [
The content of this work with the topic The content of this work with the topic
] ]
v(1em) v(1em)
set align(center) set align(center)
text(weight: "bold", thesis.title) text(weight: "bold", thesis.title)
if thesis.subtitle != none { if thesis.subtitle != none {
linebreak() linebreak()
thesis.subtitle thesis.subtitle
} }
set align(left) set align(left)
v(1em) v(1em)
set par(justify: true) set par(justify: true)
if text.lang == "de" [ if text.lang == "de" [
darf weder als Ganzes noch in Auszügen Personen außerhalb des Prüfungsprozesses und des Evalua-tionsverfahrens zugänglich gemacht werden, sofern keine anderslautende Genehmigung der Ausbildungsstätte vorliegt. darf weder als Ganzes noch in Auszügen Personen außerhalb des Prüfungsprozesses und des Evalua-tionsverfahrens zugänglich gemacht werden, sofern keine anderslautende Genehmigung der Ausbildungsstätte vorliegt.
] else if text.lang == "en" [ ] else if text.lang == "en" [
may not be made accessible to persons outside the examination process and the evaluation procedure, either as a whole or in excerpts, unless otherwise authorized by the training institution. may not be made accessible to persons outside the examination process and the evaluation procedure, either as a whole or in excerpts, unless otherwise authorized by the training institution.
] ]
set align(horizon) set align(horizon)
grid( grid(
// set width of columns // set width of columns
// we need two, so make both half the page width // we need two, so make both half the page width
columns: (50%, 50%), columns: (50%, 50%),
@ -59,4 +60,5 @@
align(left, {line(length: 6cm)}), align(left, {line(length: 6cm)}),
align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }),
align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) }))
} }
)

View File

@ -6,53 +6,54 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let new_declaration_of_authorship(config) = context { #let new_declaration_of_authorship(config) = (
context {
pagebreak(weak: true) pagebreak(weak: true)
let thesis = config.thesis let thesis = config.thesis
let author = config.author let author = config.author
if text.lang == "de" [ if text.lang == "de" [
#heading("Selbständigkeitserklärung") #heading("Selbständigkeitserklärung")
] else if text.lang == "en" [ ] else if text.lang == "en" [
#heading("Declaration of Authorship") #heading("Declaration of Authorship")
] ]
v(1em) v(1em)
if text.lang == "de" [ if text.lang == "de" [
Ich versichere hiermit, dass ich meine Prüfung mit dem Thema Ich versichere hiermit, dass ich meine Prüfung mit dem Thema
] else if text.lang == "en" [ ] else if text.lang == "en" [
I hereby confirm that I have written this thesis with the subject I hereby confirm that I have written this thesis with the subject
] ]
v(1em) v(1em)
set align(center) set align(center)
text(weight: "bold", thesis.title) text(weight: "bold", thesis.title)
if thesis.subtitle != none { if thesis.subtitle != none {
linebreak() linebreak()
thesis.subtitle thesis.subtitle
} }
set align(left) set align(left)
v(1em) v(1em)
set par(justify: true) set par(justify: true)
if text.lang == "de" [ if text.lang == "de" [
selbständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe. Ich versichere zudem, dass die eingereichte elektronische Fassung mit der gedruckten Fassung übereinstimmt. selbständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe. Ich versichere zudem, dass die eingereichte elektronische Fassung mit der gedruckten Fassung übereinstimmt.
] else if text.lang == "en" [ ] else if text.lang == "en" [
independently and have not used any sources or aids other than those specified. I also confirm that the electronic version submitted is identical to the printed version. independently and have not used any sources or aids other than those specified. I also confirm that the electronic version submitted is identical to the printed version.
] ]
set align(horizon) set align(horizon)
grid( grid(
// set width of columns // set width of columns
// we need two, so make both half the page width // we need two, so make both half the page width
columns: (50%, 50%), columns: (50%, 50%),
@ -61,4 +62,5 @@
align(left, {line(length: 6cm)}), align(left, {line(length: 6cm)}),
align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }),
align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) }))
} }
)

View File

@ -10,88 +10,100 @@
// with a specific title and filter by a specifc kind of figure // with a specific title and filter by a specifc kind of figure
// can optionally insert a pagebreak after the outline // can optionally insert a pagebreak after the outline
// NOTE: will not render in case the listing is empty // NOTE: will not render in case the listing is empty
#let render_filtered_outline(title: str, kind: selector) = context { #let render_filtered_outline(title: str, kind: selector) = (
context {
let elems = query(figure.where(kind: kind), here()) let elems = query(figure.where(kind: kind), here())
let count = elems.len() let count = elems.len()
// only show outline if there is something to list // only show outline if there is something to list
if count > 0 { if count > 0 {
pagebreak(weak: true) pagebreak(weak: true)
outline( outline(
title: title, title: title,
target: figure.where(kind: kind), target: figure.where(kind: kind),
) )
}
} }
} )
#let render_figures_outline() = context { #let render_figures_outline() = (
let title = if (text.lang == "de") { context {
"Abbildungsverzeichnis"
} else if text.lang == "en" {
"List of Figures"
}
render_filtered_outline(title: title, kind: image)
}
#let render_table_outline() = context {
let title = if (text.lang == "de") {
"Tabellenverzeichnis"
} else if text.lang == "en" {
"List of Tables"
}
render_filtered_outline(title: title, kind: table)
}
#let render_raw_outline() = context {
let title = if (text.lang == "de") {
"Quelltextverzeichnis"
} else if text.lang == "en" {
"Code Snippets"
}
render_filtered_outline(title: title, kind: raw)
}
#let render_heading_outline() = context {
let title = if (text.lang == "de") {
"Inhaltsverzeichnis"
} else if text.lang == "en" {
"Table of Contents"
}
pagebreak(weak: true)
outline(
target: heading.where(supplement: [chapter]),
title: title,
indent: auto,
)
}
#let render_appendix_outline() = context {
let supplement = if text.lang == "en" {
[Appendix]
} else {
[Anhang]
}
if query(heading.where(supplement: supplement)).len() > 0 {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Anhangsverzeichnis" "Abbildungsverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
"Table of Appendices" "List of Figures"
}
render_filtered_outline(title: title, kind: image)
}
)
#let render_table_outline() = (
context {
let title = if (text.lang == "de") {
"Tabellenverzeichnis"
} else if text.lang == "en" {
"List of Tables"
}
render_filtered_outline(title: title, kind: table)
}
)
#let render_raw_outline() = (
context {
let title = if (text.lang == "de") {
"Quelltextverzeichnis"
} else if text.lang == "en" {
"Code Snippets"
}
render_filtered_outline(title: title, kind: raw)
}
)
#let render_heading_outline() = (
context {
let title = if (text.lang == "de") {
"Inhaltsverzeichnis"
} else if text.lang == "en" {
"Table of Contents"
} }
pagebreak(weak: true) pagebreak(weak: true)
outline( outline(
target: heading.where(supplement: supplement), target: heading.where(supplement: [chapter]),
title: title, title: title,
indent: auto, indent: auto,
) )
} }
} )
#let render_appendix_outline() = (
context {
let supplement = if text.lang == "en" {
[Appendix]
} else {
[Anhang]
}
if query(heading.where(supplement: supplement)).len() > 0 {
let title = if (text.lang == "de") {
"Anhangsverzeichnis"
} else if text.lang == "en" {
"Table of Appendices"
}
pagebreak(weak: true)
outline(
target: heading.where(supplement: supplement),
title: title,
indent: auto,
)
}
}
)
#let new_outline() = { #let new_outline() = {
pagebreak(weak: true) pagebreak(weak: true)

View File

@ -6,51 +6,53 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let new_prerelease_note(config) = context { #let new_prerelease_note(config) = (
context {
pagebreak(weak: true) pagebreak(weak: true)
let thesis = config.thesis let thesis = config.thesis
let author = config.author let author = config.author
if text.lang == "de" [ if text.lang == "de" [
#heading("Vorabfassung") #heading("Vorabfassung")
] else if text.lang == "en" [ ] else if text.lang == "en" [
#heading("Preliminary Version") #heading("Preliminary Version")
] ]
v(1em) v(1em)
if text.lang == "de" [ if text.lang == "de" [
Bei dieser Ausgabe der Arbeit mit dem Thema Bei dieser Ausgabe der Arbeit mit dem Thema
] else if text.lang == "en" [ ] else if text.lang == "en" [
This edition of the work with the subject This edition of the work with the subject
] ]
v(1em) v(1em)
set align(center) set align(center)
text(weight: "bold", thesis.title) text(weight: "bold", thesis.title)
if thesis.subtitle != none { if thesis.subtitle != none {
linebreak() linebreak()
thesis.subtitle thesis.subtitle
}
set align(left)
v(1em)
set par(justify: true)
if text.lang == "de" [
handelt es sich _nicht_ um die fertige Fassung. Das Dokument kann Inhaltliche-, Grammatikalische- sowie Format-Fehler enthalten. Das Dokument ist im Rahmen der Aufgabenstellung von Seiten der #author.university nicht zur Bewertung freigegeben und ein anderer Verwendungszweck als eine Vorschau ist nicht gestattet.
] else if text.lang == "en" [
is not the final version. The document may contain errors in content, grammar and formatting. The document may not be released for evaluation to #author.university as part of the assignment, and any use other than a preview is not permitted.
]
v(1em)
h(1em)
[#author.name, #datetime.today().display()]
} }
)
set align(left)
v(1em)
set par(justify: true)
if text.lang == "de" [
handelt es sich _nicht_ um die fertige Fassung. Das Dokument kann Inhaltliche-, Grammatikalische- sowie Format-Fehler enthalten. Das Dokument ist im Rahmen der Aufgabenstellung von Seiten der #author.university nicht zur Bewertung freigegeben und ein anderer Verwendungszweck als eine Vorschau ist nicht gestattet.
] else if text.lang == "en" [
is not the final version. The document may contain errors in content, grammar and formatting. The document may not be released for evaluation to #author.university as part of the assignment, and any use other than a preview is not permitted.
]
v(1em)
h(1em)
[#author.name, #datetime.today().display()]
}

View File

@ -6,91 +6,92 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let new_title_page(config) = context [ #let new_title_page(config) = (
context [
#let thesis = config.thesis #let thesis = config.thesis
#let author = config.author #let author = config.author
#set align(center) #set align(center)
// title // title
#v(2cm) #v(2cm)
#text(size: 2em, weight: "semibold", thesis.title) #text(size: 2em, weight: "semibold", thesis.title)
// subtitle // subtitle
#text(size: 1.5em, thesis.subtitle) #text(size: 1.5em, thesis.subtitle)
// type of paper // type of paper
#v(1cm) #v(1cm)
#text(size: 1.5em, weight: "bold", thesis.kind) #text(size: 1.5em, weight: "bold", thesis.kind)
// faculty
#pad(top: 0.5cm)[
#if text.lang == "de" [
Praxisphase des #author.semester Studienjahrs an der Fakultät für #author.faculty
#linebreak()
im Studiengang #author.program
] else if text.lang == "en" [
Practical phase of the #author.semester academic year at the Faculty of #author.faculty
#linebreak()
in the degree program #author.program
] else [
#context panic("no translation for language: ", text.lang)
]
]
// university
#pad(top: 0.5cm)[
#if text.lang == "de" [
an der
] else if text.lang == "en" [
at
] else [
#context panic("no translation for language: ", text.lang)
]
#linebreak()
#author.university
]
#set align(horizon + left)
// faculty
#pad(top: 0.5cm)[
#if text.lang == "de" [ #if text.lang == "de" [
Praxisphase des #author.semester Studienjahrs an der Fakultät für #author.faculty #table(
#linebreak() columns: 2,
im Studiengang #author.program column-gutter: 1cm,
align: 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,
)
] else if text.lang == "en" [ ] else if text.lang == "en" [
Practical phase of the #author.semester academic year at the Faculty of #author.faculty #table(
#linebreak() columns: 2,
in the degree program #author.program column-gutter: 1cm,
align: 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,
)
] else [ ] else [
#context panic("no translation for language: ", text.lang) #context panic("no translation for language: ", text.lang)
] ]
]
// university #align(
#pad(top: 0.5cm)[ bottom,
#if text.lang == "de" [ grid(
an der
] else if text.lang == "en" [
at
] else [
#context panic("no translation for language: ", text.lang)
]
#linebreak()
#author.university
]
#set align(horizon + left)
#if text.lang == "de" [
#table(
columns: 2,
column-gutter: 1cm,
align: 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,
)
] else if text.lang == "en" [
#table(
columns: 2,
column-gutter: 1cm,
align: 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,
)
] else [
#context panic("no translation for language: ", text.lang)
]
#align(
bottom,
grid(
// set width of columns // set width of columns
// we need two, so make both half the page width // we need two, so make both half the page width
columns: (60%, 40%), columns: (60%, 40%),
@ -103,7 +104,8 @@
] ]
), ),
align(right, {line(length: 6cm)})), align(right, {line(length: 6cm)})),
) )
#counter(page).update(0) #counter(page).update(0)
] ]
)

View File

@ -111,7 +111,9 @@
header-ascent: style.header.content-padding, header-ascent: style.header.content-padding,
footer-descent: style.header.content-padding, footer-descent: style.header.content-padding,
margin: ( margin: (
top: style.page.margin.top + style.header.logo-height + style.header.underline-top-padding + style.header.content-padding, top: style.page.margin.top + style.header.logo-height + style
.header
.underline-top-padding + style.header.content-padding,
bottom: style.page.margin.bottom + style.footer.content-padding, bottom: style.page.margin.bottom + style.footer.content-padding,
left: style.page.margin.left, left: style.page.margin.left,
right: style.page.margin.right, right: style.page.margin.right,
@ -120,9 +122,15 @@
let current-page = here().page() let current-page = here().page()
if current-page == 1 { if current-page == 1 {
[] []
} else if query(<end-of-prelude>).first().location().page() > current-page { } else if query(<end-of-prelude>)
.first()
.location()
.page() > current-page {
numbering("I", nums.pos().first()) numbering("I", nums.pos().first())
} else if query(<end-of-content>).first().location().page() >= current-page { } else if query(<end-of-content>)
.first()
.location()
.page() >= current-page {
numbering("1", nums.pos().first()) numbering("1", nums.pos().first())
} else { } else {
numbering("a", nums.pos().first()) numbering("a", nums.pos().first())
@ -159,7 +167,10 @@
// right align logo of DHBW // right align logo of DHBW
align(right, image("res/DHBW.svg", height: style.header.logo-height))) align(right, image("res/DHBW.svg", height: style.header.logo-height)))
} else if query(<end-of-prelude>).first().location().page() <= here().page() { } else if query(<end-of-prelude>)
.first()
.location()
.page() <= here().page() {
let headers-before = query( let headers-before = query(
selector(heading.where(numbering: "1.", level: 1)).before(here()), selector(heading.where(numbering: "1.", level: 1)).before(here()),
) )