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
#let graphic(what) = box({
cetz.canvas({
// any preamble-ish stuff can go here
set-style(
mark: (angle: 90deg),
cetz.canvas({
// any preamble-ish stuff can go here
set-style(
mark: (angle: 90deg),
stroke: (cap: "round", join: "round"),
)
)
what
})
what
})
})
#let canvas(what) = {
align(center, graphic(what))
align(center, graphic(what))
}
// smaller stuff
#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
// so that `lift` even has any effect
line((0, 0), (0, 0), stroke: none)
// hack for the bounding box bottom
// so that `lift` even has any effect
line((0, 0), (0, 0), stroke: none)
})
// larger stuff
#let sequence(
distance: 3cm,
arrow-spacing: 0.15cm,
// cetz will support rounded rects in 0.2.0
style: (frame: "rect", padding: 0.1cm),
..labels,
distance: 3cm,
arrow-spacing: 0.15cm,
// cetz will support rounded rects in 0.2.0
style: (frame: "rect", padding: 0.1cm),
..labels,
) = group({
let labels = labels.pos()
let labels = labels.pos()
// draw each label itself
for (i, label) in labels.enumerate() {
if i != 0 {
set-origin((distance, 0))
}
content((0, 0), name: "label-" + str(i), label, ..style)
}
// draw each label itself
for (i, label) in labels.enumerate() {
if i != 0 {
set-origin((distance, 0))
}
content((0, 0), name: "label-" + str(i), label, ..style)
}
// 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
// so we leave it out
for i in range(labels.len() - 1) {
line(
(rel: (arrow-spacing, 0), to: "label-" + str(i) + ".right"),
(rel: (-arrow-spacing, 0), to: "label-" + str(i + 1) + ".left"),
mark: (end: ">"),
)
}
// 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
// so we leave it out
for i in range(labels.len() - 1) {
line(
(rel: (arrow-spacing, 0), to: "label-" + str(i) + ".right"),
(rel: (-arrow-spacing, 0), to: "label-" + str(i + 1) + ".left"),
mark: (end: ">"),
)
}
})
#let stages-overview = canvas({
sequence(
[Source],
[Graph IR],
[Runtime],
)
sequence(
[Source],
[Graph IR],
[Runtime],
)
})
// 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
#let atk = "Atkinson Hyperlegible"
#let fonts = (
main: (font: atk, size: 12pt),
main: (font: atk, size: 12pt),
title: (font: atk, size: 20pt),
subtitle: (font: atk, size: 10pt),
heading: (font: "Montserrat", weight: "regular"),
title: (font: atk, size: 20pt),
subtitle: (font: atk, size: 10pt),
heading: (font: "Montserrat", weight: "regular"),
)
#let expand(it) = {
@ -54,28 +54,28 @@
#let terms = regex("\\b(" + terms.map(expand).join("|") + ")\\b")
#let conf(
title: none,
subtitle: none,
doc,
title: none,
subtitle: none,
doc,
) = {
set page(
numbering: "1 / 1",
margin: 3.25cm,
header: locate(loc => {
datetime.today().display()
set page(
numbering: "1 / 1",
margin: 3.25cm,
header: locate(loc => {
datetime.today().display()
if counter(page).at(loc).first() > 1 {
// on all pages other than the first, the title is useful to have at hand
h(1fr)
title
}
}),
)
if counter(page).at(loc).first() > 1 {
// on all pages other than the first, the title is useful to have at hand
h(1fr)
title
}
}),
)
set par(justify: true)
set text(..fonts.main)
set heading(numbering: "A.1")
set text(..fonts.main)
set heading(numbering: "A.1")
show heading: it => text(..fonts.heading, it)
show heading: it => text(..fonts.heading, it)
// color links
show link: text.with(fill: blue)
// prettify codeblocks
@ -121,17 +121,17 @@
raw(it.text, lang: "haskell", block: true)
}
// document title
if title != none {
align(
right,
text(..fonts.title, title)
+ v(-12pt)
+ text(..fonts.subtitle, subtitle)
)
// document title
if title != none {
align(
right,
text(..fonts.title, title)
+ v(-12pt)
+ text(..fonts.subtitle, subtitle)
)
v(0.25cm)
}
v(0.25cm)
}
// outline and other prelude info
outline(
@ -147,6 +147,6 @@
),
)
// content itself
doc
// content itself
doc
}