2024-07-05 11:04:27 +00:00
|
|
|
// .--------------------------------------------------------------------------.
|
|
|
|
// | Document Outline |
|
|
|
|
// '--------------------------------------------------------------------------'
|
|
|
|
|
|
|
|
// Author: Sven Vogel
|
|
|
|
// Edited: 28.06.2024
|
|
|
|
// License: MIT
|
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 {
|
2024-07-02 08:57:38 +00:00
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
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(
|
2024-07-08 11:49:04 +00:00
|
|
|
title: title,
|
2024-06-28 13:20:58 +00:00
|
|
|
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(
|
2024-07-08 11:49:04 +00:00
|
|
|
target: heading,
|
|
|
|
title: title,
|
2024-06-28 13:20:58 +00:00
|
|
|
indent: auto)
|
|
|
|
}
|
|
|
|
|
2024-07-01 11:50:54 +00:00
|
|
|
#let render_appendix_outline() = context {
|
2024-07-01 12:46:32 +00:00
|
|
|
let supplement = if text.lang == "en" {
|
|
|
|
[Appendix]
|
|
|
|
} else {
|
|
|
|
[Anhang]
|
|
|
|
}
|
|
|
|
|
|
|
|
if query(heading.where(supplement: supplement)).len() > 0 {
|
2024-07-01 11:50:54 +00:00
|
|
|
let title = if (text.lang == "de") {
|
2024-07-01 12:46:32 +00:00
|
|
|
"Anhangsverzeichnis"
|
|
|
|
} else if text.lang == "en" {
|
|
|
|
"Table of Appendices"
|
|
|
|
}
|
2024-07-01 11:50:54 +00:00
|
|
|
|
|
|
|
pagebreak(weak: true)
|
|
|
|
outline(
|
2024-07-01 12:46:32 +00:00
|
|
|
target: heading.where(supplement: supplement),
|
2024-07-08 11:49:04 +00:00
|
|
|
title: title,
|
2024-07-01 11:50:54 +00:00
|
|
|
indent: auto)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
#let new_outline() = {
|
2024-07-02 08:57:38 +00:00
|
|
|
pagebreak(weak: true)
|
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
show outline.entry.where(
|
|
|
|
level: 1,
|
|
|
|
): it => {
|
2024-07-05 11:04:27 +00:00
|
|
|
v(1.5em, weak: true)
|
2024-06-28 13:20:58 +00:00
|
|
|
strong(it)
|
|
|
|
}
|
|
|
|
|
2024-07-08 11:49:04 +00:00
|
|
|
render_heading_outline()
|
|
|
|
|
2024-06-28 13:20:58 +00:00
|
|
|
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
|
|
|
}
|