refactor: prefer link-index get across examples and tests

Migrate remaining footnote-style collection access in examples,
public/structure, and ext/lib smokes to [key](base); teach link-index in
structure pages and use bracket calls in the cafe journal example.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-14 12:54:38 +08:00
1 parent 8d97adc1dc
commit abcb141737
75 files changed
+284 -281

No files matched your search

+12 -12
View File
@@ -12,12 +12,12 @@ import text:lib/text.mq.md
**段 = None**
- [帖](行)
**板 = 帖[^board]**
**题 = 帖[^title]**
**链 = 帖[^slug]**
**作 = 帖[^author]**
**评 = 帖[^comments_count]**
**时 = 帖[^created_at]**
**板 = [board](帖)**
**题 = [title](帖)**
**链 = [slug](帖)**
**作 = [author](帖)**
**评 = [comments_count](帖)**
**时 = [created_at](帖)**
1. not 作
**作 = "匿名"**
2. *
@@ -42,10 +42,10 @@ import text:lib/text.mq.md
**段 = None**
- [讯](行)
**题 = 讯[^title]**
**链 = 讯[^slug]**
**板 = 讯[^board]**
**时 = 讯[^created_at]**
**题 = [title](讯)**
**链 = [slug](讯)**
**板 = [board](讯)**
**时 = [created_at](讯)**
1. not 板
**板 = ""**
2. *
@@ -80,8 +80,8 @@ import text:lib/text.mq.md
**全项 = "<a href=\"" + 全链 + "\" class=\"" + 全部类 + " active\" " + 数据属 + "=\"0\">" + 全标签 + "</a>"**
**段 = > table.append list=段 item=全项**
- [板](板块)
**名 = 板[^name]**
**号 = 板[^id]**
**名 = [name](板)**
**号 = [id](板)**
**链 = 前缀 + "?" + 查询键 + "=" + 号**
**项 = "<a href=\"" + 链 + "\" class=\"" + 全部类 + "\" " + 数据属 + "=\"" + 号 + "\">" + 名 + "</a>"**
**段 = > table.append list=段 item=项**
@@ -20,8 +20,8 @@ import feed:feed.mq.md
**公告段 = None**
- [告](公告行)
**文 = 告[^content]**
**时 = 告[^created_at]**
**文 = [content](告)**
**时 = [created_at](告)**
**一项 = "<div class=\"notice-item\"><article class=\"notice-content\">" + 文 + "</article><p class=\"notice-create-time\">" + 时 + "</p></div>"**
**公告段 = > table.append list=公告段 item=一项**
1. 公告段
+6 -6
View File
@@ -141,9 +141,9 @@ import db:db/index.mq.md
**房间行 = > store.查询 表="chat_rooms" 上限=50**
**房间段 = None**
- [房](房间行)
**名 = 房[^name]**
**链 = 房[^slug]**
**摘 = 房[^summary]**
**名 = [name](房)**
**链 = [slug](房)**
**摘 = [summary](房)**
**项 = "<article class=\"chat-room-card\"><h3><a href=\"/chat/" + 链 + "\">" + 名 + "</a></h3><p>" + 摘 + "</p></article>"**
**房间段 = > table.append list=房间段 item=项**
**房间内 = > text.str_join xs=房间段 sep=""**
@@ -165,9 +165,9 @@ import db:db/index.mq.md
**专题行 = > store.查询 表="topics" 上限=50**
**专题段 = None**
- [题](专题行)
**题名 = 题[^title]**
**链 = 题[^slug]**
**摘 = 题[^summary]**
**题名 = [title](题)**
**链 = [slug](题)**
**摘 = [summary](题)**
**项 = "<article class=\"topic-card\"><h3>" + 题名 + "</h3><p>" + 摘 + "</p><p class=\"text-muted\">slug: " + 链 + "</p></article>"**
**专题段 = > table.append list=专题段 item=项**
**专题内 = > text.str_join xs=专题段 sep=""**
+4 -4
View File
@@ -44,7 +44,7 @@ import sys:lib/sys.mq.md
**应用 = > 应用.门禁 路径="/write" 角色="admin" 匹配="prefix" 拒绝="redirect"**
**应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"**
**gates = 应用[^gates]**
**gates = [gates](应用)**
**n = > len value=`gates`**
1. `n` >= 2
> print text=gates-ok
@@ -52,9 +52,9 @@ import sys:lib/sys.mq.md
> print text=gates-fail
> sys.exit code=1
**ws = 应用[^ws_routes]**
**room = ws[^/chat/ws]**
**mode = room[^mode]**
**ws = [ws_routes](应用)**
**room = [/chat/ws](ws)**
**mode = [mode](room)**
1. `mode` == "broadcast"
> print text=ws-ok
2. *
+2 -2
View File
@@ -56,12 +56,12 @@ description: >-
**名 = "拿铁"**
**价 = [`名`](菜单)**
**摘要 = 结账摘要 品名=`名` 价=`价` 杯数=2 会员=True**
**摘要 = [结账摘要] 品名=`名` 价=`价` 杯数=2 会员=True**
**打印 内容=`摘要`**
旁桌只要一杯普通美式,对照一下原价:
**对照 = 结账摘要 品名="美式" 价=[美式](菜单)**
**对照 = [结账摘要] 品名="美式" 价=[美式](菜单)**
**打印 内容=`对照`**
---
+2 -2
View File
@@ -27,8 +27,8 @@ $$
**`_` = > la.draw factor=`A` kind="heatmap" theme="light" path="ls-heatmap.svg"**
**`ls` = > la.lstsq a=`A` b=`b`**
**`x` = ls[^x]**
**`resid` = ls[^residual_fro]**
**`x` = [x](ls)**
**`resid` = [residual_fro](ls)**
> print text=`x`
> print text=`resid`
+1 -1
View File
@@ -17,7 +17,7 @@ $$
**`M` = > la.from_formula formula=`M`**
**`f` = > la.factorize matrix=`M` kind="svd"**
**`S` = f[^S]**
**`S` = [S](f)**
**`_` = > la.draw factor=`f` kind="svd" theme="light" path="svd-structure.svg"**
**`hm` = > la.draw factor=`M` kind="hinton" path="svd-hinton.svg"**
+2 -2
View File
@@ -18,8 +18,8 @@ Declare shapes in a table, form \(P = AB\), then check \((AB)^\top = B^\top A^\t
| 2 | B | 3 | 2 |
**`env` = > la.declare table=`shapes`**
**`A` = env[^A]**
**`B` = env[^B]**
**`A` = [A](env)**
**`B` = [B](env)**
**`P` = `A` * `B`**
**`t` = > `P`.T_ascii**
> print text=`t`
+1 -1
View File
@@ -30,7 +30,7 @@ Build |Φ⁺⟩ with H then CX. Full-state purity stays 1; tracing out one qubit
**ezz = > `qc`.expect obs=`zz`**
**sch = > `qc`.schmidt cut=1**
**ent = sch[^entropy]**
**ent = [entropy](sch)**
**_ = > `qc`.draw path="entangle-circuit.svg" theme="dark"**
**_ = > `qc`.draw kind="hinton" path="entangle-hinton.svg"**
+8 -8
View File
@@ -55,18 +55,18 @@ import db:db/index.mq.md
<!-- 工具页:用 lib/net 解析展示 -->
**解析请求 = > net.解析Cookie 内容="session=abc123; theme=dark"**
**请求块 = 解析请求[^1]**
**请求块 = [1](解析请求)**
**解析响应 = > net.解析Cookie 内容="id=42; Path=/; HttpOnly; SameSite=Lax" 是响应头=True**
**响应块 = 解析响应[^1]**
**响应块 = [1](解析响应)**
`边界` = ----b
`正文` = "--`边界`\nContent-Disposition: form-data; name=\"title\"\n\n你好\n--`边界`\nContent-Disposition: form-data; name=\"封面\"; filename=\"pic.png\"\nContent-Type: image/png\n\n<字节>\n--`边界`--\n"
**多部分 = > net.解析多部分 正文=`正文` 边界=`边界`**
**字段块 = 多部分[^1]**
**文件块 = 多部分[^2]**
**字段块 = [1](多部分)**
**文件块 = [2](多部分)**
`工具段` =
@@ -74,13 +74,13 @@ import db:db/index.mq.md
|----|
| <h1>网络工具</h1><p>由 lib/net 提供的解析演示:解析Cookie 与 解析多部分。</p><section class="content cards"> |
| <article><h2>Cookie 请求头</h2><p> |
| `请求块`[^name]=`请求块`[^value] |
| [name](`请求块`)=[value](`请求块`) |
| </p></article><article><h2>Set-Cookie 响应头</h2><p> |
| `响应块`[^name]=`响应块`[^value] · HttpOnly=`响应块`[^http_only] |
| [name](`响应块`)=[value](`响应块`) · HttpOnly=[http_only](`响应块`) |
| </p></article><article><h2>多部分字段</h2><p> |
| `字段块`[^name]=`字段块`[^value] |
| [name](`字段块`)=[value](`字段块`) |
| </p></article><article><h2>多部分文件</h2><p> |
| `文件块`[^name] · `文件块`[^filename] · `文件块`[^content_type] |
| [name](`文件块`) · [filename](`文件块`) · [content_type](`文件块`) |
| </p></article></section> |
**工具引言 = > text.str_join xs=`工具段` sep=""**
+8 -8
View File
@@ -46,12 +46,12 @@ About page: same shell.
Parse a `Cookie` request header with the standard library.
**parsed_req = > net.cookie_parse text="session=abc123; theme=dark"**
**req_cookie = parsed_req[^1]**
**req_cookie = [1](parsed_req)**
Parse a `Set-Cookie` response header.
**parsed_resp = > net.cookie_parse text="id=42; Path=/; HttpOnly; SameSite=Lax" is_response=True**
**resp_cookie = parsed_resp[^1]**
**resp_cookie = [1](parsed_resp)**
Parse a `multipart/form-data` body.
@@ -60,8 +60,8 @@ Parse a `multipart/form-data` body.
`_body` = "--`_b`\nContent-Disposition: form-data; name=\"title\"\n\nHello\n--`_b`\nContent-Disposition: form-data; name=\"cover\"; filename=\"pic.png\"\nContent-Type: image/png\n\n<bytes>\n--`_b`--\n"
**mp = > net.multipart_parse body=`_body` boundary=`_b`**
**mp_title = mp[^1]**
**mp_cover = mp[^2]**
**mp_title = [1](mp)**
**mp_cover = [2](mp)**
Build the tools page as one HTML intro (intro is served raw).
@@ -71,13 +71,13 @@ Build the tools page as one HTML intro (intro is served raw).
|----|
| <h1>Net tools</h1><p>Parsing demos powered by lib/net: cookie_parse and multipart_parse.</p><section class="content cards"> |
| <article><h2>Cookie request</h2><p> |
| `req_cookie`[^name]=`req_cookie`[^value] |
| [name](`req_cookie`)=[value](`req_cookie`) |
| </p></article><article><h2>Set-Cookie response</h2><p> |
| `resp_cookie`[^name]=`resp_cookie`[^value] · HttpOnly=`resp_cookie`[^http_only] |
| [name](`resp_cookie`)=[value](`resp_cookie`) · HttpOnly=[http_only](`resp_cookie`) |
| </p></article><article><h2>Multipart field</h2><p> |
| `mp_title`[^name]=`mp_title`[^value] |
| [name](`mp_title`)=[value](`mp_title`) |
| </p></article><article><h2>Multipart file</h2><p> |
| `mp_cover`[^name] · `mp_cover`[^filename] · `mp_cover`[^content_type] |
| [name](`mp_cover`) · [filename](`mp_cover`) · [content_type](`mp_cover`) |
| </p></article></section> |
**tools_intro = > text.str_join xs=`tools_parts` sep=""**