101 lines
2.9 KiB
Typst
101 lines
2.9 KiB
Typst
#show: it => context if target() == "paged" {
|
|
set page("us-letter", margin: 0.5in)
|
|
it
|
|
} else {
|
|
it
|
|
}
|
|
|
|
#set heading(numbering: "1.1 -")
|
|
#set document(title: [The EID Wireless Masterclass])
|
|
|
|
#context if target() == "bundle" {
|
|
asset("mojangles-ascii.woff2", read("static/mojangles-ascii.woff2", encoding: none))
|
|
asset("style.css", read("static/style.css", encoding: none))
|
|
}
|
|
|
|
#let index() = query(document).first()
|
|
#let chapter = state("chapter", context (doc: index(), top: none, loc: index().location()))
|
|
|
|
#let rawdoc(path, body) = context if target() == "bundle" {
|
|
document(path, 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({
|
|
body
|
|
})
|
|
}))
|
|
} else {
|
|
body
|
|
}
|
|
|
|
#show document: it => {
|
|
set document(title: context {
|
|
let top = query(selector(heading.where(level: 1, outlined: true)).within(it.location())).first(default: none)
|
|
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) = context if target() == "bundle" {
|
|
rawdoc(path, {
|
|
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)
|
|
divider()
|
|
})
|
|
html.main(id: "main", main)
|
|
html.footer(context {
|
|
let next = query(selector(heading.where(level: 1, outlined: true)).after(here())).first(default: none)
|
|
|
|
if next != none {
|
|
divider()
|
|
show outline.entry: it => [Next: #it]
|
|
outline(title: none, target: next.location())
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
main
|
|
}
|
|
|
|
#{
|
|
show: it => context if target() == "html" {
|
|
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.title(context document.title)
|
|
html.style(read("static/style.css"))
|
|
})
|
|
html.body({
|
|
html.main(id: "main", { it })
|
|
})
|
|
})
|
|
} else {
|
|
it
|
|
}
|
|
|
|
rawdoc("index.html", include "content/index.typ")
|
|
doc("core.html", include "content/core.typ")
|
|
doc("data-protocols.html", include "content/data-protocols.typ")
|
|
doc("interference-causes.html", include "content/interference-causes.typ")
|
|
doc("interference-fixes.html", include "content/interference-fixes.typ")
|
|
doc("design.html", include "content/design.typ")
|
|
doc("channels.html", include "content/channels.typ")
|
|
doc("bulk.html", include "content/bulk.typ")
|
|
|
|
doc("network-protocols.html", include "content/network.typ")
|
|
}
|