feat(markup): finish v0.3 stock migration and green gold
Migrate remaining .mq.md (tests/ext/public/examples), stop elevating local assigns to params, inject form_target in Go libweb, and skip live LLM gold without a real key. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bfb10d172b
commit
b5c07385e9
324 files changed
+4572
-4339
No files matched your search
@@ -15,6 +15,6 @@ print("hello-from-python")
|
||||
|
||||
Default command is python (Windows) or python3 (Unix). Override with set_cmd, env MARQDO_FOREIGN_PYTHON, or the command box in live view. Failures ask you to check that configuration.
|
||||
|
||||
*`out` = > foreign.run code=`hi` *
|
||||
**`out` = > foreign.run code=`hi` **
|
||||
|
||||
> print text=`out`
|
||||
@@ -10,7 +10,7 @@ Import lib/fs.mq.md. Functions: read_text, write_text, append_text, exists, list
|
||||
|
||||
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
|
||||
|
||||
@@ -8,12 +8,12 @@ import json:lib/json.mq.md
|
||||
|
||||
Import lib/json.mq.md from both English and Chinese docs (no translated twin). Functions: parse(text), stringify(value), get(value, key), keys(value), quote(text) — JSON string literal with quotes (for building request bodies). Objects become the map runtime type.
|
||||
|
||||
*`obj` = > json.parse text="{}"*
|
||||
**`obj` = > json.parse text="{}"**
|
||||
|
||||
*`ty` = > type `obj` *
|
||||
**`ty` = > type `obj` **
|
||||
|
||||
> print text=`ty`
|
||||
|
||||
*`out` = > json.stringify value=`obj` *
|
||||
**`out` = > json.stringify value=`obj` **
|
||||
|
||||
> print text=`out`
|
||||
@@ -17,22 +17,22 @@ Numeric helpers: pi, e, num, add/sub/mul/div/pow, sin/cos/tan, sqrt/abs/ln/exp,
|
||||
|
||||
Symbolic: formula(text), simplify, expand, diff, subs, eval, solve.
|
||||
|
||||
Plotting (already in the library): plot / plot_points / plot_conic return SVG text. Axes include arrows and tick labels; **grid is on by default** (pass grid=False / grid=假 to hide). Optional path= writes a file under the sandbox. With no path, CLI auto-writes stem-plot-n.svg and prints plot: …; view embeds the SVG under Execution.
|
||||
Plotting (already in the library): plot / plot_points / plot_conic return SVG text. Axes include arrows and tick labels; grid is on by default (pass grid=False / grid=假 to hide). Optional path= writes a file under the sandbox. With no path, CLI auto-writes stem-plot-n.svg and prints plot: …; view embeds the SVG under Execution.
|
||||
|
||||
diff / simplify / expand / partial subs return formula values so you can chain (e.g. differentiate twice, then plot or eval).
|
||||
|
||||
*`ty` = > type `f`*
|
||||
**`ty` = > type `f`**
|
||||
|
||||
> print text=`ty`
|
||||
|
||||
*`df` = > math.diff formula=`f` var="x"*
|
||||
**`df` = > math.diff formula=`f` var="x"**
|
||||
|
||||
> print text=`df`
|
||||
|
||||
*`roots` = > math.solve formula=`f` var="x"*
|
||||
**`roots` = > math.solve formula=`f` var="x"**
|
||||
|
||||
> print text=`roots`
|
||||
|
||||
*`_svg` = > math.plot formula=`f` var="x" min=-3 max=3*
|
||||
**`_svg` = > math.plot formula=`f` var="x" min=-3 max=3**
|
||||
|
||||
> print text=plot-ok
|
||||
@@ -8,6 +8,6 @@ import net:lib/net.mq.md
|
||||
|
||||
Import lib/net.mq.md. Functions: http_get, http_post, http_post_sse, openai_sse_parse, http_request, url_encode. HTTPS and optional headers= map are supported. Default post content-type is JSON. `http_post_sse` / `openai_sse_parse` return OpenAI chat stream event lists (`delta` / `done`).
|
||||
|
||||
*`e` = > net.url_encode text="hello world"*
|
||||
**`e` = > net.url_encode text="hello world"**
|
||||
|
||||
> print text=`e`
|
||||
@@ -8,9 +8,9 @@ import plugin:lib/plugin.mq.md
|
||||
|
||||
Import lib/plugin.mq.md. Functions: load(path), unload(), list(). After load, registered plugin names are callable like other functions. C ABI: include/marqdo_abi.h — see doc/design/ext-abi.md. Path must stay under the program sandbox (cwd / fs root).
|
||||
|
||||
*`names` = > plugin.list *
|
||||
**`names` = > plugin.list **
|
||||
|
||||
*`n` = > len `names` *
|
||||
**`n` = > len `names` **
|
||||
|
||||
1. `n` >= 0
|
||||
> print text=plugin-ok
|
||||
|
||||
@@ -8,9 +8,9 @@ import sys:lib/sys.mq.md
|
||||
|
||||
Import lib/sys.mq.md. Functions: env_get, env_set, load_dotenv(optional path), args, cwd, exit(code), exec(cmd), stream_publish(event). load_dotenv does not override existing variables. Under view, exit soft-fails instead of killing the process. `stream_publish` feeds the view SSE EventBus.
|
||||
|
||||
*`d` = > sys.cwd *
|
||||
**`d` = > sys.cwd **
|
||||
|
||||
*`n` = > len `d` *
|
||||
**`n` = > len `d` **
|
||||
|
||||
1. `n` > 0
|
||||
> print text=cwd-ok
|
||||
|
||||
@@ -6,9 +6,9 @@ import table:lib/table.mq.md
|
||||
|
||||
# main
|
||||
|
||||
Prefer `table.put` for element updates (`at=` text key, **1-based** int, or list path). Use `json` for parse/stringify only.
|
||||
Prefer `table.put` for element updates (`at=` text key, 1-based int, or list path). Use `json` for parse/stringify only.
|
||||
|
||||
*`h` = > table.put in=None at="Authorization" value="Bearer-demo"*
|
||||
**`h` = > table.put in=None at="Authorization" value="Bearer-demo"**
|
||||
|
||||
`xs` =
|
||||
|
||||
@@ -17,8 +17,8 @@ Prefer `table.put` for element updates (`at=` text key, **1-based** int, or list
|
||||
| a |
|
||||
| b |
|
||||
|
||||
*`xs` = > table.put in=`xs` at=1 value="A"*
|
||||
*`n` = > table.rows xs=`xs`*
|
||||
**`xs` = > table.put in=`xs` at=1 value="A"**
|
||||
**`n` = > table.rows xs=`xs`**
|
||||
|
||||
> print text=`h`[^Authorization]
|
||||
> print text=`xs`[^1]
|
||||
|
||||
@@ -8,12 +8,12 @@ import text:lib/text.mq.md
|
||||
|
||||
Import lib/text.mq.md. Functions: str_trim(s), str_split(s, sep), str_join(xs, sep).
|
||||
|
||||
*`t` = > text.str_trim s=" marqdo "*
|
||||
**`t` = > text.str_trim s=" marqdo "**
|
||||
|
||||
> print text=`t`
|
||||
|
||||
*`parts` = > text.str_split s="a,b,c" sep=","*
|
||||
**`parts` = > text.str_split s="a,b,c" sep=","**
|
||||
|
||||
*`j` = > text.str_join xs=`parts` sep="-"*
|
||||
**`j` = > text.str_join xs=`parts` sep="-"**
|
||||
|
||||
> print text=`j`
|
||||
@@ -8,11 +8,11 @@ import time:lib/time.mq.md
|
||||
|
||||
Import lib/time.mq.md. Functions: now_unix, now_ms, format(unix, pattern), parse(text, pattern), sleep_ms(ms). Patterns use strftime.
|
||||
|
||||
*`s` = > time.format unix=0 pattern="%Y-%m-%d"*
|
||||
**`s` = > time.format unix=0 pattern="%Y-%m-%d"**
|
||||
|
||||
> print text=`s`
|
||||
|
||||
*`u` = > time.parse text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"*
|
||||
**`u` = > time.parse text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"**
|
||||
|
||||
> print text=`u`
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ print("hello-from-python")
|
||||
|
||||
默认命令可用 设置命令 或 MARQDO_FOREIGN_PYTHON 覆盖;live view 里可改命令框再点 Run。
|
||||
|
||||
*`out` = > 外联.运行 代码=`hi` *
|
||||
**`out` = > 外联.运行 代码=`hi` **
|
||||
|
||||
> print text=`out`
|
||||
@@ -8,9 +8,9 @@ description: 加载可选共享库(.dll / .so / .dylib)
|
||||
|
||||
导入 lib/插件.mq.md。函数:加载(路径)、卸载()、列出()。加载后,插件注册的名称可像普通函数一样调用。C 契约见 include/marqdo_abi.h 与 doc/design/ext-abi.md。路径须落在程序沙箱内。
|
||||
|
||||
*`names` = > 插件.列出 *
|
||||
**`names` = > 插件.列出 **
|
||||
|
||||
*`n` = > 长度 值=`names` *
|
||||
**`n` = > 长度 值=`names` **
|
||||
|
||||
1. `n` >= 0
|
||||
> 打印 内容=插件就绪
|
||||
|
||||
@@ -17,22 +17,22 @@ $$
|
||||
|
||||
符号:公式、化简、展开、求导、代入、求值、求解。
|
||||
|
||||
作图(库已提供):绘图 / 绘点列 / 绘圆锥,返回 SVG 文本。坐标轴带箭头与刻度;**默认显示网格**(`grid=假` 可关闭)。可选 path= 写盘。无 path 时 CLI 自动写 stem-plot-n.svg 并打印 plot: …;view 在 Execution 内嵌 SVG。
|
||||
作图(库已提供):绘图 / 绘点列 / 绘圆锥,返回 SVG 文本。坐标轴带箭头与刻度;*默认显示网格*(`grid=假` 可关闭)。可选 path= 写盘。无 path 时 CLI 自动写 stem-plot-n.svg 并打印 plot: …;view 在 Execution 内嵌 SVG。
|
||||
|
||||
求导 / 化简 / 展开 / 未完全数值化的代入仍返回 formula,可继续链式调用(例如求二阶导后再绘图或求值)。
|
||||
|
||||
*`ty` = > type `f`*
|
||||
**`ty` = > type `f`**
|
||||
|
||||
> print text=`ty`
|
||||
|
||||
*`df` = > 数学.求导 formula=`f` var="x"*
|
||||
**`df` = > 数学.求导 formula=`f` var="x"**
|
||||
|
||||
> print text=`df`
|
||||
|
||||
*`roots` = > 数学.求解 formula=`f` var="x"*
|
||||
**`roots` = > 数学.求解 formula=`f` var="x"**
|
||||
|
||||
> print text=`roots`
|
||||
|
||||
*`_svg` = > 数学.绘图 formula=`f` var="x" min=-3 max=3*
|
||||
**`_svg` = > 数学.绘图 formula=`f` var="x" min=-3 max=3**
|
||||
|
||||
> print text=plot-ok
|
||||
@@ -10,7 +10,7 @@ description: 沙箱内读写文本
|
||||
|
||||
裸路径字面量不要写斜杠(会被当成除法)。可用同目录文件名或变量。
|
||||
|
||||
*`ok` = > 文件.存在 路径="demo.txt"*
|
||||
**`ok` = > 文件.存在 路径="demo.txt"**
|
||||
|
||||
1. `ok`
|
||||
> 打印 内容=有演示文件
|
||||
|
||||
@@ -8,12 +8,12 @@ description: 去空白、拆分、拼接
|
||||
|
||||
导入 lib/文本.mq.md。函数:去空白(s)、拆分(s, sep)、拼接(xs, sep)。
|
||||
|
||||
*`t` = > 文本.去空白 s=" marqdo "*
|
||||
**`t` = > 文本.去空白 s=" marqdo "**
|
||||
|
||||
> 打印 内容=`t`
|
||||
|
||||
*`parts` = > 文本.拆分 s="甲,乙,丙" sep=","*
|
||||
**`parts` = > 文本.拆分 s="甲,乙,丙" sep=","**
|
||||
|
||||
*`j` = > 文本.拼接 xs=`parts` sep="-"*
|
||||
**`j` = > 文本.拼接 xs=`parts` sep="-"**
|
||||
|
||||
> 打印 内容=`j`
|
||||
@@ -8,11 +8,11 @@ description: Unix 时间、格式化、解析、睡眠
|
||||
|
||||
导入 lib/时间.mq.md。函数:此刻秒、此刻毫秒、格式化(秒, 格式)、解析时间(内容, 格式)、睡眠毫秒(毫秒)。格式为 strftime。
|
||||
|
||||
*`s` = > 时间.格式化 秒=0 格式="%Y-%m-%d"*
|
||||
**`s` = > 时间.格式化 秒=0 格式="%Y-%m-%d"**
|
||||
|
||||
> 打印 内容=`s`
|
||||
|
||||
*`u` = > 时间.解析时间 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"*
|
||||
**`u` = > 时间.解析时间 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"**
|
||||
|
||||
> 打印 内容=`u`
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ description: 环境变量、dotenv、工作目录、参数、退出、执行
|
||||
|
||||
导入 lib/系统.mq.md。函数:取环境、设环境、加载环境(可选路径)、参数表、工作目录、退出(码)、执行(命令)。加载环境不覆盖已有变量。view 下退出会软失败,不结束进程。
|
||||
|
||||
*`d` = > 系统.工作目录 *
|
||||
**`d` = > 系统.工作目录 **
|
||||
|
||||
*`n` = > 长度 值=`d` *
|
||||
**`n` = > 长度 值=`d` **
|
||||
|
||||
1. `n` > 0
|
||||
> 打印 内容=工作目录就绪
|
||||
|
||||
@@ -8,6 +8,6 @@ description: HTTP(S) 与地址编码
|
||||
|
||||
导入 lib/网络.mq.md。函数:获取(地址)、提交(地址, 内容;可选 content_type / headers)、编码地址(内容)。支持 HTTP 与 HTTPS(ureq)。
|
||||
|
||||
*`e` = > 网络.编码地址 内容="你好"*
|
||||
**`e` = > 网络.编码地址 内容="你好"**
|
||||
|
||||
> 打印 内容=`e`
|
||||
@@ -15,10 +15,10 @@ description: 行数与取行
|
||||
| 甲 |
|
||||
| 乙 |
|
||||
|
||||
*`n` = > 表.行数 xs=`xs`*
|
||||
**`n` = > 表.行数 xs=`xs`**
|
||||
|
||||
> 打印 内容=`n`
|
||||
|
||||
*`r` = > 表.取行 xs=`xs` i=0*
|
||||
**`r` = > 表.取行 xs=`xs` i=0**
|
||||
|
||||
> 打印 内容=`r`
|
||||
Reference in new issue
Block a user