dhbw-abb-typst-template/src/pages/outline.typ

96 lines
2.1 KiB
Plaintext
Raw Normal View History

2024-06-28 13:20:58 +00:00
// render an outline of figures
// with a specific title and filter by a specifc kind of figure
// can optionally insert a pagebreak after the outline
// NOTE: will not render in case the listing is empty
#let render_filtered_outline(title: str, kind: selector) = context {
let elems = query(figure.where(kind: kind), here())
let count = elems.len()
// only show outline if there is something to list
if count > 0 {
pagebreak(weak: true)
outline(
title: heading(level: 3, title),
target: figure.where(kind: kind))
}
}
#let render_figures_outline() = context {
let title = if (text.lang == "de") {
"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(
title: heading(level: 3, title),
indent: auto)
}
2024-07-01 11:50:54 +00:00
#let render_appendix_outline() = context {
if query(heading.where(supplement: [appendix])).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: [appendix]),
title: heading(level: 3, title),
indent: auto)
}
}
2024-06-28 13:20:58 +00:00
#let new_outline() = {
show outline.entry.where(
level: 1,
): it => {
v(18pt, weak: true)
strong(it)
}
render_figures_outline()
render_table_outline()
render_raw_outline()
2024-07-01 11:50:54 +00:00
render_appendix_outline()
2024-06-28 13:20:58 +00:00
render_heading_outline()
}