diff --git a/doc/design/collection-access-link.md b/doc/design/collection-access-link.md index 657455b..8d0494e 100644 --- a/doc/design/collection-access-link.md +++ b/doc/design/collection-access-link.md @@ -44,6 +44,12 @@ `` `菜单`[^拿铁] `` / `菜单[^拿铁]` → `[拿铁](菜单)`(**基与键左右对调**)。 +| 区域 | 约定 | +|------|------| +| 新代码 / examples / public | **只用**链接形 | +| `tests/structure/footnote*` · `interp-footnote*` | 脚注兼容门禁(保留) | +| 其余 structure / ext / lib 金样 | 已迁链接形 | + 脚注路径保留至另行决定移除之日;Skill / 教程 / 新示例只用链接形。 ## 4. 非目标 diff --git a/doc/roadmap/lib-ext-code-as-docs.md b/doc/roadmap/lib-ext-code-as-docs.md index 598f1a4..dfa7190 100644 --- a/doc/roadmap/lib-ext-code-as-docs.md +++ b/doc/roadmap/lib-ext-code-as-docs.md @@ -28,6 +28,7 @@ | **M3–M4** | `ext/web`、`ext/ai`:脚注→链接取元;叙述;示例可逐步换括号调用 | **done**(取元迁移) | | **M5** | quantum / linalg + full gold | **done** | | **M6** | examples + public/structure + tests/ext·lib 链接取元;cafe 括号调用例 | **done** | +| **M7** | structure collection 金样改链接形;public/stdlib 括号调用例 | **done** | ## 2. 验收(出门) @@ -46,3 +47,4 @@ | 2026-09-14 | M3–M4 ext/web+ai 脚注→链接取元 | | 2026-09-14 | M5 quantum/linalg 叙述 + public/features 取元 | | 2026-09-14 | M6 examples/public/tests 批量链接取元 + cafe 括号调用 | +| 2026-09-14 | M7 structure collection 金样 + stdlib 括号调用例 | diff --git a/public/stdlib/fs.mq.md b/public/stdlib/fs.mq.md index b18ebc6..c8266a6 100644 --- a/public/stdlib/fs.mq.md +++ b/public/stdlib/fs.mq.md @@ -6,13 +6,11 @@ import fs:lib/fs.mq.md # main -Import lib/fs.mq.md. Functions: read_text, write_text, append_text, exists, list_dir, make_dir, remove (path / text params). +Filesystem helpers from lib/fs. Bare path words must not contain `/` (division). Prefer a same-folder name or a variable. -Bare path words must not contain a slash character (parsed as division). Prefer a same-folder name or a variable. - -**`ok` = > fs.exists path="demo.txt"** +**`ok` = [fs.exists] path="demo.txt"** 1. `ok` - > print text=demo-present + **打印 内容="demo-present"** 2. * - > print text=demo-missing + **打印 内容="demo-missing"** diff --git a/public/stdlib/table.mq.md b/public/stdlib/table.mq.md index ede8584..6c5d0cf 100644 --- a/public/stdlib/table.mq.md +++ b/public/stdlib/table.mq.md @@ -19,7 +19,7 @@ Read with link-index get. Use json for parse/stringify only. | b | **`xs` = [table.put] in=`xs` at=1 value="A"** -**`n` = > table.rows xs=`xs`** +**`n` = [table.rows] xs=`xs`** **打印 内容=[Authorization](h)** **打印 内容=[1](xs)** diff --git a/public/stdlib/time.mq.md b/public/stdlib/time.mq.md index e8fa545..aa0825b 100644 --- a/public/stdlib/time.mq.md +++ b/public/stdlib/time.mq.md @@ -6,14 +6,12 @@ import time:lib/time.mq.md # main -Import lib/time.mq.md. Functions: now_unix, now_ms, format(unix, pattern), parse(text, pattern), sleep_ms(ms). Patterns use strftime. +Unix time helpers from lib/time. Patterns use strftime. -**`s` = > time.format unix=0 pattern="%Y-%m-%d"** +**`s` = [time.format] unix=0 pattern="%Y-%m-%d"** +**打印 内容=`s`** -> print text=`s` +**`u` = [time.parse] text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"** +**打印 内容=`u`** -**`u` = > time.parse text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"** - -> print text=`u` - -> time.sleep_ms ms=0 +**[time.sleep_ms] ms=0** diff --git a/public/stdlib/文件.mq.md b/public/stdlib/文件.mq.md index 8a1066b..81208b8 100644 --- a/public/stdlib/文件.mq.md +++ b/public/stdlib/文件.mq.md @@ -6,13 +6,11 @@ description: 沙箱内读写文本 # main -导入 lib/文件.mq.md。函数:读文本、写文本、追加文本、存在、列目录、建目录、删除。 +文件系统助手(lib/文件)。裸路径不要写斜杠(会被当成除法)。可用同目录文件名或变量。 -裸路径字面量不要写斜杠(会被当成除法)。可用同目录文件名或变量。 - -**`ok` = > 文件.存在 路径="demo.txt"** +**`ok` = [文件.存在] 路径="demo.txt"** 1. `ok` - > 打印 内容=有演示文件 + **打印 内容="有演示文件"** 2. * - > 打印 内容=无演示文件 + **打印 内容="无演示文件"** diff --git a/public/stdlib/时间.mq.md b/public/stdlib/时间.mq.md index 33d80a9..bc02a6c 100644 --- a/public/stdlib/时间.mq.md +++ b/public/stdlib/时间.mq.md @@ -6,14 +6,12 @@ description: Unix 时间、格式化、解析、睡眠 # main -导入 lib/时间.mq.md。函数:此刻秒、此刻毫秒、格式化(秒, 格式)、解析时间(内容, 格式)、睡眠毫秒(毫秒)。格式为 strftime。 +Unix 时间助手(lib/时间)。格式为 strftime。 -**`s` = > 时间.格式化 秒=0 格式="%Y-%m-%d"** +**`s` = [时间.格式化] 秒=0 格式="%Y-%m-%d"** +**打印 内容=`s`** -> 打印 内容=`s` +**`u` = [时间.解析时间] 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"** +**打印 内容=`u`** -**`u` = > 时间.解析时间 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"** - -> 打印 内容=`u` - -> 时间.睡眠毫秒 毫秒=0 +**[时间.睡眠毫秒] 毫秒=0** diff --git a/public/stdlib/表.mq.md b/public/stdlib/表.mq.md index ec815d5..8547f2b 100644 --- a/public/stdlib/表.mq.md +++ b/public/stdlib/表.mq.md @@ -16,8 +16,8 @@ description: 改 / 行数 / 取行(代码即文档试点) | 乙 | **`xs` = [表.改] 入=`xs` 于=1 值="甲改"** -**`n` = > 表.行数 xs=`xs`** -**`r` = > 表.取行 xs=`xs` i=0** +**`n` = [表.行数] xs=`xs`** +**`r` = [表.取行] xs=`xs` i=0** **打印 内容=[1](xs)** **打印 内容=`n`** diff --git a/tests/structure/collection-cell-expr.mq.md b/tests/structure/collection-cell-expr.mq.md index 2b07c72..8688496 100644 --- a/tests/structure/collection-cell-expr.mq.md +++ b/tests/structure/collection-cell-expr.mq.md @@ -14,9 +14,9 @@ description: Data cells evaluate like call-arg values (`var`, paths, hyphen pros |---------|-------|------| | `secret` | `name` | https://api.openai.com/v1 | -> print text=`cfg`[^api_key] -> print text=`cfg`[^model] -> print text=`cfg`[^base] +> print text=[api_key](`cfg`) +> print text=[model](`cfg`) +> print text=[base](`cfg`) `paths` = @@ -24,7 +24,7 @@ description: Data cells evaluate like call-arg values (`var`, paths, hyphen pros |---| | /chat/completions | -> print text=`paths`[^1] +> print text=[1](`paths`) `rec` = @@ -32,7 +32,7 @@ description: Data cells evaluate like call-arg values (`var`, paths, hyphen pros |---|------|---------| | 1 | user | `secret` | -> print text=`rec`[^1][^content] +> print text=[content]([1](`rec`)) `ratios` = @@ -41,5 +41,5 @@ description: Data cells evaluate like call-arg values (`var`, paths, hyphen pros | "1/5" | | "16/9" | -> print text=`ratios`[^1] -> print text=`ratios`[^2] +> print text=[1](`ratios`) +> print text=[2](`ratios`) diff --git a/tests/structure/collection-map-list.mq.md b/tests/structure/collection-map-list.mq.md index b1cffda..2004df2 100644 --- a/tests/structure/collection-map-list.mq.md +++ b/tests/structure/collection-map-list.mq.md @@ -11,14 +11,14 @@ title: 横表多行 → 字典套列表 | 红富士 | 青瓜 | | 嘎啦 | 黄瓜条 | -**第一种苹果 = 货架[^苹果][^1]** +**第一种苹果 = [1]([苹果](货架))** > print text=`第一种苹果` -**列 = 货架[^苹果]** +**列 = [苹果](货架)** > print text=`列` -**第二种黄瓜 = 货架[^黄瓜][^2]** +**第二种黄瓜 = [2]([黄瓜](货架))** > print text=`第二种黄瓜` diff --git a/tests/structure/collection-map.mq.md b/tests/structure/collection-map.mq.md index d59fcd2..aa26d4f 100644 --- a/tests/structure/collection-map.mq.md +++ b/tests/structure/collection-map.mq.md @@ -10,15 +10,15 @@ title: 横表单行 → 字典 |------|------|------| | 水果 | 蔬菜 | 数码用品 | -**种 = 分类[^苹果]** +**种 = [苹果](分类)** > print text=`种` -**种 = 分类[^黄瓜]** +**种 = [黄瓜](分类)** > print text=`种` -**种 = 分类[^鼠标]** +**种 = [鼠标](分类)** > print text=`种` diff --git a/tests/structure/collection-records-at.mq.md b/tests/structure/collection-records-at.mq.md index f917dc8..0481c01 100644 --- a/tests/structure/collection-records-at.mq.md +++ b/tests/structure/collection-records-at.mq.md @@ -11,10 +11,10 @@ title: row records with @ marker | 1 | apple | 2 | | 2 | pear | 3 | -**n = orders[^1][^name]** +**n = [name]([1](orders))** > print text=`n` -**q = orders[^2][^qty]** +**q = [qty]([2](orders))** > print text=`q` diff --git a/tests/structure/collection-records.mq.md b/tests/structure/collection-records.mq.md index 3ae8c83..7adb7de 100644 --- a/tests/structure/collection-records.mq.md +++ b/tests/structure/collection-records.mq.md @@ -11,15 +11,15 @@ title: 行向记录表(首列 行 / @) | 1 | 苹果 | 2 | | 2 | 梨 | 3 | -**第一 = 订单[^1]** +**第一 = [1](订单)** > print text=`第一` -**名 = 订单[^1][^品名]** +**名 = [品名]([1](订单))** > print text=`名` -**量 = 订单[^2][^数量]** +**量 = [数量]([2](订单))** > print text=`量`