feat(stdlib): add table GFM rendering and an HTTP/1.1 parser fixture
- stdlib/data/table.mq.md adds 连接片段/连接行/转义单元格/转GFM; logical Table renders as a GFM pipe table with pipe/newline escaping (CM-A08 P4 gate). - Add semantic fixture 71: HTTP/1.1 status/header/chunked response parsing and request construction in .mq.md; no host HTTP/TLS implementation (C10). - Update table CLI test, golden count 71, specs/status/README/changelog and evidence. Gate: fmt, clippy -D warnings, 426 tests passed; bundle digest refreshed.
This commit is contained in:
1 parent
67a6d35daf
commit
69a28ed1e1
12 files changed
+492
-9
No files matched your search
@@ -231,3 +231,135 @@
|
||||
**行号 = 行号 + 1**
|
||||
|
||||
*结果*
|
||||
|
||||
## 连接片段
|
||||
|
||||
`(片段)`
|
||||
|
||||
**结果 = ""**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(片段)`
|
||||
|
||||
1. `下标 > 0`
|
||||
|
||||
**结果 = 结果 + " | "**
|
||||
|
||||
2. `true`
|
||||
|
||||
**忽略 = 0**
|
||||
|
||||
**结果 = 结果 + 片段[下标]**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
*结果*
|
||||
|
||||
## 连接行
|
||||
|
||||
`(行列表)`
|
||||
|
||||
**结果 = ""**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(行列表)`
|
||||
|
||||
1. `下标 > 0`
|
||||
|
||||
**结果 = 结果 + "\n"**
|
||||
|
||||
2. `true`
|
||||
|
||||
**忽略 = 0**
|
||||
|
||||
**结果 = 结果 + 行列表[下标]**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
*结果*
|
||||
|
||||
## 转义单元格
|
||||
|
||||
`(值)`
|
||||
|
||||
**文本值 = 文本(值)**
|
||||
|
||||
**点 = text.codepoints(文本值)**
|
||||
|
||||
**结果 = ""**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(点)`
|
||||
|
||||
1. `点[下标] == 124`
|
||||
|
||||
**结果 = 结果 + text.from_codepoint(92) + "|"**
|
||||
|
||||
2. `点[下标] == 10 or 点[下标] == 13`
|
||||
|
||||
**结果 = 结果 + " "**
|
||||
|
||||
3. `true`
|
||||
|
||||
**结果 = 结果 + text.from_codepoint(点[下标])**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
*结果*
|
||||
|
||||
## 转GFM
|
||||
|
||||
`(数据)`
|
||||
|
||||
**列名 = table.columns(数据)**
|
||||
|
||||
**表头 = []**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(列名)`
|
||||
|
||||
**表头 = list.append(表头, 转义单元格(列名[下标]))**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
**行列表 = []**
|
||||
|
||||
**行列表 = list.append(行列表, "| " + 连接片段(表头) + " |")**
|
||||
|
||||
**分隔 = []**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(列名)`
|
||||
|
||||
**分隔 = list.append(分隔, "---")**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
**行列表 = list.append(行列表, "| " + 连接片段(分隔) + " |")**
|
||||
|
||||
**行号 = 0**
|
||||
|
||||
- `行号 < 长度(数据)`
|
||||
|
||||
**行 = table.row(数据, 行号)**
|
||||
|
||||
**单元格 = []**
|
||||
|
||||
**列号 = 0**
|
||||
|
||||
- `列号 < 长度(行)`
|
||||
|
||||
**单元格 = list.append(单元格, 转义单元格(行[列号]))**
|
||||
|
||||
**列号 = 列号 + 1**
|
||||
|
||||
**行列表 = list.append(行列表, "| " + 连接片段(单元格) + " |")**
|
||||
|
||||
**行号 = 行号 + 1**
|
||||
|
||||
*连接行(行列表)*
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "marqdo-stdlib",
|
||||
"version": "0.1.0",
|
||||
"digest": "sha256:67710611a9f56b403d0ef4c295272ba95cd6fc0bee9c7314f4a42d8e54e8aba2"
|
||||
"digest": "sha256:7a9c46fa2372017395413980f857b6863dc118c3f6c9a824abd03ddf3c59f3d4"
|
||||
}
|
||||
@@ -25,4 +25,4 @@ import:
|
||||
|
||||
**分组 = table.分组(表(["类别", "值"], [["a", 1], ["b", 2], ["a", 3]]), 0, 1)**
|
||||
|
||||
*[选择, 过滤, 排序, 追加, 设置, 连接, 分组, 数据]*
|
||||
*[选择, 过滤, 排序, 追加, 设置, 连接, 分组, 数据, table.转GFM(数据)]*
|
||||
Reference in new issue
Block a user