changed: formatted source files
This commit is contained in:
parent
4fd088ce3f
commit
d648d5121c
|
@ -30,7 +30,10 @@ SOFTWARE.*/
|
|||
#let __query_labels_with_key(loc, key, before: false) = {
|
||||
if before {
|
||||
query(
|
||||
selector(label(__glossary_label_prefix + key)).before(loc, inclusive: false),
|
||||
selector(label(__glossary_label_prefix + key)).before(
|
||||
loc,
|
||||
inclusive: false,
|
||||
),
|
||||
loc,
|
||||
)
|
||||
} else {
|
||||
|
@ -40,7 +43,7 @@ SOFTWARE.*/
|
|||
|
||||
// key not found error
|
||||
#let __not-found-panic-error-msg(key) = {
|
||||
__glossarium_error_prefix+"key '"+key+"' not found"
|
||||
__glossarium_error_prefix + "key '" + key + "' not found"
|
||||
}
|
||||
|
||||
// Reference a term
|
||||
|
@ -56,13 +59,18 @@ SOFTWARE.*/
|
|||
let entlong = entry.at("long", default: "")
|
||||
let textLink = if display != none {
|
||||
[#display]
|
||||
} else if (is_first or long == true) and entlong != [] and entlong != "" and long != false {
|
||||
} else if (
|
||||
is_first or long == true
|
||||
) and entlong != [] and entlong != "" and long != false {
|
||||
[#entlong (#entry.short#suffix)]
|
||||
} else {
|
||||
[#entry.short#suffix]
|
||||
}
|
||||
|
||||
[#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)]
|
||||
[#link(
|
||||
label(entry.key),
|
||||
textLink,
|
||||
)#label(__glossary_label_prefix + entry.key)]
|
||||
} else {
|
||||
panic(__not-found-panic-error-msg(key))
|
||||
}
|
||||
|
@ -80,10 +88,10 @@ SOFTWARE.*/
|
|||
let gloss = __query_labels_with_key(here(), key, before: true)
|
||||
|
||||
let is_first = gloss == ()
|
||||
let entlongplural = entry.at("longplural", default: "");
|
||||
let entlongplural = entry.at("longplural", default: "")
|
||||
let entlong = if entlongplural == [] or entlongplural == "" {
|
||||
// if the entry long plural is not provided, then fallback to adding 's' suffix
|
||||
let entlong = entry.at("long", default: "");
|
||||
let entlong = entry.at("long", default: "")
|
||||
if entlong != [] and entlong != "" {
|
||||
[#entlong#suffix]
|
||||
} else {
|
||||
|
@ -93,20 +101,25 @@ SOFTWARE.*/
|
|||
[#entlongplural]
|
||||
}
|
||||
|
||||
let entplural = entry.at("plural", default: "");
|
||||
let entplural = entry.at("plural", default: "")
|
||||
let short = if entplural == [] or entplural == "" {
|
||||
[#entry.short#suffix]
|
||||
} else {
|
||||
[#entplural]
|
||||
}
|
||||
|
||||
let textLink = if (is_first or long == true) and entlong != [] and entlong != "" and long != false {
|
||||
let textLink = if (
|
||||
is_first or long == true
|
||||
) and entlong != [] and entlong != "" and long != false {
|
||||
[#entlong (#short)]
|
||||
} else {
|
||||
[#short]
|
||||
}
|
||||
|
||||
[#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)]
|
||||
[#link(
|
||||
label(entry.key),
|
||||
textLink,
|
||||
)#label(__glossary_label_prefix + entry.key)]
|
||||
} else {
|
||||
panic(__not-found-panic-error-msg(key))
|
||||
}
|
||||
|
@ -197,15 +210,17 @@ SOFTWARE.*/
|
|||
(values: values, pages: pages)
|
||||
},
|
||||
).values.map(x => {
|
||||
let page-numbering = x.page-numbering();
|
||||
let page-numbering = x.page-numbering()
|
||||
if page-numbering == none {
|
||||
page-numbering = "1"
|
||||
}
|
||||
link(x)[#numbering(page-numbering, ..counter(page).at(x))]
|
||||
}
|
||||
).join(", ")
|
||||
}
|
||||
link(x)[#numbering(
|
||||
page-numbering,
|
||||
..counter(page).at(x),
|
||||
)]
|
||||
}).join(", ")
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -215,6 +230,8 @@ SOFTWARE.*/
|
|||
]
|
||||
}
|
||||
}
|
||||
if enable-group-pagebreak { pagebreak(weak: true) }
|
||||
if enable-group-pagebreak {
|
||||
pagebreak(weak: true)
|
||||
}
|
||||
}
|
||||
};
|
|
@ -17,34 +17,40 @@
|
|||
for (k, v) in entries.pairs() {
|
||||
assert(
|
||||
type(v) == dictionary,
|
||||
message: "The glossary entry `" + k + "` is not a dictionary")
|
||||
message: "The glossary entry `" + k + "` is not a dictionary",
|
||||
)
|
||||
|
||||
for key in v.keys() {
|
||||
assert(
|
||||
key in ("short", "long", "desc", "group"),
|
||||
message: "Found unexpected key `" + key + "` in glossary entry `" + k)
|
||||
message: "Found unexpected key `" + key + "` in glossary entry `" + k,
|
||||
)
|
||||
}
|
||||
|
||||
assert(
|
||||
type(v.short) == str,
|
||||
message: "The short form of glossary entry `" + k + "` is not a string")
|
||||
message: "The short form of glossary entry `" + k + "` is not a string",
|
||||
)
|
||||
|
||||
if "long" in v {
|
||||
assert(
|
||||
type(v.long) == str,
|
||||
message: "The long form of glossary entry `" + k + "` is not a string")
|
||||
message: "The long form of glossary entry `" + k + "` is not a string",
|
||||
)
|
||||
}
|
||||
|
||||
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 group = if "long" in v {
|
||||
if (context text.lang) == "de" {
|
||||
|
@ -69,6 +75,6 @@
|
|||
short: eval(entry.short, mode: "markup"),
|
||||
long: eval(entry.at("long", default: ""), mode: "markup"),
|
||||
desc: eval(entry.at("desc", default: ""), mode: "markup"),
|
||||
group: entry.at("group", default: "")
|
||||
group: entry.at("group", default: ""),
|
||||
))
|
||||
}
|
35
src/lib.typ
35
src/lib.typ
|
@ -7,20 +7,20 @@
|
|||
// Edited: 27.06.2024
|
||||
// License: MIT
|
||||
|
||||
#import "conf.typ": validate-config
|
||||
#import "branding.typ": *
|
||||
#import "style.typ": global_styled_doc, content_styled, end_styled
|
||||
#import "glossary.typ": glossary
|
||||
#import "pages/titlepage.typ": new_title_page
|
||||
#import "pages/declaration-of-authorship.typ": new_declaration_of_authorship
|
||||
#import "pages/confidentiality-statement.typ": new_confidentiality_statement_page
|
||||
#import "pages/prerelease-note.typ": new_prerelease_note
|
||||
#import "pages/outline.typ": new_outline
|
||||
#import "pages/abstract.typ": new_abstract
|
||||
#import "pages/preface.typ": new-preface
|
||||
#import "pages/appendix.typ": show-appendix
|
||||
#import "conf.typ": validate-config
|
||||
#import "branding.typ": *
|
||||
#import "style.typ": global_styled_doc, content_styled, end_styled
|
||||
#import "glossary.typ": glossary
|
||||
#import "pages/titlepage.typ": new_title_page
|
||||
#import "pages/declaration-of-authorship.typ": new_declaration_of_authorship
|
||||
#import "pages/confidentiality-statement.typ": new_confidentiality_statement_page
|
||||
#import "pages/prerelease-note.typ": new_prerelease_note
|
||||
#import "pages/outline.typ": new_outline
|
||||
#import "pages/abstract.typ": new_abstract
|
||||
#import "pages/preface.typ": new-preface
|
||||
#import "pages/appendix.typ": show-appendix
|
||||
|
||||
#let group-break()= {
|
||||
#let group-break() = {
|
||||
[#pagebreak()]
|
||||
}
|
||||
|
||||
|
@ -36,12 +36,14 @@
|
|||
#set document(
|
||||
author: config.author.name,
|
||||
keywords: config.thesis.keywords,
|
||||
title: config.thesis.title)
|
||||
title: config.thesis.title,
|
||||
)
|
||||
|
||||
// configure text locale
|
||||
#set text(
|
||||
lang: config.lang,
|
||||
region: config.region)
|
||||
region: config.region,
|
||||
)
|
||||
|
||||
// preppend title page
|
||||
#new_title_page(config)
|
||||
|
@ -68,7 +70,8 @@
|
|||
print-glossary(
|
||||
disable-back-references: true,
|
||||
enable-group-pagebreak: true,
|
||||
glossary(config.thesis.glossary))
|
||||
glossary(config.thesis.glossary),
|
||||
)
|
||||
|
||||
pagebreak(weak: true)
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
pagebreak(weak: true)
|
||||
outline(
|
||||
title: title,
|
||||
target: figure.where(kind: kind))
|
||||
target: figure.where(kind: kind),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +66,8 @@
|
|||
outline(
|
||||
target: heading.where(supplement: [chapter]),
|
||||
title: title,
|
||||
indent: auto)
|
||||
indent: auto,
|
||||
)
|
||||
}
|
||||
|
||||
#let render_appendix_outline() = context {
|
||||
|
@ -86,16 +88,15 @@
|
|||
outline(
|
||||
target: heading.where(supplement: supplement),
|
||||
title: title,
|
||||
indent: auto)
|
||||
indent: auto,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#let new_outline() = {
|
||||
pagebreak(weak: true)
|
||||
|
||||
show outline.entry.where(
|
||||
level: 1,
|
||||
): it => {
|
||||
show outline.entry.where(level: 1): it => {
|
||||
v(1.5em, weak: true)
|
||||
strong(it)
|
||||
}
|
||||
|
|
|
@ -60,24 +60,14 @@
|
|||
column-gutter: 1cm,
|
||||
align: left,
|
||||
stroke: none,
|
||||
|
||||
[*Verfasser:*],
|
||||
author.name,
|
||||
|
||||
[*Bearbeitungszeitraum:*],
|
||||
thesis.timeframe,
|
||||
|
||||
[*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
|
||||
[*Ausbildungsbetrieb:*], author.company,
|
||||
[*Betrieblicher Betreuer:*], author.supervisor,
|
||||
[*Abgabedatum:*], thesis.submission-date,
|
||||
)
|
||||
] else if text.lang == "en" [
|
||||
#table(
|
||||
|
@ -85,30 +75,21 @@
|
|||
column-gutter: 1cm,
|
||||
align: left,
|
||||
stroke: none,
|
||||
|
||||
[*Author:*],
|
||||
author.name,
|
||||
|
||||
[*Editing period:*],
|
||||
thesis.timeframe,
|
||||
|
||||
[*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
|
||||
[*Training company:*], author.company,
|
||||
[*Company supervisor:*], author.supervisor,
|
||||
[*Submission date:*], thesis.submission-date,
|
||||
)
|
||||
] else [
|
||||
#context panic("no translation for language: ", text.lang)
|
||||
]
|
||||
|
||||
#align(bottom,
|
||||
#align(
|
||||
bottom,
|
||||
grid(
|
||||
// set width of columns
|
||||
// we need two, so make both half the page width
|
||||
|
@ -121,7 +102,8 @@
|
|||
#context panic("no translation for language: ", text.lang)
|
||||
]
|
||||
),
|
||||
align(right, {line(length: 6cm)})))
|
||||
align(right, {line(length: 6cm)})),
|
||||
)
|
||||
|
||||
#counter(page).update(0)
|
||||
]
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#rect(
|
||||
radius: 1em,
|
||||
inset: 1em,
|
||||
stroke: watermark-color)[
|
||||
stroke: watermark-color,
|
||||
)[
|
||||
#text(size: 4em, weight: "bold", fill: watermark-color, "DRAFT")
|
||||
#linebreak()
|
||||
#text(size: 1.25em, weight: "bold", fill: watermark-color)[
|
||||
|
@ -24,7 +25,11 @@
|
|||
#linebreak()
|
||||
document version.
|
||||
#linebreak()
|
||||
#text(size: 0.75em, "Further usage without the authors consent is not permitted.")]]]}
|
||||
#text(
|
||||
size: 0.75em,
|
||||
"Further usage without the authors consent is not permitted.",
|
||||
)]]]
|
||||
}
|
||||
|
||||
// global style of document
|
||||
#let global_styled_doc(config, body) = {
|
||||
|
@ -37,11 +42,13 @@
|
|||
hyphenate: true,
|
||||
dir: ltr,
|
||||
font: style.text.font,
|
||||
fill: ABB-BLACK)
|
||||
fill: ABB-BLACK,
|
||||
)
|
||||
|
||||
show heading: set text(
|
||||
font: style.heading.font,
|
||||
weight: "semibold")
|
||||
weight: "semibold",
|
||||
)
|
||||
|
||||
set heading(supplement: [chapter])
|
||||
|
||||
|
@ -55,7 +62,8 @@
|
|||
// set theme for code blocks
|
||||
set raw(
|
||||
tab-size: style.code.tab-size,
|
||||
theme: style.code.theme)
|
||||
theme: style.code.theme,
|
||||
)
|
||||
show raw: set text(font: style.code.font)
|
||||
|
||||
show figure: set block(breakable: true)
|
||||
|
@ -67,8 +75,20 @@
|
|||
stroke: (x, y) => (
|
||||
left: none,
|
||||
right: none,
|
||||
top: if y == 0 { 1.5pt } else if y < 2 { 1pt } else { 0pt },
|
||||
bottom: if y == 0 { 1pt } else { 1.5pt } ))
|
||||
top: if y == 0 {
|
||||
1.5pt
|
||||
} else if y < 2 {
|
||||
1pt
|
||||
} else {
|
||||
0pt
|
||||
},
|
||||
bottom: if y == 0 {
|
||||
1pt
|
||||
} else {
|
||||
1.5pt
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
// make table header bold
|
||||
show table.cell.where(y: 0): set text(weight: "bold")
|
||||
|
@ -77,7 +97,8 @@
|
|||
set par(
|
||||
justify: true,
|
||||
first-line-indent: 1em,
|
||||
leading: 1em)
|
||||
leading: 1em,
|
||||
)
|
||||
|
||||
// give links a color
|
||||
show link: set text(fill: style.link.color)
|
||||
|
@ -93,10 +114,11 @@
|
|||
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,
|
||||
left: style.page.margin.left,
|
||||
right: style.page.margin.right),
|
||||
right: style.page.margin.right,
|
||||
),
|
||||
numbering: (..nums) => {
|
||||
let current-page = here().page()
|
||||
if current-page == 1{
|
||||
if current-page == 1 {
|
||||
[]
|
||||
} else if query(<end-of-prelude>).first().location().page() > current-page {
|
||||
numbering("I", nums.pos().first())
|
||||
|
@ -115,7 +137,11 @@
|
|||
} else if query(<end-of-prelude>).first().location().page() > page-number {
|
||||
numbering("I", page-counter)
|
||||
} else if query(<end-of-content>).first().location().page() >= page-number {
|
||||
numbering("1 / 1", page-counter, counter(page).at(<end-of-content>).last())
|
||||
numbering(
|
||||
"1 / 1",
|
||||
page-counter,
|
||||
counter(page).at(<end-of-content>).last(),
|
||||
)
|
||||
} else {
|
||||
numbering("a", page-counter)
|
||||
}
|
||||
|
@ -134,14 +160,18 @@
|
|||
align(right, image("res/DHBW.svg", height: style.header.logo-height)))
|
||||
|
||||
} else if query(<end-of-prelude>).first().location().page() <= here().page() {
|
||||
let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here()))
|
||||
let headers-before = query(
|
||||
selector(heading.where(numbering: "1.", level: 1)).before(here()),
|
||||
)
|
||||
|
||||
let header-title = thesis.title
|
||||
|
||||
if headers-before.len() > 0 {
|
||||
header-title = headers-before.last().body
|
||||
} else {
|
||||
let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here()))
|
||||
let headers-after = query(
|
||||
selector(heading.where(numbering: "1.", level: 1)).after(here()),
|
||||
)
|
||||
|
||||
if headers-after.len() > 0 {
|
||||
header-title = headers-after.first().body
|
||||
|
@ -152,7 +182,8 @@
|
|||
columns: (1fr, auto),
|
||||
align: (horizon, bottom),
|
||||
context [ _ #header-title _ ],
|
||||
image("res/DHBW.svg", height: style.header.logo-height))
|
||||
image("res/DHBW.svg", height: style.header.logo-height),
|
||||
)
|
||||
|
||||
v(style.header.underline-top-padding - 1em)
|
||||
line(length: 100%)
|
||||
|
@ -161,12 +192,13 @@
|
|||
columns: (1fr, auto),
|
||||
align: (horizon, bottom),
|
||||
context [ _ #config.thesis.title _ ],
|
||||
image("res/DHBW.svg", height: style.header.logo-height)
|
||||
image("res/DHBW.svg", height: style.header.logo-height),
|
||||
)
|
||||
v(style.header.underline-top-padding - 1em)
|
||||
line(length: 100%)
|
||||
}
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
body
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue