fix: typst-0.13 (#121)
Create Release Commit / prepare (push) Has been skipped Details
Create Release / Check Template and Build example (push) Successful in 4m29s Details
Create Release / release (push) Successful in 2m19s Details

Reviewed-on: #121
Co-authored-by: servostar <sven.vogel123@web.de>
Co-committed-by: servostar <sven.vogel123@web.de>
This commit is contained in:
Sven Vogel 2025-03-06 16:07:55 +00:00 committed by Sven Vogel
parent b1255bdbab
commit ba9f81eccb
10 changed files with 177 additions and 106 deletions

View File

@ -104,7 +104,15 @@
} else if val == none or type(val) == type(update_val) { } else if val == none or type(val) == type(update_val) {
base.insert(key, update_val) base.insert(key, update_val)
} else { } 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 { } else {
base.insert(key, val) base.insert(key, val)

View File

@ -59,8 +59,13 @@ SOFTWARE.*/
let textLink = if display != none { let textLink = if display != none {
[#display] [#display]
} else if ( } 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)] [#entlong (#entry.short#suffix)]
} else { } else {
[#entry.short#suffix] [#entry.short#suffix]
@ -108,8 +113,13 @@ SOFTWARE.*/
} }
let textLink = if ( 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)] [#entlong (#short)]
} else { } else {
[#short] [#short]
@ -128,9 +138,11 @@ 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 if (
.element r.element != none
.kind == __glossarium_figure { 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 {
@ -197,6 +209,7 @@ SOFTWARE.*/
#let hasLong = long != "" and long != [] #let hasLong = long != "" and long != []
#let hasDesc = desc != "" and desc != [] #let hasDesc = desc != "" and desc != []
#set align(left)
#block( #block(
below: 1.5em, below: 1.5em,
width: 100%, width: 100%,
@ -229,16 +242,15 @@ SOFTWARE.*/
) )
.values .values
.map(x => { .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"
}
link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
} }
) link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
})
.join(", ") .join(", ")
} }
], ],

View File

@ -43,14 +43,18 @@
if "desc" in v { if "desc" in v {
assert( assert(
type(v.desc) == str, 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 { if "group" in v {
assert( assert(
type(v.group) == str, 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 { } else {
let acronym_group = if config.lang == "de" { let acronym_group = if config.lang == "de" {
@ -89,11 +93,13 @@
} }
} }
return processed_glossary.pairs().map(((key, entry)) => ( return processed_glossary
key: key, .pairs()
short: entry.short, .map(((key, entry)) => (
long: eval(entry.at("long", default: ""), mode: "markup"), key: key,
desc: eval(entry.at("desc", default: ""), mode: "markup"), short: entry.short,
group: entry.at("group", default: ""), 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, config,
context [ context [
// add bibliography if set // 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) pagebreak(weak: true)
counter(page).update(1) counter(page).update(1)
set bibliography( set bibliography(

View File

@ -50,13 +50,24 @@
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%),
row-gutter: 0.75em, row-gutter: 0.75em,
align(left, {line(length: 6cm)}), align(left, { line(length: 6cm) }),
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(
align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) 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) 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%),
row-gutter: 0.75em, row-gutter: 0.75em,
align(left, {line(length: 6cm)}), align(left, { line(length: 6cm) }),
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(
align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) 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

@ -18,9 +18,12 @@
show outline.entry: it => { show outline.entry: it => {
link(it.element.location())[ link(it.element.location())[
#v(12pt, weak: true) #v(12pt, weak: true)
#text(weight: "regular", it.body) #it.prefix()
#[:]
#h(0.5em)
#text(weight: "regular", it.body())
#box(width: 1fr, it.fill) #box(width: 1fr, it.fill)
#[ #it.page] #[ #it.page()]
] ]
} }

View File

@ -21,14 +21,27 @@
if config.style.header.logo-image == none { if config.style.header.logo-image == none {
// error // error
} else if config.style.header.logo-image.len() > 0 { } 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 { } 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 // right align logo of DHBW
if config.style.header.logo-image.len() > 0 { 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) #set align(center)
@ -108,20 +121,20 @@
.authors .authors
.slice(i * 3, i * 3 + cols) .slice(i * 3, i * 3 + cols)
.map(author => par([ .map(author => par([
#if author.at("name", default: none) != none { #if author.at("name", default: none) != none {
text(size: 1.25em, author.name) text(size: 1.25em, author.name)
linebreak() linebreak()
} }
#if author.at("company", default: none) != none { #if author.at("company", default: none) != none {
text(size: 1em, author.company) text(size: 1em, author.company)
linebreak() linebreak()
} }
#if author.at("contact", default: none) != none { #if author.at("contact", default: none) != none {
text(size: 1em, author.contact) text(size: 1em, author.contact)
linebreak() linebreak()
} }
#str(author.matriculation-number), #author.course #str(author.matriculation-number), #author.course
]))) ])))
} }
] ]
@ -135,18 +148,21 @@
align( align(
bottom, bottom,
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: (60%, 40%), columns: (60%, 40%),
align(left, if text.lang == "de" [ align(
Unterschrift des betrieblichen Betreuers left,
] else if text.lang == "en" [ if text.lang == "de" [
Signature of the company supervisor Unterschrift des betrieblichen Betreuers
] else [ ] else if text.lang == "en" [
#context panic("no translation for language: ", text.lang) 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) .map(make_row)
.flatten() .flatten()
.map(c => if c.has("text") and c.text == "" { .map(c => if c.has("text") and c.text == "" {
v(1em) v(1em)
} else { } else {
c c
}) })
) )
}, },
) )
@ -193,13 +193,15 @@
// change the display supplement according to the text langugae // change the display supplement according to the text langugae
// based on: https://github.com/typst/typst/issues/3273 // based on: https://github.com/typst/typst/issues/3273
show figure.where(kind: raw): set figure(supplement: context { show figure.where(kind: raw): set figure(
if text.lang == "de" { supplement: context {
"Quelltext" if text.lang == "de" {
} else { "Quelltext"
"Listing" } else {
} "Listing"
}) }
},
)
// APA style table // APA style table
set table( set table(
@ -245,9 +247,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.underline-top-padding + style top: style.page.margin.top
.header + style.header.underline-top-padding
.content-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,
@ -256,15 +258,13 @@
let current-page = here().page() let current-page = here().page()
if current-page == 1 { if current-page == 1 {
[] []
} else if query(<end-of-prelude>) } else if (
.first() query(<end-of-prelude>).first().location().page() > current-page
.location() ) {
.page() > current-page {
numbering("I", nums.pos().first()) numbering("I", nums.pos().first())
} else if query(<end-of-content>) } else if (
.first() query(<end-of-content>).first().location().page() >= current-page
.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())
@ -277,10 +277,14 @@
#if page-number == 1 { #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) set align(center)
numbering("I", page-counter) 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( numbering(
"1 / 1", "1 / 1",
page-counter, page-counter,
@ -296,13 +300,11 @@
if current-page == 1 { if current-page == 1 {
// logo moved to content // logo moved to content
} else if query(<end-of-content>) } else if (
.first() query(<end-of-content>).first().location().page() >= current-page
.location() and query(<end-of-prelude>).first().location().page()
.page() >= current-page and query(<end-of-prelude>) < current-page + 1
.first() ) {
.location()
.page() < current-page + 1 {
let heading = currentH() let heading = currentH()
heading.at(0) heading.at(0)

View File

@ -45,7 +45,7 @@
) )
)) ))
#import "@preview/wrap-it:0.1.0": wrap-content #import "@preview/wrap-it:0.1.1": wrap-content
= Lorem Ipsum = Lorem Ipsum