good
This commit is contained in:
59
main.typ
59
main.typ
@@ -1,9 +1,11 @@
|
||||
#set heading(numbering: "1.1 -")
|
||||
#set document(title: [The EID Wireless Masterclass])
|
||||
|
||||
#asset("/mojangles-ascii.woff2", read("static/mojangles-ascii.woff2", encoding: none))
|
||||
#asset("/style.css", read("static/style.css", encoding: none))
|
||||
|
||||
#let html-title = state("html-title", context document.title)
|
||||
#let index() = query(document).first()
|
||||
#let chapter = state("chapter", context (doc: index(), top: none, loc: index().location()))
|
||||
|
||||
#let rawdoc(path, body) = document(path, html.html({
|
||||
html.head({
|
||||
@@ -11,49 +13,42 @@
|
||||
html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
|
||||
html.meta(name: "color-scheme", content: "dark light")
|
||||
html.link(rel: "stylesheet", href: "/style.css")
|
||||
html.title(context html-title.get())
|
||||
html.title(context document.title)
|
||||
})
|
||||
html.body({
|
||||
body
|
||||
})
|
||||
html.body({ body })
|
||||
}))
|
||||
|
||||
#show document: it => {
|
||||
html-title.update(old => context {
|
||||
set document(title: context {
|
||||
let top = query(selector(heading.where(level: 1, outlined: true)).within(it.location())).first(default: none)
|
||||
if top != none { return [#top.body - #document.title] } else { return old }
|
||||
chapter.update(old => (doc: it, top: top, loc: it.location()))
|
||||
if top != none {
|
||||
[#top.body - #it.title]
|
||||
} else {
|
||||
[#it.title]
|
||||
}
|
||||
})
|
||||
it
|
||||
}
|
||||
|
||||
#let doc(path, main) = rawdoc(path, {
|
||||
html.header()
|
||||
html.header(context {
|
||||
link(index().location(), title(index().title))
|
||||
let target = selector(heading).within(chapter.get().loc).or(heading.where(level: 1))
|
||||
outline(title: none, target: target)
|
||||
})
|
||||
html.main(id: "main", main)
|
||||
html.footer()
|
||||
})
|
||||
html.footer(context {
|
||||
let next = query(selector(heading.where(level: 1, outlined: true)).after(here())).first(default: none)
|
||||
|
||||
// #let doc(path, main) = rawdoc(path, ..args, html.html({
|
||||
// html.head({
|
||||
// html.meta(charset: "utf-8")
|
||||
// html.meta(name: "viewport", content: "width=device-width, initial-scale=1")
|
||||
// html.meta(name: "color-scheme", content: "dark light")
|
||||
// html.link(rel: "stylesheet", href: "/style.css")
|
||||
// html.title(context document.title)
|
||||
// })
|
||||
// html.body({
|
||||
// html.header(context {
|
||||
// let doc = query(document).first()
|
||||
// par(link(doc.location(), doc.title))
|
||||
//
|
||||
// let doc = query(selector(document).before(here())).last()
|
||||
// let ch = query(selector(heading.where(level: 1, outlined: true)).within(doc.location())).first()
|
||||
// outline(title: none, target: selector(heading).within(doc.location()))
|
||||
//
|
||||
// let next = query(selector(document).after(doc.location(), inclusive: false)).first(default: none)
|
||||
// let prev = query(selector(document).before(doc.location(), inclusive: false)).last(default: none)
|
||||
// })
|
||||
// html.main(id: "main", { main })
|
||||
// html.footer({})
|
||||
// })
|
||||
// }))
|
||||
if next != none {
|
||||
show outline.entry: it => [Next: #it]
|
||||
outline(title: none, target: next.location())
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
#{
|
||||
rawdoc("/index.html", include "content/00-index.typ")
|
||||
|
||||
Reference in New Issue
Block a user