From 4bdca090abc970b742f0653a02aa77d9adc95602 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 15:33:35 -0300 Subject: The guide's glossary is a definition list, and the site's tutor links its pointers into the guide On the site the glossary is a
of terms and meanings inside its
, with no stray count, so a text browser reads each term then its meaning. The tutor page links docs/typ/.typ to that page, each "-> Guide:
" to the guide's section of that title (read from guide.typ's headings), and URLs; the tutor itself keeps its text. Co-Authored-By: Claude Opus 5.5 --- docs/site/site.typ | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'docs/site/site.typ') 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) -- cgit v1.3