docs: retab from tabs to 2 spaces

This commit is contained in:
multisn8 2024-01-11 13:55:51 +01:00
parent 77d1236720
commit d1001ad90d
Signed by: multisamplednight
GPG key ID: 6D525AA147CBDAE2
2 changed files with 74 additions and 74 deletions

View file

@ -7,69 +7,69 @@
// - `group` can be used in either of ^, but not standalone // - `group` can be used in either of ^, but not standalone
#let graphic(what) = box({ #let graphic(what) = box({
cetz.canvas({ cetz.canvas({
// any preamble-ish stuff can go here // any preamble-ish stuff can go here
set-style( set-style(
mark: (angle: 90deg), mark: (angle: 90deg),
stroke: (cap: "round", join: "round"), stroke: (cap: "round", join: "round"),
) )
what what
}) })
}) })
#let canvas(what) = { #let canvas(what) = {
align(center, graphic(what)) align(center, graphic(what))
} }
// smaller stuff // smaller stuff
#let arrow(length: 0.4cm, lift: 3pt, stroke: 1pt) = graphic({ #let arrow(length: 0.4cm, lift: 3pt, stroke: 1pt) = graphic({
line((0, lift), (rel: (length, 0)), mark: (end: ">", stroke: stroke)) line((0, lift), (rel: (length, 0)), mark: (end: ">", stroke: stroke))
// hack for the bounding box bottom // hack for the bounding box bottom
// so that `lift` even has any effect // so that `lift` even has any effect
line((0, 0), (0, 0), stroke: none) line((0, 0), (0, 0), stroke: none)
}) })
// larger stuff // larger stuff
#let sequence( #let sequence(
distance: 3cm, distance: 3cm,
arrow-spacing: 0.15cm, arrow-spacing: 0.15cm,
// cetz will support rounded rects in 0.2.0 // cetz will support rounded rects in 0.2.0
style: (frame: "rect", padding: 0.1cm), style: (frame: "rect", padding: 0.1cm),
..labels, ..labels,
) = group({ ) = group({
let labels = labels.pos() let labels = labels.pos()
// draw each label itself // draw each label itself
for (i, label) in labels.enumerate() { for (i, label) in labels.enumerate() {
if i != 0 { if i != 0 {
set-origin((distance, 0)) set-origin((distance, 0))
} }
content((0, 0), name: "label-" + str(i), label, ..style) content((0, 0), name: "label-" + str(i), label, ..style)
} }
// then draw an arrow from each to each // then draw an arrow from each to each
// since an arrow is between two, the last one can't be connected with the "next-to-last" one // since an arrow is between two, the last one can't be connected with the "next-to-last" one
// so we leave it out // so we leave it out
for i in range(labels.len() - 1) { for i in range(labels.len() - 1) {
line( line(
(rel: (arrow-spacing, 0), to: "label-" + str(i) + ".right"), (rel: (arrow-spacing, 0), to: "label-" + str(i) + ".right"),
(rel: (-arrow-spacing, 0), to: "label-" + str(i + 1) + ".left"), (rel: (-arrow-spacing, 0), to: "label-" + str(i + 1) + ".left"),
mark: (end: ">"), mark: (end: ">"),
) )
} }
}) })
#let stages-overview = canvas({ #let stages-overview = canvas({
sequence( sequence(
[Source], [Source],
[Graph IR], [Graph IR],
[Runtime], [Runtime],
) )
}) })
// A few commands to help demonstration in the docs. // A few commands to help demonstration in the docs.

View file

@ -1,11 +1,11 @@
// would also be interesting to try out IBM Plex Mono/Sans sometime // would also be interesting to try out IBM Plex Mono/Sans sometime
#let atk = "Atkinson Hyperlegible" #let atk = "Atkinson Hyperlegible"
#let fonts = ( #let fonts = (
main: (font: atk, size: 12pt), main: (font: atk, size: 12pt),
title: (font: atk, size: 20pt), title: (font: atk, size: 20pt),
subtitle: (font: atk, size: 10pt), subtitle: (font: atk, size: 10pt),
heading: (font: "Montserrat", weight: "regular"), heading: (font: "Montserrat", weight: "regular"),
) )
#let expand(it) = { #let expand(it) = {
@ -54,28 +54,28 @@
#let terms = regex("\\b(" + terms.map(expand).join("|") + ")\\b") #let terms = regex("\\b(" + terms.map(expand).join("|") + ")\\b")
#let conf( #let conf(
title: none, title: none,
subtitle: none, subtitle: none,
doc, doc,
) = { ) = {
set page( set page(
numbering: "1 / 1", numbering: "1 / 1",
margin: 3.25cm, margin: 3.25cm,
header: locate(loc => { header: locate(loc => {
datetime.today().display() datetime.today().display()
if counter(page).at(loc).first() > 1 { if counter(page).at(loc).first() > 1 {
// on all pages other than the first, the title is useful to have at hand // on all pages other than the first, the title is useful to have at hand
h(1fr) h(1fr)
title title
} }
}), }),
) )
set par(justify: true) set par(justify: true)
set text(..fonts.main) set text(..fonts.main)
set heading(numbering: "A.1") set heading(numbering: "A.1")
show heading: it => text(..fonts.heading, it) show heading: it => text(..fonts.heading, it)
// color links // color links
show link: text.with(fill: blue) show link: text.with(fill: blue)
// prettify codeblocks // prettify codeblocks
@ -121,17 +121,17 @@
raw(it.text, lang: "haskell", block: true) raw(it.text, lang: "haskell", block: true)
} }
// document title // document title
if title != none { if title != none {
align( align(
right, right,
text(..fonts.title, title) text(..fonts.title, title)
+ v(-12pt) + v(-12pt)
+ text(..fonts.subtitle, subtitle) + text(..fonts.subtitle, subtitle)
) )
v(0.25cm) v(0.25cm)
} }
// outline and other prelude info // outline and other prelude info
outline( outline(
@ -147,6 +147,6 @@
), ),
) )
// content itself // content itself
doc doc
} }