Add module namespaces and harden L1/agent after the import redesign.
Bind imports to library names with bare path calls (and use), forward optional host args through mq wrappers, stabilize writeback replacement newlines, and document the M1/M2 decisions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
99132ac8fc
commit
1f23e2ed93
108 files changed
+3228
-1023
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` = > 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` = > exists path=demo.txt *
|
||||
*`ok` = > fs.exists path=demo.txt *
|
||||
|
||||
1. `ok`
|
||||
> print text=demo-present
|
||||
|
||||
@@ -8,12 +8,12 @@ description: Shared EN/ZH path; parse and stringify
|
||||
|
||||
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` = > parse text={} *
|
||||
*`obj` = > json.parse text={} *
|
||||
|
||||
*`ty` = > type `obj` *
|
||||
|
||||
> print text=`ty`
|
||||
|
||||
*`out` = > stringify value=`obj` *
|
||||
*`out` = > json.stringify value=`obj` *
|
||||
|
||||
> print text=`out`
|
||||
@@ -25,14 +25,14 @@ diff / simplify / expand / partial subs return formula values so you can chain (
|
||||
|
||||
> print text=`ty`
|
||||
|
||||
*`df` = > diff formula=`f` var=x *
|
||||
*`df` = > math.diff formula=`f` var=x *
|
||||
|
||||
> print text=`df`
|
||||
|
||||
*`roots` = > solve formula=`f` var=x *
|
||||
*`roots` = > math.solve formula=`f` var=x *
|
||||
|
||||
> print text=`roots`
|
||||
|
||||
*`_svg` = > 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 @@ description: Minimal HTTP(S) client and URL encode
|
||||
|
||||
Import lib/net.mq.md. Functions: http_get(url), http_post(url, body), http_request(method, url), url_encode(text). HTTPS and optional headers= map are supported. Default post content-type is JSON.
|
||||
|
||||
*`e` = > url_encode text=hello world *
|
||||
*`e` = > net.url_encode text=hello world *
|
||||
|
||||
> print text=`e`
|
||||
@@ -15,10 +15,10 @@ Import lib/table.mq.md. Functions: rows(xs), row_at(xs, i). Single-column Markdo
|
||||
| a |
|
||||
| b |
|
||||
|
||||
*`n` = > rows xs=`xs`*
|
||||
*`n` = > table.rows xs=`xs`*
|
||||
|
||||
> print text=`n`
|
||||
|
||||
*`r` = > row_at xs=`xs` i=0*
|
||||
*`r` = > table.row_at xs=`xs` i=0*
|
||||
|
||||
> print text=`r`
|
||||
@@ -8,12 +8,12 @@ description: Trim, split, join wrappers
|
||||
|
||||
Import lib/text.mq.md. Functions: str_trim(s), str_split(s, sep), str_join(xs, sep).
|
||||
|
||||
*`t` = > str_trim s= marqdo *
|
||||
*`t` = > text.str_trim s= marqdo *
|
||||
|
||||
> print text=`t`
|
||||
|
||||
*`parts` = > str_split s=a,b,c sep=,*
|
||||
*`parts` = > text.str_split s=a,b,c sep=,*
|
||||
|
||||
*`j` = > str_join xs=`parts` sep=-*
|
||||
*`j` = > text.str_join xs=`parts` sep=-*
|
||||
|
||||
> print text=`j`
|
||||
@@ -8,12 +8,12 @@ description: Unix time, format, parse, sleep
|
||||
|
||||
Import lib/time.mq.md. Functions: now_unix, now_ms, format(unix, pattern), parse(text, pattern), sleep_ms(ms). Patterns use strftime.
|
||||
|
||||
*`s` = > format unix=0 pattern=%Y-%m-%d *
|
||||
*`s` = > time.format unix=0 pattern=%Y-%m-%d *
|
||||
|
||||
> print text=`s`
|
||||
|
||||
*`u` = > 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`
|
||||
|
||||
> sleep_ms ms=0
|
||||
> time.sleep_ms ms=0
|
||||
@@ -15,6 +15,6 @@ print("hello-from-python")
|
||||
|
||||
默认命令可用 设置命令 或 MARQDO_FOREIGN_PYTHON 覆盖;live view 里可改命令框再点 Run。
|
||||
|
||||
*`out` = > 运行 代码=`hi` *
|
||||
*`out` = > 外联.运行 代码=`hi` *
|
||||
|
||||
> print text=`out`
|
||||
@@ -25,14 +25,14 @@ $$
|
||||
|
||||
> 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
|
||||
@@ -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,12 +8,12 @@ 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`
|
||||
|
||||
> 睡眠毫秒 毫秒=0
|
||||
> 时间.睡眠毫秒 毫秒=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