feat(stdlib): Mid2 M8 toml, html escape, and base32
Add read-only TOML subset parse, HTML escape/unescape, and RFC 4648 base32 on encoding; gold tests and public demos included. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
08c48f3acb
commit
435f36b6e9
24 files changed
+748
-18
No files matched your search
@@ -1213,6 +1213,22 @@ fn lib_url_smoke_zh() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_toml_html_encoding_smoke() {
|
||||
assert_out(
|
||||
"tests/lib/toml-html-encoding-smoke.mq.md",
|
||||
"marqdo\n2\n1\na<b>&"c'\na<b>&\"c'\nNBSWY3DP\nhello",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_toml_html_encoding_smoke_zh() {
|
||||
assert_out(
|
||||
"tests/lib/配置表-超文本-编码-烟测.mq.md",
|
||||
"中文\nTrue\na<b>\nNBUQ====",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_re_smoke() {
|
||||
assert_out(
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: lib/toml html encoding M8 smoke
|
||||
import toml:lib/toml.mq.md
|
||||
import html:lib/html.mq.md
|
||||
import enc:lib/encoding.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*cfg = > toml.parse text="name = \"marqdo\"\ncount = 2\n[pkg]\nver = \"1\"\n"*
|
||||
> print text=`cfg`[^name]
|
||||
> print text=`cfg`[^count]
|
||||
*pkg = `cfg`[^pkg]*
|
||||
> print text=`pkg`[^ver]
|
||||
|
||||
*e = > html.escape text="a<b>&\"c'"*
|
||||
> print text=`e`
|
||||
*u = > html.unescape text=`e`*
|
||||
> print text=`u`
|
||||
|
||||
*b = > enc.base32_encode text="hello"*
|
||||
> print text=`b`
|
||||
*back = > enc.base32_decode text=`b`*
|
||||
> print text=`back`
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: lib/配置表 超文本 编码 烟测
|
||||
导入 配置:lib/配置表.mq.md
|
||||
导入 超:lib/超文本.mq.md
|
||||
导入 编:lib/编码.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*cfg = > 配置.解析 内容="name = \"中文\"\nok = true\n"*
|
||||
> print text=`cfg`[^name]
|
||||
> print text=`cfg`[^ok]
|
||||
|
||||
*e = > 超.转义 内容="a<b>"*
|
||||
> print text=`e`
|
||||
|
||||
*b = > 编.基32编码 内容="hi"*
|
||||
> print text=`b`
|
||||
Reference in new issue
Block a user