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,16 +202,23 @@ 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
.map(x => x.location())
.sorted(key: x => x.page())
.fold(
(values: (), pages: ()), (values: (), pages: ()),
((values, pages), x) => if pages.contains(x.page()) { ((values, pages), x) => if pages.contains(
x.page(),
) {
(values: values, pages: pages) (values: values, pages: pages)
} else { } else {
values.push(x) values.push(x)
pages.push(x.page()) pages.push(x.page())
(values: values, pages: pages) (values: values, pages: pages)
}, },
).values.map(x => { )
.values
.map(x => {
let page-numbering = x.page-numbering() let page-numbering = x.page-numbering()
if page-numbering == none { if page-numbering == none {
page-numbering = "1" page-numbering = "1"
@ -218,7 +227,8 @@ SOFTWARE.*/
page-numbering, page-numbering,
..counter(page).at(x), ..counter(page).at(x),
)] )]
}).join(", ") })
.join(", ")
} }
}, },
) )

View File

@ -6,7 +6,8 @@
// 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)
@ -24,4 +25,5 @@
heading("Abstract") heading("Abstract")
config.thesis.abstract config.thesis.abstract
} }
)

View File

@ -6,7 +6,8 @@
// Edited: 28.06.2024 // Edited: 28.06.2024
// License: MIT // License: MIT
#let show-appendix(config: dictionary) = context { #let show-appendix(config: dictionary) = (
context {
counter(heading).update(0) counter(heading).update(0)
let title = if text.lang == "en" { let title = if text.lang == "en" {
@ -39,4 +40,5 @@
config.thesis.appendices config.thesis.appendices
} }
} }
)

View File

@ -6,7 +6,8 @@
// 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)
@ -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,7 +6,8 @@
// 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)
@ -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,7 +10,8 @@
// 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()
@ -23,9 +24,11 @@
target: figure.where(kind: kind), target: figure.where(kind: kind),
) )
} }
} }
)
#let render_figures_outline() = context { #let render_figures_outline() = (
context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Abbildungsverzeichnis" "Abbildungsverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
@ -33,9 +36,11 @@
} }
render_filtered_outline(title: title, kind: image) render_filtered_outline(title: title, kind: image)
} }
)
#let render_table_outline() = context { #let render_table_outline() = (
context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Tabellenverzeichnis" "Tabellenverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
@ -43,9 +48,11 @@
} }
render_filtered_outline(title: title, kind: table) render_filtered_outline(title: title, kind: table)
} }
)
#let render_raw_outline() = context { #let render_raw_outline() = (
context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Quelltextverzeichnis" "Quelltextverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
@ -53,9 +60,11 @@
} }
render_filtered_outline(title: title, kind: raw) render_filtered_outline(title: title, kind: raw)
} }
)
#let render_heading_outline() = context { #let render_heading_outline() = (
context {
let title = if (text.lang == "de") { let title = if (text.lang == "de") {
"Inhaltsverzeichnis" "Inhaltsverzeichnis"
} else if text.lang == "en" { } else if text.lang == "en" {
@ -68,9 +77,11 @@
title: title, title: title,
indent: auto, indent: auto,
) )
} }
)
#let render_appendix_outline() = context { #let render_appendix_outline() = (
context {
let supplement = if text.lang == "en" { let supplement = if text.lang == "en" {
[Appendix] [Appendix]
} else { } else {
@ -91,7 +102,8 @@
indent: auto, indent: auto,
) )
} }
} }
)
#let new_outline() = { #let new_outline() = {
pagebreak(weak: true) pagebreak(weak: true)

View File

@ -6,7 +6,8 @@
// 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)
@ -53,4 +54,5 @@
v(1em) v(1em)
h(1em) h(1em)
[#author.name, #datetime.today().display()] [#author.name, #datetime.today().display()]
} }
)

View File

@ -6,7 +6,8 @@
// 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
@ -106,4 +107,5 @@
) )
#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()),
) )