summaryrefslogtreecommitdiff
path: root/docs/site/site.typ
diff options
context:
space:
mode:
Diffstat (limited to 'docs/site/site.typ')
-rw-r--r--docs/site/site.typ22
1 files changed, 19 insertions, 3 deletions
diff --git a/docs/site/site.typ b/docs/site/site.typ
index f50a8d9b..47903d6e 100644
--- a/docs/site/site.typ
+++ b/docs/site/site.typ
@@ -254,11 +254,27 @@
/// chords it writes 1-2 (hold 1, click 2) become the docs' mouse glyphs,
/// each with its hidden words, inside the preformatted block.
#let tutor-text(t) = {
+ // the guide's sections by title, for "-> Guide: Modes, Config"
+ let guide-sections = (:)
+ for m in read("../typ/guide.typ").matches(regex("(?m)^= (.+?) <([a-z0-9-]+)>$")) {
+ guide-sections.insert(m.captures.at(0), m.captures.at(1))
+ }
+ let tokens = regex("\\bB([123])\\b|\\b([123])-([123])\\b|docs/typ/([a-z]+)\\.typ|(?m)(?:^ -> Guide: )(.+)$|https://[^\\s)]+")
let at = 0
- for m in t.matches(regex("\\bB([123])\\b|\\b([123])-([123])\\b")) {
+ for m in t.matches(tokens) {
t.slice(at, m.start)
- if m.captures.at(0) != none { btn("B" + m.captures.at(0)) }
- else { chord("B" + m.captures.at(1), "B" + m.captures.at(2)) }
+ let (b, c1, c2, page, sections) = m.captures
+ if b != none { btn("B" + b) }
+ else if c1 != none { chord("B" + c1, "B" + c2) }
+ else if page != none { link(page + ".html", m.text) }
+ else if sections != none {
+ " -> Guide: "
+ sections.split(", ").map(name => {
+ let l = guide-sections.at(name, default: none)
+ if l != none { link("guide.html#" + l, name) } else { name }
+ }).join(", ")
+ }
+ else { link(m.text, m.text) }
at = m.end
}
t.slice(at)