sub-document rework
This commit is contained in:
12
docs.typ
12
docs.typ
@@ -2,9 +2,16 @@
|
||||
|
||||
#import "/static/index.typ": stylesheets
|
||||
|
||||
#let chapter-title = state("chapter-title", context document.title)
|
||||
|
||||
#let docs-page(path, header: auto, footer: auto) = main => document(path, html.html(
|
||||
lang: "en_US",
|
||||
{
|
||||
context chapter-title.update(old => context {
|
||||
let head = query(heading.where(level: 1).after(here())).first(default: none)
|
||||
return head.body
|
||||
})
|
||||
|
||||
html.head({
|
||||
html.meta(charset: "utf-8")
|
||||
html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
|
||||
@@ -18,10 +25,9 @@
|
||||
context {
|
||||
let doc = query(document).first()
|
||||
link(doc.location(), doc.title)
|
||||
title(chapter-title.get())
|
||||
}
|
||||
|
||||
title()
|
||||
|
||||
context {
|
||||
let doc = query(selector(document).before(here())).last()
|
||||
outline(title: none, target: selector(heading).within(doc.location()))
|
||||
@@ -47,8 +53,6 @@
|
||||
} else {
|
||||
header
|
||||
})
|
||||
|
||||
divider()
|
||||
}
|
||||
html.main(main)
|
||||
if (footer != none) {
|
||||
|
||||
Reference in New Issue
Block a user