mirror of
https://gitlab.cvh-server.de/skrause/flashcards.git
synced 2025-12-12 07:51:38 +01:00
use hydra for heading, cleanup docs template
This commit is contained in:
@@ -14,5 +14,8 @@
|
|||||||
|
|
||||||
#pagebreak()
|
#pagebreak()
|
||||||
|
|
||||||
|
#lorem(100)
|
||||||
|
#pagebreak()
|
||||||
|
|
||||||
= Fazit
|
= Fazit
|
||||||
#lorem(100)
|
#lorem(100)
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
// The project function defines how your document looks.
|
#import "@preview/hydra:0.6.0": hydra
|
||||||
// It takes your content and some metadata and formats it.
|
|
||||||
// Go ahead and customize it to your liking!
|
|
||||||
#let project(title: "", subtitle: "", authors: (), logo: none, body) = {
|
#let project(title: "", subtitle: "", authors: (), logo: none, body) = {
|
||||||
|
|
||||||
// Set the document's basic properties.
|
// Set the document's basic properties.
|
||||||
@@ -42,55 +41,20 @@
|
|||||||
|
|
||||||
set page(numbering: "I", number-align: center)
|
set page(numbering: "I", number-align: center)
|
||||||
|
|
||||||
|
|
||||||
/*let ht-first = state("page-first-section", [])
|
|
||||||
let ht-last = state("page-last-section", [])
|
|
||||||
|
|
||||||
set page(
|
|
||||||
header: {
|
|
||||||
locate(loc => {
|
|
||||||
// find first heading of level 1 on current page
|
|
||||||
let first-heading = query(
|
|
||||||
heading.where(level: 1), loc)
|
|
||||||
.find(h => h.location().page() == loc.page())
|
|
||||||
// find last heading of level 1 on current page
|
|
||||||
let last-heading = query(
|
|
||||||
heading.where(level: 1), loc)
|
|
||||||
.rev()
|
|
||||||
.find(h => h.location().page() == loc.page())
|
|
||||||
// test if the find function returned none (i.e. no headings on this page)
|
|
||||||
{
|
|
||||||
if not first-heading == none {
|
|
||||||
ht-first.update([
|
|
||||||
// change style here if update needed section per section
|
|
||||||
#first-heading.body
|
|
||||||
])
|
|
||||||
ht-last.update([
|
|
||||||
// change style here if update needed section per section
|
|
||||||
#last-heading.body
|
|
||||||
])
|
|
||||||
|
|
||||||
// if one or more headings on the page, use first heading
|
|
||||||
// change style here if update needed page per page
|
|
||||||
ht-first.display()
|
|
||||||
} else {
|
|
||||||
// no headings on the page, use last heading from variable
|
|
||||||
// change style here if update needed page per page
|
|
||||||
ht-last.display()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
v(-0.8em)
|
|
||||||
line(length: 100%, stroke: 0.5pt)
|
|
||||||
}
|
|
||||||
)*/
|
|
||||||
|
|
||||||
// Table of contents
|
// Table of contents
|
||||||
outline(depth: 3)
|
outline(depth: 3)
|
||||||
pagebreak()
|
pagebreak()
|
||||||
|
|
||||||
|
let show-header(ctx, candidates) = {
|
||||||
|
candidates.body
|
||||||
|
v(-0.8em)
|
||||||
|
line(length: 100%, stroke: 0.5pt)
|
||||||
|
}
|
||||||
|
|
||||||
|
set page(header: context {
|
||||||
|
hydra(1, skip-starting: false, display: show-header)
|
||||||
|
})
|
||||||
|
|
||||||
set page(numbering: "1")
|
set page(numbering: "1")
|
||||||
counter(page).update(1)
|
counter(page).update(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user