style: format using typstyle 0.13.0
Build'n check / run-ci-linux (push) Has been skipped Details
Build'n check / run-ci-linux (pull_request) Successful in 5m31s Details

This commit is contained in:
Sven Vogel 2025-03-06 16:14:21 +01:00
parent f3ef05b31b
commit ea04ed8cd1
8 changed files with 170 additions and 103 deletions

View File

@ -104,7 +104,15 @@
} else if val == none or type(val) == type(update_val) {
base.insert(key, update_val)
} else {
panic("missmatched dictionary entry `" + key + "` type: expected `" + type(val) + "` got `" + type(update_val) + "`")
panic(
"missmatched dictionary entry `"
+ key
+ "` type: expected `"
+ type(val)
+ "` got `"
+ type(update_val)
+ "`",
)
}
} else {
base.insert(key, val)

View File

@ -59,8 +59,13 @@ SOFTWARE.*/
let textLink = if display != none {
[#display]
} else if (
is_first or long == true
) and entlong != [] and entlong != "" and long != false {
(
is_first or long == true
)
and entlong != []
and entlong != ""
and long != false
) {
[#entlong (#entry.short#suffix)]
} else {
[#entry.short#suffix]
@ -108,8 +113,13 @@ SOFTWARE.*/
}
let textLink = if (
is_first or long == true
) and entlong != [] and entlong != "" and long != false {
(
is_first or long == true
)
and entlong != []
and entlong != ""
and long != false
) {
[#entlong (#short)]
} else {
[#short]
@ -128,9 +138,11 @@ SOFTWARE.*/
// show rule to make the references for glossarium
#let make-glossary(body) = {
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
gls(str(r.target), suffix: r.citation.supplement)
} else {
@ -230,16 +242,15 @@ SOFTWARE.*/
)
.values
.map(x => {
let page-numbering = x.page-numbering()
if page-numbering == none {
page-numbering = "1"
}
link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
let page-numbering = x.page-numbering()
if page-numbering == none {
page-numbering = "1"
}
)
link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
})
.join(", ")
}
],

View File

@ -43,14 +43,18 @@
if "desc" in v {
assert(
type(v.desc) == str,
message: "The description of glossary entry `" + k + "` is not a string",
message: "The description of glossary entry `"
+ k
+ "` is not a string",
)
}
if "group" in v {
assert(
type(v.group) == str,
message: "The optional group of glossary entry `" + k + "` is not a string",
message: "The optional group of glossary entry `"
+ k
+ "` is not a string",
)
} else {
let acronym_group = if config.lang == "de" {
@ -89,11 +93,13 @@
}
}
return processed_glossary.pairs().map(((key, entry)) => (
key: key,
short: entry.short,
long: eval(entry.at("long", default: ""), mode: "markup"),
desc: eval(entry.at("desc", default: ""), mode: "markup"),
group: entry.at("group", default: ""),
))
return processed_glossary
.pairs()
.map(((key, entry)) => (
key: key,
short: entry.short,
long: eval(entry.at("long", default: ""), mode: "markup"),
desc: eval(entry.at("desc", default: ""), mode: "markup"),
group: entry.at("group", default: ""),
))
}

View File

@ -126,7 +126,9 @@
config,
context [
// add bibliography if set
#if "bibliography" in config.thesis and config.thesis.bibliography != none {
#if (
"bibliography" in config.thesis and config.thesis.bibliography != none
) {
pagebreak(weak: true)
counter(page).update(1)
set bibliography(

View File

@ -50,13 +50,24 @@
set align(horizon)
grid(
// set width of columns
// we need two, so make both half the page width
columns: (50%, 50%),
row-gutter: 0.75em,
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" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) }))
// set width of columns
// we need two, so make both half the page width
columns: (50%, 50%),
row-gutter: 0.75em,
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" [ Unterschrift ] else if text.lang == "en" [
Signature
] else { panic("no translation for language: ", text.lang) },
)
)
}
)

View File

@ -52,13 +52,24 @@
set align(horizon)
grid(
// set width of columns
// we need two, so make both half the page width
columns: (50%, 50%),
row-gutter: 0.75em,
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" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) }))
// set width of columns
// we need two, so make both half the page width
columns: (50%, 50%),
row-gutter: 0.75em,
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" [ Unterschrift ] else if text.lang == "en" [
Signature
] else { panic("no translation for language: ", text.lang) },
)
)
}
)

View File

@ -21,14 +21,27 @@
if config.style.header.logo-image == none {
// error
} else if config.style.header.logo-image.len() > 0 {
align(left, image(config.style.header.logo-image, height: config.style.header.logo-height))
align(
left,
image(
config.style.header.logo-image,
height: config.style.header.logo-height,
),
)
} else {
align(left, image("../res/DHBW.svg", height: config.style.header.logo-height))
align(
left,
image("../res/DHBW.svg", height: config.style.header.logo-height),
)
},
// right align logo of DHBW
if config.style.header.logo-image.len() > 0 {
align(right, image("../res/DHBW.svg", height: config.style.header.logo-height))
})
align(
right,
image("../res/DHBW.svg", height: config.style.header.logo-height),
)
}
)
#set align(center)
@ -108,20 +121,20 @@
.authors
.slice(i * 3, i * 3 + cols)
.map(author => par([
#if author.at("name", default: none) != none {
text(size: 1.25em, author.name)
linebreak()
}
#if author.at("company", default: none) != none {
text(size: 1em, author.company)
linebreak()
}
#if author.at("contact", default: none) != none {
text(size: 1em, author.contact)
linebreak()
}
#str(author.matriculation-number), #author.course
])))
#if author.at("name", default: none) != none {
text(size: 1.25em, author.name)
linebreak()
}
#if author.at("company", default: none) != none {
text(size: 1em, author.company)
linebreak()
}
#if author.at("contact", default: none) != none {
text(size: 1em, author.contact)
linebreak()
}
#str(author.matriculation-number), #author.course
])))
}
]
@ -135,18 +148,21 @@
align(
bottom,
grid(
// set width of columns
// we need two, so make both half the page width
columns: (60%, 40%),
align(left, if text.lang == "de" [
Unterschrift des betrieblichen Betreuers
] else if text.lang == "en" [
Signature of the company supervisor
] else [
#context panic("no translation for language: ", text.lang)
]
// set width of columns
// we need two, so make both half the page width
columns: (60%, 40%),
align(
left,
if text.lang == "de" [
Unterschrift des betrieblichen Betreuers
] else if text.lang == "en" [
Signature of the company supervisor
] else [
#context panic("no translation for language: ", text.lang)
],
),
align(right, { line(length: 6cm) })
),
align(right, {line(length: 6cm)})),
)
}

View File

@ -166,10 +166,10 @@
.map(make_row)
.flatten()
.map(c => if c.has("text") and c.text == "" {
v(1em)
} else {
c
})
v(1em)
} else {
c
})
)
},
)
@ -193,13 +193,15 @@
// change the display supplement according to the text langugae
// based on: https://github.com/typst/typst/issues/3273
show figure.where(kind: raw): set figure(supplement: context {
if text.lang == "de" {
"Quelltext"
} else {
"Listing"
}
})
show figure.where(kind: raw): set figure(
supplement: context {
if text.lang == "de" {
"Quelltext"
} else {
"Listing"
}
},
)
// APA style table
set table(
@ -245,9 +247,9 @@
header-ascent: style.header.content-padding,
footer-descent: style.header.content-padding,
margin: (
top: style.page.margin.top + style.header.underline-top-padding + style
.header
.content-padding,
top: style.page.margin.top
+ style.header.underline-top-padding
+ style.header.content-padding,
bottom: style.page.margin.bottom + style.footer.content-padding,
left: style.page.margin.left,
right: style.page.margin.right,
@ -256,15 +258,13 @@
let current-page = here().page()
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())
} 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())
} else {
numbering("a", nums.pos().first())
@ -277,10 +277,14 @@
#if page-number == 1 {
[]
} else if query(<end-of-prelude>).first().location().page() > page-number {
} else if (
query(<end-of-prelude>).first().location().page() > page-number
) {
set align(center)
numbering("I", page-counter)
} else if query(<end-of-content>).first().location().page() >= page-number {
} else if (
query(<end-of-content>).first().location().page() >= page-number
) {
numbering(
"1 / 1",
page-counter,
@ -296,13 +300,11 @@
if current-page == 1 {
// logo moved to content
} else if query(<end-of-content>)
.first()
.location()
.page() >= current-page and query(<end-of-prelude>)
.first()
.location()
.page() < current-page + 1 {
} else if (
query(<end-of-content>).first().location().page() >= current-page
and query(<end-of-prelude>).first().location().page()
< current-page + 1
) {
let heading = currentH()
heading.at(0)