Refactor executable library handbooks and improve document reading
This commit is contained in:
1 parent
16c44588d5
commit
c50c515c4a
191 files changed
+29572
-7816
No files matched your search
@@ -22,6 +22,10 @@ Only this boundary imports lib/plugin, including through the Chinese facade.
|
||||
|
||||
## load
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | null after a successful load |
|
||||
|
||||
Locate the ABI v2 web shared library through plugin.native_path, then
|
||||
plugin.load it. If the library is missing, print a short install hint and exit
|
||||
non-zero so CI and agents fail loudly. After a successful load, later web star
|
||||
@@ -31,14 +35,10 @@ of each tool that needs the native server or renderer.
|
||||
|
||||
This tool takes no parameters.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | null after a successful load |
|
||||
|
||||
**p = > plugin.native_path name="web"**
|
||||
We retain **`p` = [Locate the installed native plugin](plugin.native_path(name="web"))**.
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
We **[Load the native plugin required by this operation](plugin.load(path=`p`))**.
|
||||
2. *
|
||||
> print text=ext/web: native web plugin not found (build plugins/web or marqdo ext add web)
|
||||
> sys.exit code=1
|
||||
****
|
||||
We **[Print the prepared message](print(text="ext/web: native web plugin not found (build plugins/web or marqdo ext add web)"))**.
|
||||
We **[End this run with the selected exit status](sys.exit(code=1))**.
|
||||
Return *None*.
|
||||
+46
-37
@@ -24,71 +24,80 @@ browser bridge tests and matching Chinese entry points.
|
||||
|
||||
## embed
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| bridge | text | bridge script URL |
|
||||
| wasm | text | wasm URL |
|
||||
| source | text | optional source URL |
|
||||
| boot | bool | auto boot |
|
||||
|
||||
HTML snippet that loads the official browser Marqdo bridge (route C/D). Defaults:
|
||||
`bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm",
|
||||
`source`="", `boot`=True . With boot and non-empty source, auto-mounts. No author
|
||||
JS. Not a substitute for file-partitioned Document layout.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| bridge | text | "/static/marqdo-bridge.js" | bridge script URL |
|
||||
| wasm | text | "/static/marqdo_wasm.wasm" | wasm URL |
|
||||
| source | text | "" | optional source URL |
|
||||
| boot | bool | True | auto boot |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | text | HTML script tag |
|
||||
|
||||
Use `bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm", `source`="", `boot`=True as the inputs for this operation.
|
||||
|
||||
HTML snippet that loads the official browser Marqdo bridge (route C/D). Defaults:
|
||||
|
||||
`bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm",
|
||||
|
||||
`source`="", `boot`=True . With boot and non-empty source, auto-mounts. No author
|
||||
JS. Not a substitute for file-partitioned Document layout.
|
||||
|
||||
1. `boot`
|
||||
1. `source` != ""
|
||||
*"<script type=\"module\" src=\"" + bridge + "\" data-mq-wasm=\"" + wasm + "\" data-mq-source-url=\"" + source + "\"></script>"*
|
||||
Return *"<script type=\"module\" src=\"" + bridge + "\" data-mq-wasm=\"" + wasm + "\" data-mq-source-url=\"" + source + "\"></script>"*.
|
||||
2. *
|
||||
*"<script type=\"module\" src=\"" + bridge + "\"></script>"*
|
||||
Return *"<script type=\"module\" src=\"" + bridge + "\"></script>"*.
|
||||
2. *
|
||||
*"<script type=\"module\" src=\"" + bridge + "\" data-mq-no-boot=\"1\"></script>"*
|
||||
Return *"<script type=\"module\" src=\"" + bridge + "\" data-mq-no-boot=\"1\"></script>"*.
|
||||
|
||||
## text_patch
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| sel | text | required | CSS selector |
|
||||
| text | text | required | text content |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| sel | text | CSS selector |
|
||||
| text | text | text content |
|
||||
| result | any | effects map |
|
||||
|
||||
Use `sel`, `text` as the inputs for this operation.
|
||||
|
||||
Build a `set_text` effects map for selector `sel` with string `text`. Prefer
|
||||
lib/browser in client .mq.md programs; this helper is for call-side sketches.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | effects map |
|
||||
|
||||
**`m` = > table.put in=None at=sel value=text**
|
||||
*> table.put in=None at="set_text" value=m*
|
||||
We retain **`m` = [Return the updated structured value](table.put(in=None, at=`sel`, value=`text`))**.
|
||||
Return *[Set the set_text field in the new record](table.put(in=None, at="set_text", value=`m`))*.
|
||||
|
||||
## dom_patch
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| sel | text | CSS selector |
|
||||
| html | text | optional HTML |
|
||||
| attrs | any | optional attrs map |
|
||||
| remove | bool | remove node |
|
||||
|
||||
Build a `dom` effects map for selector `sel`. Optional `html`="", `attrs`=None,
|
||||
`remove`=False . Prefer View/Markdown over raw html patches for page shells.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| sel | text | required | CSS selector |
|
||||
| html | text | "" | optional HTML |
|
||||
| attrs | any | None | optional attrs map |
|
||||
| remove | bool | False | remove node |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | effects map |
|
||||
|
||||
**`spec` = > table.put in=None at="html" value=html**
|
||||
Use `sel`, `html`="", `attrs`=None, `remove`=False as the inputs for this operation.
|
||||
|
||||
Build a `dom` effects map for selector `sel`. Optional `html`="", `attrs`=None,
|
||||
|
||||
`remove`=False . Prefer View/Markdown over raw html patches for page shells.
|
||||
|
||||
We retain **`spec` = [Set the html field in the new record](table.put(in=None, at="html", value=`html`))**.
|
||||
1. `attrs`
|
||||
**`spec` = > table.put in=`spec` at="attrs" value=attrs**
|
||||
We retain **`spec` = [Set the attrs field in the new record](table.put(in=`spec`, at="attrs", value=`attrs`))**.
|
||||
2. *
|
||||
**_ = 1**
|
||||
1. `remove`
|
||||
**`spec` = > table.put in=`spec` at="remove" value=True**
|
||||
We retain **`spec` = [Set the remove field in the new record](table.put(in=`spec`, at="remove", value=True))**.
|
||||
2. *
|
||||
**_ = 1**
|
||||
**`m` = > table.put in=None at=sel value=spec**
|
||||
*> table.put in=None at="dom" value=m*
|
||||
We retain **`m` = [Return the updated structured value](table.put(in=None, at=`sel`, value=`spec`))**.
|
||||
Return *[Set the dom field in the new record](table.put(in=None, at="dom", value=`m`))*.
|
||||
@@ -32,50 +32,56 @@ Never put rendered HTML strings in parent value cells to simulate nesting.
|
||||
|
||||
## nodes
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| table | any | View table |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| table | any | required | View table |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Result |
|
||||
| result | any | The supplied View table unchanged, preserving its original list or column-table shape |
|
||||
|
||||
Use `table` as the inputs for this operation.
|
||||
|
||||
Return View `table` unchanged. This preserves the existing identity helper for
|
||||
column tables as well as record lists. Prefer @ record lists for reusable
|
||||
components, because list composition can retain typed nested value cells.
|
||||
|
||||
*table*
|
||||
Return *table*.
|
||||
|
||||
## merge
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| a | list | First node record list |
|
||||
| b | list | Second node record list |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| a | list | required | First node record list |
|
||||
| b | list | required | Second node record list |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | Ordered sibling rows |
|
||||
|
||||
Use `a`, `b` as the inputs for this operation.
|
||||
|
||||
Concatenate `a` and `b` without rendering or flattening child containers.
|
||||
Both inputs must be lists of View rows, normally @ record tables. To place
|
||||
two components side by side, concatenate their wrapped columns then use
|
||||
layout.columns; concatenation alone only establishes sibling order.
|
||||
|
||||
*> table.concat a=`a` b=`b`*
|
||||
Return *[Concat](table.concat(a=`a`, b=`b`))*.
|
||||
|
||||
## markdown
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| text | text | Plain Markdown content |
|
||||
| slot | text | Stable component name |
|
||||
| style | text | Optional class name |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| text | text | required | Plain Markdown content |
|
||||
| slot | text | "" | Stable component name |
|
||||
| style | text | "" | Optional class name |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | One Markdown leaf |
|
||||
|
||||
Use `text`, `slot`="", `style`="" as the inputs for this operation.
|
||||
|
||||
Make a leaf from Markdown `text`. Default `slot`="" and `style`="" keep
|
||||
content independent of placement and theme. The returned list contains one
|
||||
markdown row; the runtime renders headings, links, lists and tables. No native
|
||||
@@ -87,21 +93,23 @@ plugin is loaded here, and no HTML is inserted into the authored component.
|
||||
|---|------|------|-------|-------|-------|
|
||||
| 1 | markdown | `slot` | `text` | "" | `style` |
|
||||
|
||||
*nodes*
|
||||
Return *nodes*.
|
||||
|
||||
## wrap
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| children | list | Child node records |
|
||||
| kind | text | Container kind |
|
||||
| slot | text | Stable region name |
|
||||
| style | text | Optional class name |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| children | list | required | Child node records |
|
||||
| kind | text | "column" | Container kind |
|
||||
| slot | text | "" | Stable region name |
|
||||
| style | text | "" | Optional class name |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | One parent containing its child rows |
|
||||
|
||||
Use `children`, `kind`="column", `slot`="", `style`="" as the inputs for this operation.
|
||||
|
||||
Wrap `children` in one structural row. Default `kind`="column", `slot`=""
|
||||
and `style`="" . Use row or column for geometry, nav/header/footer/section/aside
|
||||
for a semantic region. The value cell holds the child list itself, not rendered
|
||||
@@ -114,4 +122,4 @@ this pure constructor does not claim to validate a full site.
|
||||
|---|------|------|-------|-------|-------|
|
||||
| 1 | `kind` | `slot` | `children` | "" | `style` |
|
||||
|
||||
*nodes*
|
||||
Return *nodes*.
|
||||
+35
-29
@@ -24,42 +24,52 @@ raw path; do not use raw to compensate for missing decomposition.
|
||||
|
||||
## from_markdown
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| text | text | Markdown source |
|
||||
|
||||
Turn Markdown `text` into a simple DOM map `{kind:"markdown", text}` for
|
||||
`page.render` / `web.render`. This is the default body path for Document prose.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| text | text | required | Markdown source |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | DOM map |
|
||||
|
||||
**`out` = > table.put in=None at="kind" value="markdown"**
|
||||
*> table.put in=`out` at="text" value=text*
|
||||
Use `text` as the inputs for this operation.
|
||||
|
||||
Turn Markdown `text` into a simple DOM map `{kind:"markdown", text}` for
|
||||
`page.render` / `web.render`. This is the default body path for Document prose.
|
||||
|
||||
We retain **`out` = [Set the kind field in the new record](table.put(in=None, at="kind", value="markdown"))**.
|
||||
Return *[Set the text field in the new record](table.put(in=`out`, at="text", value=`text`))*.
|
||||
|
||||
## raw
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| html | text | raw HTML (escape hatch) |
|
||||
|
||||
Escape hatch — wrap raw `html`. Prefer Markdown / View nodes. Allowed only when
|
||||
table-driven layout cannot express a host constraint; document the why next to
|
||||
the call. Forbidden as the primary implementation of nav/sidebar/footer/home.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| html | text | required | raw HTML (escape hatch) |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | DOM map kind=raw |
|
||||
|
||||
**`out` = > table.put in=None at="kind" value="raw"**
|
||||
*> table.put in=`out` at="html" value=html*
|
||||
Use `html` as the inputs for this operation.
|
||||
|
||||
Escape hatch — wrap raw `html`. Prefer Markdown / View nodes. Allowed only when
|
||||
table-driven layout cannot express a host constraint; document the why next to
|
||||
the call. Forbidden as the primary implementation of nav/sidebar/footer/home.
|
||||
|
||||
We retain **`out` = [Set the kind field in the new record](table.put(in=None, at="kind", value="raw"))**.
|
||||
Return *[Set the html field in the new record](table.put(in=`out`, at="html", value=`html`))*.
|
||||
|
||||
## render
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| dom | any | required | DOM map from from_markdown or raw |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| dom | any | DOM map from from_markdown or raw |
|
||||
| result | any | HTML text |
|
||||
|
||||
Use `dom` as the inputs for this operation.
|
||||
|
||||
Render DOM Artifact `dom` (from from_markdown or raw) to HTML via the native
|
||||
plugin. When kind is markdown,
|
||||
@@ -69,15 +79,11 @@ escape hatch documented on raw, not for assembling a full site shell. Prefer
|
||||
feeding markdown DOM produced by from_markdown, or skip this helper and use
|
||||
page.render / web.render on View tables from file-partitioned components.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML text |
|
||||
|
||||
> cap.load
|
||||
**kind = [kind](access(dom, "kind"))**
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
We retain **`kind` = [Read kind field](access(`dom`, "kind"))**.
|
||||
1. `kind` == "raw"
|
||||
**html = [html](access(dom, "html"))**
|
||||
*html*
|
||||
We retain **`html` = [Read html field](access(`dom`, "html"))**.
|
||||
Return *html*.
|
||||
2. *
|
||||
**text = [text](access(dom, "text"))**
|
||||
*> web_dom_markdown text=`text`*
|
||||
We retain **`text` = [Read text field](access(`dom`, "text"))**.
|
||||
Return *[Render DOM Artifact dom (from from_markdown or raw) to HTML via the native plugin](web_dom_markdown(text=`text`))*.
|
||||
+18
-12
@@ -182,6 +182,8 @@ Return the workflow and stopping rule without creating files or claiming to
|
||||
accept a particular site. Define the region tree, author parents and Markdown
|
||||
leaves, then start and test the declared HTTP surface.
|
||||
|
||||
The returned rows are a planning aid, not a generated site or a validation certificate. Start with the component tree, give each parent one placement decision, then write the leaves as ordinary Markdown. Declare request-time handlers separately from startup assembly. Preview the composed result before starting the server, and compare real routes and narrow-screen geometry against that same source tree.
|
||||
|
||||
`workflow` =
|
||||
|
||||
| key | value |
|
||||
@@ -196,7 +198,7 @@ leaves, then start and test the declared HTTP surface.
|
||||
| step_G | compare preview and live output; test routes and browser geometry |
|
||||
| stopping_rule | one Markdown responsibility and no internal layout |
|
||||
|
||||
*workflow*
|
||||
Return *workflow*.
|
||||
|
||||
## layout_rules
|
||||
|
||||
@@ -208,40 +210,44 @@ Reuse the layout module convention without a second rule catalog. No
|
||||
parameters or plugin. Actual acceptance still inspects leaf responsibilities,
|
||||
parent relationships and the running result.
|
||||
|
||||
*> layout.rules*
|
||||
Return *[Rules](layout.rules())*.
|
||||
|
||||
## preview_markdown
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| body | text | Markdown content |
|
||||
| title | text | Document title |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| body | text | "" | Markdown content |
|
||||
| title | text | "Preview" | Document title |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | text | HTML document |
|
||||
|
||||
Use `body`="", `title`="Preview" as the inputs for this operation.
|
||||
|
||||
Render Markdown `body`="" with default `title`="Preview" .
|
||||
Return HTML text without writing files or registering routes. For a complex
|
||||
page split the layout first; raw HTML strings are not the content strategy.
|
||||
This tool needs the native plugin.
|
||||
|
||||
*> web.render body=`body` title=`title`*
|
||||
Return *[Render](web.render(body=`body`, title=`title`))*.
|
||||
|
||||
## preview_nodes
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| nodes | list | Nested View rows |
|
||||
| title | text | Document title |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| nodes | list | required | Nested View rows |
|
||||
| title | text | "Preview" | Document title |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | text | HTML document |
|
||||
|
||||
Use `nodes`, `title`="Preview" as the inputs for this operation.
|
||||
|
||||
Render decomposed `nodes` with default `title`="Preview" .
|
||||
Parent values retain child rows, while leaf values hold Markdown. Returning
|
||||
HTML starts no server. The same renderer serves composed Documents, so this
|
||||
preview checks that column relationships survive assembly.
|
||||
|
||||
*> web.render nodes=`nodes` title=`title`*
|
||||
Return *[Render](web.render(nodes=`nodes`, title=`title`))*.
|
||||
+38
-26
@@ -37,12 +37,14 @@ plugins/web/internal/artifact with bilingual helpers and web_handbook tests.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Result |
|
||||
| result | any | Column table with aligned key/value lists describing layout rules; no source inspection |
|
||||
|
||||
Return the engineering convention and stopping rule. No parameters or plugin.
|
||||
This is guidance rather than evidence that a particular source file passes;
|
||||
acceptance also requires reading the leaves and exercising the resulting page.
|
||||
|
||||
Apply the stopping rule to responsibilities rather than file size. A footer with two independent groups still needs child regions even if its text is short. A leaf containing several ordinary paragraphs may remain one Markdown responsibility when it needs no internal geometry. The parent imports those children and places them; the renderer supplies the resulting container structure. This table records that convention but does not inspect your files or certify that a layout works.
|
||||
|
||||
`out` =
|
||||
|
||||
| key | value |
|
||||
@@ -56,7 +58,7 @@ acceptance also requires reading the leaves and exercising the resulting page.
|
||||
| geometry | merge gives siblings; stack and columns give placement |
|
||||
| verify | offline render; live routes; narrow and wide browser geometry |
|
||||
|
||||
*out*
|
||||
Return *out*.
|
||||
|
||||
## view_schema
|
||||
|
||||
@@ -78,73 +80,83 @@ layout within one representation instead of adding a private fragment dialect.
|
||||
| attrs |
|
||||
| style |
|
||||
|
||||
*cols*
|
||||
Return *cols*.
|
||||
|
||||
## merge_nodes
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| a | list | First node records |
|
||||
| b | list | Second node records |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| a | list | required | First node records |
|
||||
| b | list | required | Second node records |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | Ordered sibling nodes |
|
||||
|
||||
Use `a`, `b` as the inputs for this operation.
|
||||
|
||||
Concatenate `a` and `b` as siblings. This helper preserves structure and order
|
||||
but does not imply geometry; use columns for side-by-side placement or stack
|
||||
for a vertical page. The @ record lists retain nested values throughout.
|
||||
|
||||
*> component.merge a=`a` b=`b`*
|
||||
Return *[Merge](component.merge(a=`a`, b=`b`))*.
|
||||
|
||||
## stack
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| children | list | Child component records |
|
||||
| slot | text | Parent region name |
|
||||
| style | text | Optional class name |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| children | list | required | Child component records |
|
||||
| slot | text | "" | Parent region name |
|
||||
| style | text | "" | Optional class name |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | Parent container rows |
|
||||
|
||||
Use `children`, `slot`="", `style`="" as the inputs for this operation.
|
||||
|
||||
Declare one vertical relationship for `children`. Default `slot`="" and
|
||||
|
||||
`style`="" . The parent owns placement while each imported child owns content
|
||||
or its next decomposition level. Return View rows so another parent can wrap
|
||||
them without first serializing any HTML.
|
||||
|
||||
*> component.wrap children=`children` kind="column" slot=`slot` style=`style`*
|
||||
Return *[Wrap](component.wrap(children=`children`, kind="column", slot=`slot`, style=`style`))*.
|
||||
|
||||
## columns
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| children | list | Child component records |
|
||||
| slot | text | Parent region name |
|
||||
| style | text | Optional class name |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| children | list | required | Child component records |
|
||||
| slot | text | "" | Parent region name |
|
||||
| style | text | "" | Optional class name |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | Parent container rows |
|
||||
|
||||
Use `children`, `slot`="", `style`="" as the inputs for this operation.
|
||||
|
||||
Declare one responsive multi-column relationship for `children`. Default `slot`="" and
|
||||
|
||||
`style`="" . The parent owns placement while each imported child owns content
|
||||
or its next decomposition level. Return View rows so another parent can wrap
|
||||
them without first serializing any HTML.
|
||||
|
||||
*> component.wrap children=`children` kind="row" slot=`slot` style=`style`*
|
||||
Return *[Wrap](component.wrap(children=`children`, kind="row", slot=`slot`, style=`style`))*.
|
||||
|
||||
## accept_component
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| name | text | Component name |
|
||||
| duty | text | One responsibility |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| name | text | required | Component name |
|
||||
| duty | text | required | One responsibility |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Result |
|
||||
| result | any | Checklist record with status, name, duty and check; it does not certify a component |
|
||||
|
||||
Use `name`, `duty` as the inputs for this operation.
|
||||
|
||||
Return a review checklist for component `name` and stated `duty`. Two strings
|
||||
cannot establish source quality or a working layout, so this tool does not
|
||||
@@ -157,4 +169,4 @@ before accepting the component. It never writes or scans files.
|
||||
|--------|------|------|-------|
|
||||
| checklist | `name` | `duty` | one Markdown leaf or one parent relationship; no raw HTML shell |
|
||||
|
||||
*row*
|
||||
Return *row*.
|
||||
+84
-75
@@ -26,45 +26,57 @@ preserve tests/ext/web-artifact-render-smoke.mq.md and the handbook tests.
|
||||
|
||||
## new
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| title | text | document title |
|
||||
| route | text | path |
|
||||
| method | text | HTTP method |
|
||||
| body | text | Markdown body |
|
||||
| nodes | any | View table or None |
|
||||
| data_source | text | table name |
|
||||
| data_order | text | order key |
|
||||
| data_where | text | filters |
|
||||
|
||||
Construct a Document handle with `title`="", `route`="/", `method`="GET",
|
||||
`body`="", optional View `nodes`=None, and flat `data_source`="", `data_order`="",
|
||||
`data_where`="" keys. Prefer Artifact discovery via serve for production pages;
|
||||
use this tool for previews and stepwise agent sessions. nodes must be the
|
||||
unified View schema, never a private dialect or an HTML string shell.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| title | text | "" | document title |
|
||||
| route | text | "/" | path |
|
||||
| method | text | "GET" | HTTP method |
|
||||
| body | text | "" | Markdown body |
|
||||
| nodes | any | None | View table or None |
|
||||
| data_source | text | "" | table name |
|
||||
| data_order | text | "" | order key |
|
||||
| data_where | text | "" | filters |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | page handle |
|
||||
|
||||
> cap.load
|
||||
Use `title`="", `route`="/", `method`="GET", `body`="", `nodes`=None, `data_source`="", `data_order`="", `data_where`="" as the inputs for this operation.
|
||||
|
||||
Construct a Document handle with `title`="", `route`="/", `method`="GET",
|
||||
|
||||
`body`="", optional View `nodes`=None, and flat `data_source`="", `data_order`="",
|
||||
|
||||
`data_where`="" keys. Prefer Artifact discovery via serve for production pages;
|
||||
use this tool for previews and stepwise agent sessions. nodes must be the
|
||||
unified View schema, never a private dialect or an HTML string shell.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
|
||||
`out` =
|
||||
|
||||
| _type | title | route | method | body | nodes | data_source | data_order | data_where |
|
||||
|-------|-------|-------|--------|------|-------|-------------|------------|------------|
|
||||
| page | `title` | `route` | `method` | `body` | `nodes` | `data_source` | `data_order` | `data_where` |
|
||||
|
||||
*out*
|
||||
Return *out*.
|
||||
|
||||
## render
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| page | any | required | Document handle |
|
||||
| nodes | any | None | View table or None |
|
||||
| db | any | None | optional database handle |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| page | any | Document handle |
|
||||
| nodes | any | View table or None |
|
||||
| db | any | optional database handle |
|
||||
| result | any | HTML or render payload |
|
||||
|
||||
Use `page`, `nodes`=None, `db`=None as the inputs for this operation.
|
||||
|
||||
Render Document handle `page` to HTML for preview or response. Optional
|
||||
|
||||
`nodes`=None is the unified View table; when None, uses the page's own nodes or
|
||||
Markdown body. Optional `db`=None is retained for facade compatibility. This offline renderer
|
||||
does not populate data_source; automatic row binding belongs to served ordinary
|
||||
@@ -74,64 +86,65 @@ handmade HTML string as the page shell. This is the sole compose path (ADR
|
||||
0007); there is no compose_main or fragment DSL. Agents should call this free
|
||||
tool (not a method chain) under `--effects plugin`.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML or render payload |
|
||||
|
||||
> cap.load
|
||||
**n = nodes**
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
We retain **n = nodes**.
|
||||
1. `n` == None
|
||||
**n = [nodes](access(page, "nodes"))**
|
||||
We retain **`n` = [Read nodes field](access(`page`, "nodes"))**.
|
||||
2. *
|
||||
**_ = 1**
|
||||
**title = [title](access(page, "title"))**
|
||||
We retain **`title` = [Read title field](access(`page`, "title"))**.
|
||||
1. `n`
|
||||
*> web_render_nodes page=`page` nodes=`n` db=`db` title=`title`*
|
||||
Return *[Render Document handle page to HTML for preview or response](web_render_nodes(page=`page`, nodes=`n`, db=`db`, title=`title`))*.
|
||||
2. *
|
||||
**body = [body](access(page, "body"))**
|
||||
*> web_render_document page=`page` body=`body` db=`db` title=`title`*
|
||||
We retain **`body` = [Read body field](access(`page`, "body"))**.
|
||||
Return *[Render Document handle page to HTML for preview or response](web_render_document(page=`page`, body=`body`, db=`db`, title=`title`))*.
|
||||
|
||||
# page
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| title | any | See prose default / 见叙述默认值 |
|
||||
| route | any | See prose default / 见叙述默认值 |
|
||||
| method | any | See prose default / 见叙述默认值 |
|
||||
| body | any | See prose default / 见叙述默认值 |
|
||||
| nodes | any | See prose default / 见叙述默认值 |
|
||||
| data_source | any | See prose default / 见叙述默认值 |
|
||||
| data_order | any | See prose default / 见叙述默认值 |
|
||||
| data_where | any | See prose default / 见叙述默认值 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| title | any | "" | Document title used by preview and page rendering |
|
||||
| route | any | "/" | Declared URL path at which this Document may be mounted |
|
||||
| method | any | "GET" | HTTP request method for the declared route |
|
||||
| body | any | "" | Markdown document content; complex sites use recursively split components |
|
||||
| nodes | any | None | Nested View records, or None to retain document-body rendering |
|
||||
| data_source | any | "" | Document data source declaration; empty means no automatic source |
|
||||
| data_order | any | "" | Ordering declaration for the selected document data source |
|
||||
| data_where | any | "" | Filter declaration for the selected document data source |
|
||||
|
||||
Inputs: `title`="", `route`="/", `method`="GET", `body`="", `nodes`=None, `data_source`="", `data_order`="", `data_where`=""
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Document handle retaining title, route, method, body, nodes and data declarations |
|
||||
|
||||
Use `title`="", `route`="/", `method`="GET", `body`="", `nodes`=None, `data_source`="", `data_order`="", `data_where`="" as the inputs for this operation.
|
||||
|
||||
Web Document handle for author method chains. Prefer constructing from Artifact
|
||||
Metadata via `web.page` facade or the free `new` tool above. View tables use
|
||||
only `|type|slot|value|attrs|style|` (ZH `|类型|槽|值|属性|样式|`). Do not pass a
|
||||
raw HTML string as the primary `body` for a full site shell.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Constructed value / 构造结果 |
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
|
||||
> cap.load
|
||||
`out` =
|
||||
|
||||
| _type | title | route | method | body | nodes | data_source | data_order | data_where |
|
||||
|-------|-------|-------|--------|------|-------|-------------|------------|------------|
|
||||
| page | `title` | `route` | `method` | `body` | `nodes` | `data_source` | `data_order` | `data_where` |
|
||||
|
||||
*out*
|
||||
Return *out*.
|
||||
|
||||
## render
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| nodes | any | View table or None |
|
||||
| db | any | optional database handle |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| nodes | any | None | View table or None |
|
||||
| db | any | None | optional database handle |
|
||||
|
||||
Inputs: `nodes`=None, `db`=None
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML or render payload |
|
||||
|
||||
Use `nodes`=None, `db`=None as the inputs for this operation.
|
||||
|
||||
Render this Document to HTML for preview or response. Optional `nodes` is the
|
||||
unified View table (type/slot/value/attrs/style). When `nodes` is None, the
|
||||
@@ -141,39 +154,35 @@ file-partitioned components via component.merge — do not pass a handmade HTML
|
||||
string as the page shell. This is the sole compose path (ADR 0007); there is no
|
||||
compose_main or fragment DSL.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML or render payload |
|
||||
|
||||
> cap.load
|
||||
**n = nodes**
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
We retain **n = nodes**.
|
||||
1. `n` == None
|
||||
**n = [nodes](access(self, "nodes"))**
|
||||
We retain **`n` = [Read nodes field](access(`self`, "nodes"))**.
|
||||
2. *
|
||||
**_ = 1**
|
||||
**title = [title](access(self, "title"))**
|
||||
We retain **`title` = [Read title field](access(`self`, "title"))**.
|
||||
1. `n`
|
||||
*> web_render_nodes page=`self` nodes=`n` db=`db` title=`title`*
|
||||
Return *[Render this Document to HTML for preview or response](web_render_nodes(page=`self`, nodes=`n`, db=`db`, title=`title`))*.
|
||||
2. *
|
||||
**body = [body](access(self, "body"))**
|
||||
*> web_render_document page=`self` body=`body` db=`db` title=`title`*
|
||||
We retain **`body` = [Read body field](access(`self`, "body"))**.
|
||||
Return *[Render this Document to HTML for preview or response](web_render_document(page=`self`, body=`body`, db=`db`, title=`title`))*.
|
||||
|
||||
## css
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| css | text | raw CSS (escape hatch) |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| css | text | required | raw CSS (escape hatch) |
|
||||
|
||||
Inputs: `css`
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | updated page handle |
|
||||
|
||||
Use `css` as the inputs for this operation.
|
||||
|
||||
Escape hatch — append raw CSS string `css` to this page. Named style tables and
|
||||
the View style column remain the default theme path. Use this only when a host
|
||||
constraint cannot be expressed as a named style row, and write that reason next
|
||||
to the call. Forbidden as the primary way to style nav, sidebar, or footer.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | updated page handle |
|
||||
|
||||
> cap.load
|
||||
*> web_page_css page=`self` css=`css`*
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Escape hatch — append raw CSS string css to this page](web_page_css(page=`self`, css=`css`))*.
|
||||
+111
-101
@@ -25,44 +25,55 @@ changes; never introduce undeclared user URLs as a hidden convenience.
|
||||
|
||||
## new
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| app | any | app handle |
|
||||
| path | text | URL path |
|
||||
| method | text | HTTP method |
|
||||
| page | any | Document or None |
|
||||
| fn | text | endpoint member |
|
||||
| request | text | request kind |
|
||||
| response | text | response kind |
|
||||
| auth | text | auth tag |
|
||||
| class | text | route class |
|
||||
|
||||
Build a declared route handle for `app` at `path` with `method`="GET" .
|
||||
`page`=None holds a Document; `fn`="" names an Endpoint lib.member.
|
||||
`request`="json", `response`="json", `auth`="", and `class`="" document the
|
||||
contract. Optional class values: execute, short, read, control (empty →
|
||||
heuristic / legacy_serial). This tool does not register yet — call `register`
|
||||
or use the facade `web.route` which registers in one step.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | app handle |
|
||||
| path | text | required | URL path |
|
||||
| method | text | "GET" | HTTP method |
|
||||
| page | any | None | Document or None |
|
||||
| fn | text | "" | endpoint member |
|
||||
| request | text | "json" | request kind |
|
||||
| response | text | "json" | response kind |
|
||||
| auth | text | "" | auth tag |
|
||||
| class | text | "" | route class |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | route handle |
|
||||
|
||||
> cap.load
|
||||
Use `app`, `path`, `method`="GET", `page`=None, `fn`="", `request`="json", `response`="json", `auth`="", `class`="" as the inputs for this operation.
|
||||
|
||||
Build a declared route handle for `app` at `path` with `method`="GET" .
|
||||
|
||||
`page`=None holds a Document; `fn`="" names an Endpoint lib.member.
|
||||
|
||||
`request`="json", `response`="json", `auth`="", and `class`="" document the
|
||||
contract. Optional class values: execute, short, read, control (empty →
|
||||
heuristic / legacy_serial). This tool does not register yet — call `register`
|
||||
or use the facade `web.route` which registers in one step.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
|
||||
`out` =
|
||||
|
||||
| _type | app | path | method | page | fn | request | response | auth | class |
|
||||
|-------|-----|------|--------|------|----|---------|----------|------|-------|
|
||||
| route | `app` | `path` | `method` | `page` | `fn` | `request` | `response` | `auth` | `class` |
|
||||
|
||||
*out*
|
||||
Return *out*.
|
||||
|
||||
## register
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| route | any | required | route handle |
|
||||
| app | any | None | app or None |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| route | any | route handle |
|
||||
| app | any | app or None |
|
||||
| result | any | registration result |
|
||||
|
||||
Use `route`, `app`=None as the inputs for this operation.
|
||||
|
||||
Register declared route handle `route` on an app. Optional `app`=None falls back
|
||||
to the app stored on the route object so stepwise agent sessions can omit it.
|
||||
@@ -73,108 +84,111 @@ free tool under `--effects plugin` rather than a method chain when driving
|
||||
registration from `marqdo call`. Soft-fails with ok=False when neither page nor
|
||||
fn is present, so callers can detect incomplete declarations early.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | registration result |
|
||||
|
||||
> cap.load
|
||||
**a = app**
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
We retain **a = app**.
|
||||
1. `a` == None
|
||||
**a = [app](access(route, "app"))**
|
||||
We retain **`a` = [Read app field](access(`route`, "app"))**.
|
||||
2. *
|
||||
**_ = 1**
|
||||
**page = [page](access(route, "page"))**
|
||||
**fn = [fn](access(route, "fn"))**
|
||||
We retain **`page` = [Read page field](access(`route`, "page"))**.
|
||||
We retain **`fn` = [Read fn field](access(`route`, "fn"))**.
|
||||
1. `page`
|
||||
**path = [path](access(route, "path"))**
|
||||
*> web_app_route app=`a` path=`path` page=`page`*
|
||||
We retain **`path` = [Read path field](access(`route`, "path"))**.
|
||||
Return *[Register declared route handle route on an app](web_app_route(app=`a`, path=`path`, page=`page`))*.
|
||||
2. `fn`
|
||||
**path = [path](access(route, "path"))**
|
||||
**method = [method](access(route, "method"))**
|
||||
**request = [request](access(route, "request"))**
|
||||
**response = [response](access(route, "response"))**
|
||||
**class = [class](access(route, "class"))**
|
||||
*> web_app_invoke app=`a` path=`path` method=`method` fn=`fn` body=`request` return=`response` class=`class`*
|
||||
We retain **`path` = [Read path field](access(`route`, "path"))**.
|
||||
We retain **`method` = [Read method field](access(`route`, "method"))**.
|
||||
We retain **`request` = [Read request field](access(`route`, "request"))**.
|
||||
We retain **`response` = [Read response field](access(`route`, "response"))**.
|
||||
We retain **`class` = [Read class field](access(`route`, "class"))**.
|
||||
Return *[Register declared route handle route on an app](web_app_invoke(app=`a`, path=`path`, method=`method`, fn=`fn`, body=`request`, return=`response`, class=`class`))*.
|
||||
3. *
|
||||
*> table.put in=None at="ok" value=False*
|
||||
Return *[Set the ok field in the new record](table.put(in=None, at="ok", value=False))*.
|
||||
|
||||
## use
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| route | any | route handle |
|
||||
| middleware | any | middleware table |
|
||||
|
||||
Attach middleware table `middleware` to declared route handle `route`
|
||||
(`|header|value|` or named capability rows). Prefer first-class middleware tables
|
||||
over configure junk drawers. Call this free tool with `--effects plugin`.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| middleware | any | required | middleware table |
|
||||
| route | any | required | route handle |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | use result |
|
||||
|
||||
> cap.load
|
||||
*> web_route_use route=`route` middleware=`middleware`*
|
||||
Use `middleware`, `route` as the inputs for this operation.
|
||||
|
||||
Attach middleware table `middleware` to declared route handle `route`
|
||||
(`|header|value|` or named capability rows). Prefer first-class middleware tables
|
||||
over configure junk drawers. Call this free tool with `--effects plugin`.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Attach middleware table middleware to declared route handle route (|header|value| or named capability rows)](web_route_use(route=`route`, middleware=`middleware`))*.
|
||||
|
||||
# route
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| app | any | See prose default / 见叙述默认值 |
|
||||
| path | any | See prose default / 见叙述默认值 |
|
||||
| method | any | See prose default / 见叙述默认值 |
|
||||
| page | any | See prose default / 见叙述默认值 |
|
||||
| fn | any | See prose default / 见叙述默认值 |
|
||||
| request | any | See prose default / 见叙述默认值 |
|
||||
| response | any | See prose default / 见叙述默认值 |
|
||||
| auth | any | See prose default / 见叙述默认值 |
|
||||
| class | any | See prose default / 见叙述默认值 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | Application handle created by the public web app constructor |
|
||||
| path | any | required | URL path declared for this route |
|
||||
| method | any | "GET" | HTTP request method for the declared route |
|
||||
| page | any | None | Initial Document/page resource, or None for explicit later route mounts |
|
||||
| fn | any | "" | Endpoint member path; empty when mounting a Document page |
|
||||
| request | any | "json" | Request body format passed to the native Endpoint dispatcher |
|
||||
| response | any | "json" | Response format passed to the native Endpoint dispatcher |
|
||||
| auth | any | "" | Explicit route authentication policy label |
|
||||
| class | any | "" | Execution class: execute, short, read or control; empty keeps native heuristics |
|
||||
|
||||
Inputs: `app`, `path`, `method`="GET", `page`=None, `fn`="", `request`="json", `response`="json", `auth`="", `class`=""
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Declared route handle retaining app, path, method, page or endpoint and dispatch fields |
|
||||
|
||||
Use `app`, `path`, `method`="GET", `page`=None, `fn`="", `request`="json", `response`="json", `auth`="", `class`="" as the inputs for this operation.
|
||||
|
||||
Declared route handle for author method chains. Prefer `web.route` / Artifact
|
||||
`type: endpoint` discovery via `web.serve`. Optional `class`: `execute` |
|
||||
`short` | `read` | `control` (empty → heuristic / `legacy_serial`).
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Constructed value / 构造结果 |
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
|
||||
> cap.load
|
||||
`out` =
|
||||
|
||||
| _type | app | path | method | page | fn | request | response | auth | class |
|
||||
|-------|-----|------|--------|------|----|---------|----------|------|-------|
|
||||
| route | `app` | `path` | `method` | `page` | `fn` | `request` | `response` | `auth` | `class` |
|
||||
|
||||
*out*
|
||||
Return *out*.
|
||||
|
||||
## use
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| middleware | any | middleware table |
|
||||
|
||||
Inputs: `middleware`
|
||||
|
||||
Attach middleware table to this route (`|header|value|` or named capability
|
||||
rows). Prefer explicit tables authors can read; do not restore a configure bag
|
||||
for headers and cors.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| middleware | any | required | middleware table |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | use result |
|
||||
|
||||
> cap.load
|
||||
*> web_route_use route=`self` middleware=`middleware`*
|
||||
Use `middleware` as the inputs for this operation.
|
||||
|
||||
Attach middleware table to this route (`|header|value|` or named capability
|
||||
rows). Prefer explicit tables authors can read; do not restore a configure bag
|
||||
for headers and cors.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Attach middleware table to this route (|header|value| or named capability rows)](web_route_use(route=`self`, middleware=`middleware`))*.
|
||||
|
||||
## register
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| app | any | app or None |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | None | app or None |
|
||||
|
||||
Inputs: `app`=None
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | registration result |
|
||||
|
||||
Use `app`=None as the inputs for this operation.
|
||||
|
||||
Register this declared route on an app handle. When optional `app` is None, use
|
||||
the app stored on this route object so author chains can omit the argument after
|
||||
@@ -187,27 +201,23 @@ page nor fn is set, so callers can detect an incomplete declaration without a
|
||||
hard crash. Never invents an undeclared path — registration only publishes what
|
||||
this handle already carries.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | registration result |
|
||||
|
||||
> cap.load
|
||||
**a = app**
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
We retain **a = app**.
|
||||
1. `a` == None
|
||||
**a = [app](access(self, "app"))**
|
||||
We retain **`a` = [Read app field](access(`self`, "app"))**.
|
||||
2. *
|
||||
**_ = 1**
|
||||
**page = [page](access(self, "page"))**
|
||||
**fn = [fn](access(self, "fn"))**
|
||||
We retain **`page` = [Read page field](access(`self`, "page"))**.
|
||||
We retain **`fn` = [Read fn field](access(`self`, "fn"))**.
|
||||
1. `page`
|
||||
**path = [path](access(self, "path"))**
|
||||
*> web_app_route app=`a` path=`path` page=`page`*
|
||||
We retain **`path` = [Read path field](access(`self`, "path"))**.
|
||||
Return *[Register this declared route on an app handle](web_app_route(app=`a`, path=`path`, page=`page`))*.
|
||||
2. `fn`
|
||||
**path = [path](access(self, "path"))**
|
||||
**method = [method](access(self, "method"))**
|
||||
**request = [request](access(self, "request"))**
|
||||
**response = [response](access(self, "response"))**
|
||||
**class = [class](access(self, "class"))**
|
||||
*> web_app_invoke app=`a` path=`path` method=`method` fn=`fn` body=`request` return=`response` class=`class`*
|
||||
We retain **`path` = [Read path field](access(`self`, "path"))**.
|
||||
We retain **`method` = [Read method field](access(`self`, "method"))**.
|
||||
We retain **`request` = [Read request field](access(`self`, "request"))**.
|
||||
We retain **`response` = [Read response field](access(`self`, "response"))**.
|
||||
We retain **`class` = [Read class field](access(`self`, "class"))**.
|
||||
Return *[Register this declared route on an app handle](web_app_invoke(app=`a`, path=`path`, method=`method`, fn=`fn`, body=`request`, return=`response`, class=`class`))*.
|
||||
3. *
|
||||
*> table.put in=None at="ok" value=False*
|
||||
Return *[Set the ok field in the new record](table.put(in=None, at="ok", value=False))*.
|
||||
+220
-184
@@ -35,110 +35,128 @@ route API. Contracts precede execution; ordinary prose titles are not functions.
|
||||
|
||||
## page
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| title | text | document title |
|
||||
| route | text | path |
|
||||
| method | text | HTTP method |
|
||||
| body | text | Markdown body |
|
||||
| nodes | any | View table or None |
|
||||
| data_source | text | table name |
|
||||
| data_order | text | order key |
|
||||
| data_where | text | filters |
|
||||
|
||||
Construct a Document handle with `title`="", `route`="/", `method`="GET",
|
||||
`body`="", optional View `nodes`=None, and flat `data_source`="", `data_order`="",
|
||||
`data_where`="" keys. Prefer discovering type: web Artifact files via serve
|
||||
rather than hand-building every page in memory. nodes must be the unified View
|
||||
schema, never a private dialect or an HTML string shell.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| title | text | "" | document title |
|
||||
| route | text | "/" | path |
|
||||
| method | text | "GET" | HTTP method |
|
||||
| body | text | "" | Markdown body |
|
||||
| nodes | any | None | View table or None |
|
||||
| data_source | text | "" | table name |
|
||||
| data_order | text | "" | order key |
|
||||
| data_where | text | "" | filters |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | page handle |
|
||||
|
||||
*> page_mod.page title=`title` route=`route` method=`method` body=`body` nodes=`nodes` data_source=`data_source` data_order=`data_order` data_where=`data_where`*
|
||||
Use `title`="", `route`="/", `method`="GET", `body`="", `nodes`=None, `data_source`="", `data_order`="", `data_where`="" as the inputs for this operation.
|
||||
|
||||
Construct a Document handle with `title`="", `route`="/", `method`="GET",
|
||||
|
||||
`body`="", optional View `nodes`=None, and flat `data_source`="", `data_order`="",
|
||||
|
||||
`data_where`="" keys. Prefer discovering type: web Artifact files via serve
|
||||
rather than hand-building every page in memory. nodes must be the unified View
|
||||
schema, never a private dialect or an HTML string shell.
|
||||
|
||||
Return *[Page](page_mod.page(title=`title`, route=`route`, method=`method`, body=`body`, nodes=`nodes`, data_source=`data_source`, data_order=`data_order`, data_where=`data_where`))*.
|
||||
|
||||
## route
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | app handle |
|
||||
| path | text | required | URL path |
|
||||
| method | text | "GET" | HTTP method |
|
||||
| page | any | None | Document or None |
|
||||
| fn | text | "" | endpoint member |
|
||||
| request | text | "json" | request kind |
|
||||
| response | text | "json" | response kind |
|
||||
| auth | text | "" | auth tag |
|
||||
| class | text | "" | route class |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| app | any | app handle |
|
||||
| path | text | URL path |
|
||||
| method | text | HTTP method |
|
||||
| page | any | Document or None |
|
||||
| fn | text | endpoint member |
|
||||
| request | text | request kind |
|
||||
| response | text | response kind |
|
||||
| auth | text | auth tag |
|
||||
| class | text | route class |
|
||||
| result | any | registration result |
|
||||
|
||||
Use `app`, `path`, `method`="GET", `page`=None, `fn`="", `request`="json", `response`="json", `auth`="", `class`="" as the inputs for this operation.
|
||||
|
||||
Register a declared Document page or Endpoint on `app` at `path` with
|
||||
|
||||
`method`="GET" . `page`=None holds a Document; `fn`="" names an Endpoint
|
||||
lib.member. `request`="json", `response`="json", `auth`="", and `class`=""
|
||||
document the contract. Optional class values include execute, short, read,
|
||||
control. User routes must be declared — never implicit. After building the
|
||||
route object this tool registers it on the app.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | registration result |
|
||||
|
||||
**r = > route_mod.route app=`app` path=`path` method=`method` page=`page` fn=`fn` request=`request` response=`response` auth=`auth` class=`class`**
|
||||
*> `r`.register app=`app`*
|
||||
We retain **`r` = [Route](route_mod.route(app=`app`, path=`path`, method=`method`, page=`page`, fn=`fn`, request=`request`, response=`response`, auth=`auth`, class=`class`))**.
|
||||
Return *[Register](> `r`.register app=`app` )*.
|
||||
|
||||
## render
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| doc | any | Document or None |
|
||||
| nodes | any | View table or None |
|
||||
| body | text | Markdown |
|
||||
| title | text | title |
|
||||
| db | any | optional db |
|
||||
|
||||
Render a Document or View nodes to HTML for offline preview. Prefer nodes from
|
||||
file-partitioned components. Optional `doc`=None is a Document handle; when set,
|
||||
delegates to page.render. Optional `nodes`=None is a View table; when set without
|
||||
doc, renders that table. Otherwise renders Markdown `body`="" with optional
|
||||
`title`="" and `db`=None . Requires the native plugin. Do not treat this as
|
||||
permission to paste a full HTML homepage — keep using View tables and Markdown.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| doc | any | None | Document or None |
|
||||
| nodes | any | None | View table or None |
|
||||
| body | text | "" | Markdown |
|
||||
| title | text | "" | title supplied by the caller |
|
||||
| db | any | None | optional db |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML or payload |
|
||||
|
||||
> cap.load
|
||||
Use `doc`=None, `nodes`=None, `body`="", `title`="", `db`=None as the inputs for this operation.
|
||||
|
||||
Render a Document or View nodes to HTML for offline preview. Prefer nodes from
|
||||
file-partitioned components. Optional `doc`=None is a Document handle; when set,
|
||||
delegates to page.render. Optional `nodes`=None is a View table; when set without
|
||||
doc, renders that table. Otherwise renders Markdown `body`="" with optional
|
||||
|
||||
`title`="" and `db`=None . Requires the native plugin. Do not treat this as
|
||||
permission to paste a full HTML homepage — keep using View tables and Markdown.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
1. `doc`
|
||||
*> `doc`.render nodes=`nodes` db=`db`*
|
||||
Return *[Render](> `doc`.render nodes=`nodes` db=`db` )*.
|
||||
2. `nodes`
|
||||
*> web_render_nodes page=`doc` nodes=`nodes` db=`db` title=`title`*
|
||||
Return *[Render a Document or View nodes to HTML for offline preview](web_render_nodes(page=`doc`, nodes=`nodes`, db=`db`, title=`title`))*.
|
||||
3. *
|
||||
*> web_render_document page=`doc` body=`body` db=`db` title=`title`*
|
||||
Return *[Render a Document or View nodes to HTML for offline preview](web_render_document(page=`doc`, body=`body`, db=`db`, title=`title`))*.
|
||||
|
||||
## use
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| app | any | app handle |
|
||||
| middleware | any | middleware table |
|
||||
|
||||
Attach first-class `middleware` to `app`. Pass a GFM table (security headers,
|
||||
cors row, and similar). This replaces the old configure(...) junk drawer with an
|
||||
explicit table authors can read.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| middleware | any | required | middleware table |
|
||||
| app | any | required | app handle |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | app handle |
|
||||
|
||||
> cap.load
|
||||
*> web_app_use app=`app` middleware=`middleware`*
|
||||
Use `middleware`, `app` as the inputs for this operation.
|
||||
|
||||
Attach first-class `middleware` to `app`. Pass a GFM table (security headers,
|
||||
cors row, and similar). This replaces the old configure(...) junk drawer with an
|
||||
explicit table authors can read.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Attach first-class middleware to app](web_app_use(app=`app`, middleware=`middleware`))*.
|
||||
|
||||
## inspect
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | None | app or None |
|
||||
| root | text | "" | Site directory to inspect without listening |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| app | any | app or None |
|
||||
| root | text | Site directory to inspect without listening |
|
||||
| result | any | {declared, system} |
|
||||
|
||||
Use `app`=None, `root`="" as the inputs for this operation.
|
||||
|
||||
Return declared versus system route tables for introspection. System routes such
|
||||
as /_part and /_form must appear here. Use this to verify a site after serve or
|
||||
@@ -146,23 +164,25 @@ manual registration. Optional `app`=None selects which application to inspect.
|
||||
|
||||
Optional `root`="" scans a site directory when supplied; it does not start a server.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | {declared, system} |
|
||||
|
||||
> cap.load
|
||||
*> web_inspect app=`app` root=`root`*
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Return declared versus system route tables for introspection](web_inspect(app=`app`, root=`root`))*.
|
||||
|
||||
## serve
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| root | text | "." | site root |
|
||||
| host | text | "127.0.0.1" | bind host |
|
||||
| port | number | 18081 | Explicit server port |
|
||||
| db | any | None | optional db |
|
||||
| static_dir | text | "" | static files |
|
||||
| middleware | any | None | optional middleware |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| root | text | site root |
|
||||
| host | text | bind host |
|
||||
| port | number | port |
|
||||
| db | any | optional db |
|
||||
| static_dir | text | static files |
|
||||
| middleware | any | optional middleware |
|
||||
| result | any | serve result |
|
||||
|
||||
Use `root`=".", `host`="127.0.0.1", `port`=18081, `db`=None, `static_dir`="", `middleware`=None as the inputs for this operation.
|
||||
|
||||
Scan `root`="." for type web or endpoint Artifacts, register declared routes,
|
||||
attach system routes, and listen on `host`="127.0.0.1" and `port`=18081 . The
|
||||
@@ -170,138 +190,153 @@ site directory should already follow the layout law (components split until
|
||||
simple). Optional `db`=None, `static_dir`="", and `middleware`=None bind
|
||||
resources without stuffing them into this facade as author APIs.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | serve result |
|
||||
|
||||
> cap.load
|
||||
*> web_serve_root root=`root` host=`host` port=`port` db=`db` static_dir=`static_dir` middleware=`middleware`*
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Scan root="](web_serve_root(root=`root`, host=`host`, port=`port`, db=`db`, static_dir=`static_dir`, middleware=`middleware`))*.
|
||||
|
||||
## client_embed
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| bridge | text | bridge script URL |
|
||||
| wasm | text | wasm URL |
|
||||
| source | text | optional source |
|
||||
| boot | bool | auto boot |
|
||||
|
||||
Describe WASM bridge embed tags for a page that needs client Marqdo. Defaults:
|
||||
`bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm",
|
||||
`source`="", `boot`=True . This is not a substitute for Document layout: still
|
||||
partition nav and main in files, then embed the bridge where interaction needs
|
||||
it.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| bridge | text | "/static/marqdo-bridge.js" | bridge script URL |
|
||||
| wasm | text | "/static/marqdo_wasm.wasm" | wasm URL |
|
||||
| source | text | "" | optional source |
|
||||
| boot | bool | True | auto boot |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | embed descriptor |
|
||||
|
||||
*> client_mod.embed bridge=`bridge` wasm=`wasm` source=`source` boot=`boot`*
|
||||
Use `bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm", `source`="", `boot`=True as the inputs for this operation.
|
||||
|
||||
Describe WASM bridge embed tags for a page that needs client Marqdo. Defaults:
|
||||
|
||||
`bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm",
|
||||
|
||||
`source`="", `boot`=True . This is not a substitute for Document layout: still
|
||||
partition nav and main in files, then embed the bridge where interaction needs
|
||||
it.
|
||||
|
||||
Return *[Embed](client_mod.embed(bridge=`bridge`, wasm=`wasm`, source=`source`, boot=`boot`))*.
|
||||
|
||||
## text_patch
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| sel | text | required | CSS selector |
|
||||
| text | text | required | new text |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| sel | text | CSS selector |
|
||||
| text | text | new text |
|
||||
| result | any | patch descriptor |
|
||||
|
||||
Use `sel`, `text` as the inputs for this operation.
|
||||
|
||||
Client patch: set text content for CSS selector `sel` to string `text`. Use for
|
||||
small interactive updates after a Document is already laid out with View tables —
|
||||
not for building the initial homepage shell.
|
||||
|
||||
Return *[Text patch](client_mod.text_patch(sel=`sel`, text=`text`))*.
|
||||
|
||||
## dom_patch
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| sel | text | required | CSS selector |
|
||||
| html | text | "" | optional HTML fragment |
|
||||
| attrs | any | None | optional attrs |
|
||||
| remove | bool | False | remove node |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | patch descriptor |
|
||||
|
||||
*> client_mod.text_patch sel=`sel` text=`text`*
|
||||
|
||||
## dom_patch
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| sel | text | CSS selector |
|
||||
| html | text | optional HTML fragment |
|
||||
| attrs | any | optional attrs |
|
||||
| remove | bool | remove node |
|
||||
Use `sel`, `html`="", `attrs`=None, `remove`=False as the inputs for this operation.
|
||||
|
||||
Client patch for selector `sel` with optional `html`="", `attrs`=None, or
|
||||
|
||||
`remove`=False . Treat html here as a surgical update, never as the primary way
|
||||
to author nav, sidebar, or footer. Layout law still applies to the Document that
|
||||
hosts the selector.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | patch descriptor |
|
||||
|
||||
*> client_mod.dom_patch sel=`sel` html=`html` attrs=`attrs` remove=`remove`*
|
||||
Return *[Dom patch](client_mod.dom_patch(sel=`sel`, html=`html`, attrs=`attrs`, remove=`remove`))*.
|
||||
|
||||
## make_style
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| table | any | required | property table |
|
||||
| name | text | "" | style name |
|
||||
| strict | bool | False | strict mode |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| name | text | style name |
|
||||
| table | any | property table |
|
||||
| strict | bool | strict mode |
|
||||
| result | any | CSS / style handle |
|
||||
|
||||
Use `table`, `name`="", `strict`=False as the inputs for this operation.
|
||||
|
||||
Compile a named style `table` into CSS. Optional `name`="" and `strict`=False .
|
||||
Styles remain data next to content; this is not a hidden page DSL. Prefer
|
||||
referencing style names from View style columns after file-partitioned
|
||||
components define their look.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | CSS / style handle |
|
||||
|
||||
> cap.load
|
||||
*> web_style name=`name` table=`table` strict=`strict`*
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Compile a named style table into CSS](web_style(name=`name`, table=`table`, strict=`strict`))*.
|
||||
|
||||
## make_images
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| table | any | images table |
|
||||
|
||||
Build image descriptors from a readable `table` of sources and alts. Keep media
|
||||
declarations in Markdown tables beside the Document that uses them.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| table | any | required | images table |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | images payload |
|
||||
|
||||
> cap.load
|
||||
*> web_images table=`table`*
|
||||
Use `table` as the inputs for this operation.
|
||||
|
||||
Build image descriptors from a readable `table` of sources and alts. Keep media
|
||||
declarations in Markdown tables beside the Document that uses them.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Build image descriptors from a readable table of sources and alts. Keep media declarations in Markdown tables beside the Document that uses them.](web_images(table=`table`))*.
|
||||
|
||||
## make_head
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| table | any | head table |
|
||||
|
||||
Build head resource rows (link, script, icon) from a `table`. Prefer declaring
|
||||
head needs as data rather than injecting opaque HTML head strings.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| table | any | required | head table |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | head payload |
|
||||
|
||||
> cap.load
|
||||
*> web_head table=`table`*
|
||||
Use `table` as the inputs for this operation.
|
||||
|
||||
Build head resource rows (link, script, icon) from a `table`. Prefer declaring
|
||||
head needs as data rather than injecting opaque HTML head strings.
|
||||
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Build head resource rows (link, script, icon) from a table. Prefer declaring head needs as data rather than injecting opaque HTML head strings.](web_head(table=`table`))*.
|
||||
|
||||
# app
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| page | any | See prose default / 见叙述默认值 |
|
||||
| db | any | See prose default / 见叙述默认值 |
|
||||
| host | any | See prose default / 见叙述默认值 |
|
||||
| port | any | See prose default / 见叙述默认值 |
|
||||
| admin | any | See prose default / 见叙述默认值 |
|
||||
| admin_prefix | any | See prose default / 见叙述默认值 |
|
||||
| shell_css | any | See prose default / 见叙述默认值 |
|
||||
| layout | any | See prose default / 见叙述默认值 |
|
||||
| asset_version | any | See prose default / 见叙述默认值 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| page | any | None | Initial Document/page resource, or None for explicit later route mounts |
|
||||
| db | any | None | Existing database resource used for document data and native application services |
|
||||
| host | any | "127.0.0.1" | Listen address; the default binds only the local host |
|
||||
| port | any | 18081 | TCP listen port selected for the application |
|
||||
| admin | any | False | Whether to enable the native administration routes |
|
||||
| admin_prefix | any | "/admin" | URL prefix under which native administration routes are mounted |
|
||||
| shell_css | any | None | Optional native shell stylesheet configuration; None keeps the runtime default |
|
||||
| layout | any | None | Optional native shell layout configuration; component geometry remains View data |
|
||||
| asset_version | any | None | Optional resource version used by the native shell for asset URLs |
|
||||
|
||||
Inputs: `page`=None, `db`=None, `host`=127.0.0.1, `port`=18081, `admin`=False, `admin_prefix`="/admin", `shell_css`=None, `layout`=None, `asset_version`=None
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Native app resource for static mounts, route registration, gates and listening |
|
||||
|
||||
Use `page`=None, `db`=None, `host`="127.0.0.1", `port`=18081, `admin`=False, `admin_prefix`="/admin", `shell_css`=None, `layout`=None, `asset_version`=None as the inputs for this operation.
|
||||
|
||||
Low-level app handle for advanced mounts. Prefer web.serve for Artifact sites
|
||||
that already follow file-partition layout. Optional page, db, host, port, admin
|
||||
@@ -311,59 +346,60 @@ discovery should stay on serve; agents should not invent HTML shells on this
|
||||
object. Methods static, listen, and gate hang off the returned handle for
|
||||
mounts that remain table- and Metadata-driven.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Constructed value / 构造结果 |
|
||||
|
||||
> cap.load
|
||||
*> web_app_new page=`page` db=`db` admin=`admin` host=`host` port=`port` admin_prefix=`admin_prefix` login_redirect=None logout_redirect=None shell_css=`shell_css` layout=`layout` asset_version=`asset_version`*
|
||||
We **[Load the native plugin required by this operation](cap.load())**.
|
||||
Return *[Low-level app handle for advanced mounts](web_app_new(page=`page`, db=`db`, admin=`admin`, host=`host`, port=`port`, admin_prefix=`admin_prefix`, login_redirect=None, logout_redirect=None, shell_css=`shell_css`, layout=`layout`, asset_version=`asset_version`))*.
|
||||
|
||||
## static
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| dir | text | required | filesystem directory |
|
||||
| mount | text | "/static" | URL mount |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| dir | text | filesystem directory |
|
||||
| mount | text | URL mount |
|
||||
| result | any | app handle |
|
||||
|
||||
Use `dir`, `mount`="/static" as the inputs for this operation.
|
||||
|
||||
Mount static files from `dir` at `mount`=/static on this app. Use for bridge
|
||||
scripts and assets referenced by Documents — not for dumping an HTML-only site
|
||||
tree that bypasses Artifact Documents.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | app handle |
|
||||
|
||||
*> web_app_static app=`self` dir=`dir` mount=`mount`*
|
||||
Return *[Mount static files from dir at mount=/static on this app](web_app_static(app=`self`, dir=`dir`, mount=`mount`))*.
|
||||
|
||||
## listen
|
||||
|
||||
Start listening with the already configured app host and port. Prefer serve for
|
||||
root scanning; listen is for advanced app handles after manual route setup.
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | listen result |
|
||||
|
||||
*> web_listen app=`self`*
|
||||
Start listening with the already configured app host and port. Prefer serve for
|
||||
root scanning; listen is for advanced app handles after manual route setup.
|
||||
|
||||
Return *[Start listening with the already configured app host and port. Prefer serve for root scanning; listen is for advanced app handles after manual route setup.](web_listen(app=`self`))*.
|
||||
|
||||
## gate
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| path | text | gated path |
|
||||
| roles | any | roles |
|
||||
| permissions | text | permissions |
|
||||
| match | text | match mode |
|
||||
| on_deny | text | deny behavior |
|
||||
| exclude | any | exclusions |
|
||||
|
||||
Attach an authorization gate on `path` for this app. Defaults: `roles`="admin",
|
||||
`permissions`="", `match`="prefix", `on_deny`="forbid", `exclude`=None . Auth
|
||||
resources live in ext/security; this method only wires the gate onto the web
|
||||
app surface.
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| path | text | required | gated path |
|
||||
| roles | any | "admin" | roles supplied by the caller |
|
||||
| permissions | text | "" | Comma-separated permission names held by the current role or subject |
|
||||
| match | text | "prefix" | match mode |
|
||||
| on_deny | text | "forbid" | deny behavior |
|
||||
| exclude | any | None | exclusions |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | app handle |
|
||||
|
||||
*> web_app_gate app=`self` path=`path` roles=`roles` permissions=`permissions` match=`match` on_deny=`on_deny` exclude=`exclude`*
|
||||
Use `path`, `roles`="admin", `permissions`="", `match`="prefix", `on_deny`="forbid", `exclude`=None as the inputs for this operation.
|
||||
|
||||
Attach an authorization gate on `path` for this app. Defaults: `roles`="admin",
|
||||
|
||||
`permissions`="", `match`="prefix", `on_deny`="forbid", `exclude`=None . Auth
|
||||
resources live in ext/security; this method only wires the gate onto the web
|
||||
app surface.
|
||||
|
||||
Return *[Attach an authorization gate on path for this app](web_app_gate(app=`self`, path=`path`, roles=`roles`, permissions=`permissions`, match=`match`, on_deny=`on_deny`, exclude=`exclude`))*.
|
||||
+32
-24
@@ -36,7 +36,7 @@ marqdo call ext/web/布局/索引.mq.md 分栏 '子节点=[{"type":"markdown","v
|
||||
返回先拆布局、递归到 Markdown 叶子的工程约定。无参数;
|
||||
规则是说明,不声称已静态审查某个文件。真正验收需要运行并检查站点。
|
||||
|
||||
*> layout.rules*
|
||||
完成后返回*[调用 rules](layout.rules())*。
|
||||
|
||||
## 视图契约
|
||||
|
||||
@@ -47,72 +47,80 @@ marqdo call ext/web/布局/索引.mq.md 分栏 '子节点=[{"type":"markdown","v
|
||||
返回五个公共列名。子块通过值列继续包含同样的 View 记录;
|
||||
不增加第二种布局表方言,也不把任意属性名解释为 CSS。
|
||||
|
||||
*> layout.view_schema*
|
||||
完成后返回*[调用 view schema](layout.view_schema())*。
|
||||
|
||||
## 合并节点
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 甲 | list | 第一组节点 |
|
||||
| 乙 | list | 第二组节点 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 甲 | list | 必填 | 第一组节点 |
|
||||
| 乙 | list | 必填 | 第二组节点 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 兄弟节点 |
|
||||
|
||||
这里使用`甲`、`乙`。
|
||||
|
||||
拼接 `甲` 与 `乙`,只保留顺序,不增加几何关系。
|
||||
需要横向排列时使用分栏,需要上下分区时使用纵排。
|
||||
|
||||
*> layout.merge_nodes a=`甲` b=`乙`*
|
||||
完成后返回*[调用 merge nodes](layout.merge_nodes(a=`甲`, b=`乙`))*。
|
||||
|
||||
## 纵排
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 子节点 | list | 子块列表 |
|
||||
| 槽 | text | 父区域名 |
|
||||
| 样式 | text | 可选类名 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 子节点 | list | 必填 | 子块列表 |
|
||||
| 槽 | text | "" | 父区域名 |
|
||||
| 样式 | text | "" | 可选类名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 父容器节点 |
|
||||
|
||||
这里使用`子节点`、`槽`=""、`样式`=""。
|
||||
|
||||
为 `子节点` 声明一层上下顺序。默认 `槽`=""、`样式`=""。
|
||||
父块只负责排列,内容和更深层结构留在导入的子组件。结果仍是 View 节点列表,
|
||||
可以继续传给祖先组件或页面渲染,无需提前转为 HTML。
|
||||
|
||||
*> layout.stack children=`子节点` slot=`槽` style=`样式`*
|
||||
完成后返回*[调用 stack](layout.stack(children=`子节点`, slot=`槽`, style=`样式`))*。
|
||||
|
||||
## 分栏
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 子节点 | list | 子块列表 |
|
||||
| 槽 | text | 父区域名 |
|
||||
| 样式 | text | 可选类名 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 子节点 | list | 必填 | 子块列表 |
|
||||
| 槽 | text | "" | 父区域名 |
|
||||
| 样式 | text | "" | 可选类名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 父容器节点 |
|
||||
|
||||
这里使用`子节点`、`槽`=""、`样式`=""。
|
||||
|
||||
为 `子节点` 声明一层响应式多栏。默认 `槽`=""、`样式`=""。
|
||||
父块只负责排列,内容和更深层结构留在导入的子组件。结果仍是 View 节点列表,
|
||||
可以继续传给祖先组件或页面渲染,无需提前转为 HTML。
|
||||
|
||||
*> layout.columns children=`子节点` slot=`槽` style=`样式`*
|
||||
完成后返回*[调用 columns](layout.columns(children=`子节点`, slot=`槽`, style=`样式`))*。
|
||||
|
||||
## 验收组件
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 名 | text | 组件名称 |
|
||||
| 职责 | text | 单一职责描述 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 名 | text | 必填 | 组件名称 |
|
||||
| 职责 | text | 必填 | 单一职责描述 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 待人工或测试核对的清单 |
|
||||
|
||||
这里使用`名`、`职责`。
|
||||
|
||||
为 `名` 与 `职责` 返回待检查的条目。仅依据这两个文本无法证明组件合格,
|
||||
所以结果明确标注为清单,调用者仍须检查文件内容与渲染结果,不自动发放通过标签。
|
||||
|
||||
*> layout.accept_component name=`名` duty=`职责`*
|
||||
完成后返回*[调用 accept component](layout.accept_component(name=`名`, duty=`职责`))*。
|
||||
+102
-84
@@ -27,147 +27,165 @@ marqdo call ext/web/网页.mq.md 检视 '根="examples/web-layout-handbook"' --e
|
||||
|
||||
## 布局规则
|
||||
|
||||
与 `布局.规则` 相同,便于只打开本文件的智能体。
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 布局规则映射 |
|
||||
|
||||
*> 布局.规则*
|
||||
与 `布局.规则` 相同,便于只打开本文件的智能体。
|
||||
|
||||
完成后返回*[调用 规则](布局.规则())*。
|
||||
|
||||
## 页面
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 标题 | text | 文档标题 |
|
||||
| 路由 | text | 路径 |
|
||||
| 方法 | text | HTTP 方法 |
|
||||
| 正文 | text | Markdown 正文 |
|
||||
| 节点 | any | View 表或 None |
|
||||
| 数据源 | text | 表名 |
|
||||
| 排序 | text | 如 -created_at |
|
||||
| 条件 | text | col=val 列表 |
|
||||
|
||||
构造 Document 句柄,默认 `标题`=""、`路由`="/"、`方法`="GET"、`正文`=""、
|
||||
`节点`=None、`数据源`=""、`排序`=""、`条件`=""。站点页面优先用 `类型: 网页`
|
||||
Artifact,由 `服务` 发现;本工具供预览或程序化构造。节点必须是统一 View 表,
|
||||
不是 HTML。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 标题 | text | "" | 文档标题 |
|
||||
| 路由 | text | "/" | 路径 |
|
||||
| 方法 | text | "GET" | HTTP 方法 |
|
||||
| 正文 | text | "" | Markdown 正文 |
|
||||
| 节点 | any | None | View 表或 None |
|
||||
| 数据源 | text | "" | 表名 |
|
||||
| 排序 | text | "" | 如 -created_at |
|
||||
| 条件 | text | "" | col=val 列表 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 页面句柄 |
|
||||
|
||||
*> web.page title=`标题` route=`路由` method=`方法` body=`正文` nodes=`节点` data_source=`数据源` data_order=`排序` data_where=`条件`*
|
||||
这里使用`标题`=""、`路由`="/"、`方法`="GET"、`正文`=""、`节点`=None、`数据源`=""、`排序`=""、`条件`=""。
|
||||
|
||||
构造 Document 句柄,默认 `标题`=""、`路由`="/"、`方法`="GET"、`正文`=""、
|
||||
|
||||
`节点`=None、`数据源`=""、`排序`=""、`条件`=""。站点页面优先用 `类型: 网页`
|
||||
Artifact,由 `服务` 发现;本工具供预览或程序化构造。节点必须是统一 View 表,
|
||||
不是 HTML。
|
||||
|
||||
完成后返回*[调用 page](web.page(title=`标题`, route=`路由`, method=`方法`, body=`正文`, nodes=`节点`, data_source=`数据源`, data_order=`排序`, data_where=`条件`))*。
|
||||
|
||||
## 路由
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 应用 | any | 应用句柄 |
|
||||
| 路径 | text | URL 路径 |
|
||||
| 方法 | text | HTTP 方法 |
|
||||
| 页面 | any | Document 或 None |
|
||||
| 函数 | text | Endpoint lib.member |
|
||||
| 请求 | text | 请求体类型 |
|
||||
| 响应 | text | 响应类型 |
|
||||
| 鉴权 | text | 鉴权标签 |
|
||||
|
||||
在 `应用` 上注册已声明 Document 或 Endpoint:`路径`、`方法`="GET"、`页面`=None、
|
||||
`函数`=""、`请求`="json"、`响应`="json"、`鉴权`=""。不要隐式注册用户路由。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | 必填 | 应用句柄 |
|
||||
| 路径 | text | 必填 | URL 路径 |
|
||||
| 方法 | text | "GET" | HTTP 方法 |
|
||||
| 页面 | any | None | Document 或 None |
|
||||
| 函数 | text | "" | Endpoint lib.member |
|
||||
| 请求 | text | "json" | 请求体类型 |
|
||||
| 响应 | text | "json" | 响应类型 |
|
||||
| 鉴权 | text | "" | 鉴权标签 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 路由结果 |
|
||||
|
||||
*> web.route app=`应用` path=`路径` method=`方法` page=`页面` fn=`函数` request=`请求` response=`响应` auth=`鉴权`*
|
||||
这里使用`应用`、`路径`、`方法`="GET"、`页面`=None、`函数`=""、`请求`="json"、`响应`="json"、`鉴权`=""。
|
||||
|
||||
在 `应用` 上注册已声明 Document 或 Endpoint:`路径`、`方法`="GET"、`页面`=None、
|
||||
|
||||
`函数`=""、`请求`="json"、`响应`="json"、`鉴权`=""。不要隐式注册用户路由。
|
||||
|
||||
完成后返回*[调用 route](web.route(app=`应用`, path=`路径`, method=`方法`, page=`页面`, fn=`函数`, request=`请求`, response=`响应`, auth=`鉴权`))*。
|
||||
|
||||
## 渲染
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 文档 | any | Document 或 None |
|
||||
| 节点 | any | View 表或 None |
|
||||
| 正文 | text | Markdown |
|
||||
| 标题 | text | 标题 |
|
||||
| 数据库 | any | 可选 db |
|
||||
|
||||
把 Document 或 View 节点渲染为 HTML(预览)。可选 `文档`=None、`节点`=None、
|
||||
`正文`=""、`标题`=""、`数据库`=None。输入应来自 Markdown/View,而不是手写 HTML
|
||||
大字符串。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 文档 | any | None | Document 或 None |
|
||||
| 节点 | any | None | View 表或 None |
|
||||
| 正文 | text | "" | Markdown |
|
||||
| 标题 | text | "" | 调用方提供的标题 |
|
||||
| 数据库 | any | None | 可选 db |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML 或渲染结果 |
|
||||
|
||||
*> web.render doc=`文档` nodes=`节点` body=`正文` title=`标题` db=`数据库`*
|
||||
这里使用`文档`=None、`节点`=None、`正文`=""、`标题`=""、`数据库`=None。
|
||||
|
||||
把 Document 或 View 节点渲染为 HTML(预览)。可选 `文档`=None、`节点`=None、
|
||||
|
||||
`正文`=""、`标题`=""、`数据库`=None。输入应来自 Markdown/View,而不是手写 HTML
|
||||
大字符串。
|
||||
|
||||
完成后返回*[调用 render](web.render(doc=`文档`, nodes=`节点`, body=`正文`, title=`标题`, db=`数据库`))*。
|
||||
|
||||
## 使用
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 应用 | any | 应用句柄 |
|
||||
| 中间件 | any | 中间件表 |
|
||||
|
||||
把 `中间件` 挂到 `应用`(表驱动)。禁止 `configure(...)` 垃圾抽屉。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 中间件 | any | 必填 | 中间件表 |
|
||||
| 应用 | any | 必填 | 应用句柄 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 应用句柄 |
|
||||
|
||||
*> web.use app=`应用` middleware=`中间件`*
|
||||
这里使用`中间件`、`应用`。
|
||||
|
||||
把 `中间件` 挂到 `应用`(表驱动)。禁止 `configure(...)` 垃圾抽屉。
|
||||
|
||||
完成后返回*[调用 use](web.use(app=`应用`, middleware=`中间件`))*。
|
||||
|
||||
## 检视
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 应用 | any | 应用或 None |
|
||||
| 根 | text | 离线扫描的站点目录 |
|
||||
|
||||
返回 `{declared, system}` 路由表;可选 `应用`=None。
|
||||
|
||||
可选 `根`="",给出时扫描站点目录,不启动服务器。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | None | 应用或 None |
|
||||
| 根 | text | "" | 离线扫描的站点目录 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 路由检视 |
|
||||
|
||||
*> web.inspect app=`应用` root=`根`*
|
||||
这里使用`应用`=None、`根`=""。
|
||||
|
||||
返回 `{declared, system}` 路由表;可选 `应用`=None。
|
||||
|
||||
可选 `根`="",给出时扫描站点目录,不启动服务器。
|
||||
|
||||
完成后返回*[调用 inspect](web.inspect(app=`应用`, root=`根`))*。
|
||||
|
||||
## 服务
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 根 | text | 站点根目录 |
|
||||
| 主机 | text | 绑定主机 |
|
||||
| 端口 | number | 端口 |
|
||||
| 数据库 | any | 可选 db |
|
||||
| 静态目录 | text | 静态资源 |
|
||||
| 中间件 | any | 可选中间件 |
|
||||
|
||||
扫描 `根`="." 下 `类型: 网页|端点` Artifact,注册声明路由并在 `主机`="127.0.0.1"
|
||||
与 `端口`=18081 监听。可选 `数据库`=None、`静态目录`=""、`中间件`=None。站点
|
||||
目录应已按布局铁律拆好组件文件。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 根 | text | "." | 站点根目录 |
|
||||
| 主机 | text | "127.0.0.1" | 绑定主机 |
|
||||
| 端口 | number | 18081 | 调用方提供的端口 |
|
||||
| 数据库 | any | None | 可选 db |
|
||||
| 静态目录 | text | "" | 静态资源 |
|
||||
| 中间件 | any | None | 可选中间件 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 服务结果 |
|
||||
|
||||
*> web.serve root=`根` host=`主机` port=`端口` db=`数据库` static_dir=`静态目录` middleware=`中间件`*
|
||||
这里使用`根`="."、`主机`="127.0.0.1"、`端口`=18081、`数据库`=None、`静态目录`=""、`中间件`=None。
|
||||
|
||||
扫描 `根`="." 下 `类型: 网页|端点` Artifact,注册声明路由并在 `主机`="127.0.0.1"
|
||||
与 `端口`=18081 监听。可选 `数据库`=None、`静态目录`=""、`中间件`=None。站点
|
||||
目录应已按布局铁律拆好组件文件。
|
||||
|
||||
完成后返回*[调用 serve](web.serve(root=`根`, host=`主机`, port=`端口`, db=`数据库`, static_dir=`静态目录`, middleware=`中间件`))*。
|
||||
|
||||
## 客户端挂载
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 桥 | text | bridge 脚本路径 |
|
||||
| wasm | text | wasm 路径 |
|
||||
| 源 | text | 可选源 |
|
||||
| 启动 | bool | 是否自动 boot |
|
||||
|
||||
嵌入 WASM 桥,默认 `桥`="/static/marqdo-bridge.js"、`wasm`="/static/marqdo_wasm.wasm"、
|
||||
`源`=""、`启动`=True。不是用 HTML 字符串拼整页的借口。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 桥 | text | "/static/marqdo-bridge.js" | bridge 脚本路径 |
|
||||
| wasm | text | "/static/marqdo_wasm.wasm" | wasm 路径 |
|
||||
| 源 | text | "" | 可选源 |
|
||||
| 启动 | bool | True | 是否自动 boot |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 挂载描述 |
|
||||
|
||||
*> web.client_embed bridge=`桥` wasm=`wasm` source=`源` boot=`启动`*
|
||||
这里使用`桥`="/static/marqdo-bridge.js"、`wasm`="/static/marqdo_wasm.wasm"、`源`=""、`启动`=True。
|
||||
|
||||
嵌入 WASM 桥,默认 `桥`="/static/marqdo-bridge.js"、`wasm`="/static/marqdo_wasm.wasm"、
|
||||
|
||||
`源`=""、`启动`=True。不是用 HTML 字符串拼整页的借口。
|
||||
|
||||
完成后返回*[调用 client embed](web.client_embed(bridge=`桥`, wasm=`wasm`, source=`源`, boot=`启动`))*。
|
||||
+35
-28
@@ -24,51 +24,58 @@ marqdo call ext/web/网页/客户端/索引.mq.md 文本补丁 '选择器="#stat
|
||||
|
||||
## 挂载
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 桥 | text | bridge 脚本 URL |
|
||||
| wasm | text | wasm URL |
|
||||
| 源 | text | 可选源 |
|
||||
| 启动 | bool | 自动启动 |
|
||||
|
||||
返回加载官方浏览器桥的 HTML 片段。默认 `桥`="/static/marqdo-bridge.js"、
|
||||
`wasm`="/static/marqdo_wasm.wasm"、`源`=""、`启动`=True。不是用 HTML 拼整页的
|
||||
借口。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 桥 | text | "/static/marqdo-bridge.js" | bridge 脚本 URL |
|
||||
| wasm | text | "/static/marqdo_wasm.wasm" | wasm URL |
|
||||
| 源 | text | "" | 可选源 |
|
||||
| 启动 | bool | True | 自动启动 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | text | script 标签 HTML |
|
||||
|
||||
*> client.embed bridge=`桥` wasm=`wasm` source=`源` boot=`启动`*
|
||||
这里使用`桥`="/static/marqdo-bridge.js"、`wasm`="/static/marqdo_wasm.wasm"、`源`=""、`启动`=True。
|
||||
|
||||
返回加载官方浏览器桥的 HTML 片段。默认 `桥`="/static/marqdo-bridge.js"、
|
||||
|
||||
`wasm`="/static/marqdo_wasm.wasm"、`源`=""、`启动`=True。不是用 HTML 拼整页的
|
||||
借口。
|
||||
|
||||
完成后返回*[调用 embed](client.embed(bridge=`桥`, wasm=`wasm`, source=`源`, boot=`启动`))*。
|
||||
|
||||
## 文本补丁
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 选择器 | text | 必填 | CSS 选择器 |
|
||||
| 文本 | text | 必填 | 文本内容 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 选择器 | text | CSS 选择器 |
|
||||
| 文本 | text | 文本内容 |
|
||||
| result | any | 效果表 |
|
||||
|
||||
这里使用`选择器`、`文本`。
|
||||
|
||||
为选择器 `选择器` 构造 `set_text` 效果表,文本为 `文本`。
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 效果表 |
|
||||
|
||||
*> client.text_patch sel=`选择器` text=`文本`*
|
||||
完成后返回*[调用 text patch](client.text_patch(sel=`选择器`, text=`文本`))*。
|
||||
|
||||
## 节点补丁
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 选择器 | text | CSS 选择器 |
|
||||
| html | text | 可选 HTML |
|
||||
| 属性 | any | 可选属性表 |
|
||||
| 移除 | bool | 是否移除 |
|
||||
|
||||
为选择器 `选择器` 构造 `dom` 效果表。可选 `html`=""、`属性`=None、`移除`=False。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 选择器 | text | 必填 | CSS 选择器 |
|
||||
| html | text | "" | 可选 HTML |
|
||||
| 属性 | any | None | 可选属性表 |
|
||||
| 移除 | bool | False | 是否移除 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 效果表 |
|
||||
|
||||
*> client.dom_patch sel=`选择器` html=`html` attrs=`属性` remove=`移除`*
|
||||
这里使用`选择器`、`html`=""、`属性`=None、`移除`=False。
|
||||
|
||||
为选择器 `选择器` 构造 `dom` 效果表。可选 `html`=""、`属性`=None、`移除`=False。
|
||||
|
||||
完成后返回*[调用 dom patch](client.dom_patch(sel=`选择器`, html=`html`, attrs=`属性`, remove=`移除`))*。
|
||||
+24
-18
@@ -24,42 +24,48 @@ marqdo call ext/web/网页/文档对象模型/索引.mq.md 渲染 'dom=$body' --
|
||||
|
||||
## 自Markdown
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 文本 | text | Markdown 源 |
|
||||
|
||||
把 Markdown `文本` 变成 `{kind:"markdown", text}`,供页面渲染。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 文本 | text | 必填 | Markdown 源 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | DOM 映射 |
|
||||
|
||||
*> dom.from_markdown text=`文本`*
|
||||
这里使用`文本`。
|
||||
|
||||
把 Markdown `文本` 变成 `{kind:"markdown", text}`,供页面渲染。
|
||||
|
||||
完成后返回*[调用 from markdown](dom.from_markdown(text=`文本`))*。
|
||||
|
||||
## 原始
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| html | text | 原始 HTML |
|
||||
|
||||
逃逸舱 — 包装原始 `html`。仅当表驱动无法表达宿主约束时使用,并写明原因。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| html | text | 必填 | 原始 HTML |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | DOM 映射 kind=raw |
|
||||
|
||||
*> dom.raw html=`html`*
|
||||
这里使用`html`。
|
||||
|
||||
逃逸舱 — 包装原始 `html`。仅当表驱动无法表达宿主约束时使用,并写明原因。
|
||||
|
||||
完成后返回*[调用 raw](dom.raw(html=`html`))*。
|
||||
|
||||
## 渲染
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| dom | any | 自Markdown 或 原始 的结果 |
|
||||
|
||||
把 DOM 映射 `dom` 渲染为 HTML(须插件)。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| dom | any | 必填 | 自Markdown 或 原始 的结果 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML 文本 |
|
||||
|
||||
*> dom.render dom=`dom`*
|
||||
这里使用`dom`。
|
||||
|
||||
把 DOM 映射 `dom` 渲染为 HTML(须插件)。
|
||||
|
||||
完成后返回*[调用 render](dom.render(dom=`dom`))*。
|
||||
+22
-12
@@ -157,6 +157,12 @@ cargo test --locked --test gold ext_web -- --test-threads=1
|
||||
返回建站流程与拆分终点,不执行文件操作,也不声称已经验收某个站点。
|
||||
先建立区域树,再写父组件与 Markdown 叶子,最后按声明路由启动并测试。
|
||||
|
||||
这张表返回工程步骤与停止条件,供作者安排实现顺序;它不会自动创建目录、拆分现有页面或替站点完成验收。先确定区域树,把首页拆成导航、主体与页脚。若页脚有品牌栏和链接栏,再拆子区域;链接有文档与社区两栏时继续拆分。父文件只表达一层布局,叶子只保留可直接阅读的 Markdown 内容。
|
||||
|
||||
区域树稳定后,首页用 Document 元数据声明路由并选择装配入口。其他页面各自声明路由,接口逻辑放到 Endpoint,使请求期间的业务计算与启动时的页面装配各有归属。不要在返回组件的函数里启动服务器,也不要把启动时运行一次的装配误当作每次请求都会执行的数据绑定。
|
||||
|
||||
实现过程中先离线预览,核对实际父子节点和区域内容;再从站点目录启动服务,检查首页、普通文档和 API 的真实响应。浏览器还需验证宽屏分栏与窄屏折叠。只看清单文本、返回固定 ready 或将整页 HTML 分成几个字符串文件,都不能证明已实现统一的文档架构。若某个块仍需独立内部排列,就返回布局拆分阶段继续细化。
|
||||
|
||||
`workflow` =
|
||||
|
||||
| key | value |
|
||||
@@ -171,7 +177,7 @@ cargo test --locked --test gold ext_web -- --test-threads=1
|
||||
| step_G | compare preview and live output; test routes and browser geometry |
|
||||
| stopping_rule | one Markdown responsibility and no internal layout |
|
||||
|
||||
*workflow*
|
||||
完成后返回*workflow*。
|
||||
|
||||
## 布局规则
|
||||
|
||||
@@ -182,38 +188,42 @@ cargo test --locked --test gold ext_web -- --test-threads=1
|
||||
复用布局模块的实践约定,保持一个真相源。无参数,不需要插件。
|
||||
规则描述预期做法,实际站点仍需检查叶子、父关系与运行结果。
|
||||
|
||||
*> 布局.规则*
|
||||
完成后返回*[调用 规则](布局.规则())*。
|
||||
|
||||
## 预览正文
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 正文 | text | Markdown content |
|
||||
| 标题 | text | Document title |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 正文 | text | "" | Markdown content |
|
||||
| 标题 | text | "Preview" | Document title |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | text | HTML document |
|
||||
|
||||
这里使用`正文`=""、`标题`="Preview"。
|
||||
|
||||
离线渲染 Markdown `正文`="",默认 `标题`="Preview"。
|
||||
此工具只返回 HTML 文本,不写文件、不注册路由。复杂页面先拆布局,
|
||||
不要用整页原生 HTML 字符串冒充正文。需要原生插件。
|
||||
|
||||
*> 网页.渲染 正文=`正文` 标题=`标题`*
|
||||
完成后返回*[调用 渲染](网页.渲染(正文=`正文`, 标题=`标题`))*。
|
||||
|
||||
## 预览节点
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 节点 | list | Nested View rows |
|
||||
| 标题 | text | Document title |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 节点 | list | 必填 | Nested View rows |
|
||||
| 标题 | text | "Preview" | Document title |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | text | HTML document |
|
||||
|
||||
这里使用`节点`、`标题`="Preview"。
|
||||
|
||||
渲染已经按职责拆分的 `节点`,默认 `标题`="Preview"。
|
||||
父节点的值继续持有子节点,叶子值为 Markdown;返回 HTML 不会启动服务。
|
||||
与真实 Document 的装配使用同一渲染器,能检查双栏是否确实保留了层级。
|
||||
|
||||
*> 网页.渲染 节点=`节点` 标题=`标题`*
|
||||
完成后返回*[调用 渲染](网页.渲染(节点=`节点`, 标题=`标题`))*。
|
||||
+31
-23
@@ -25,68 +25,76 @@ marqdo call ext/web/网页/组件/索引.mq.md 合并 '甲=[{"type":"text","valu
|
||||
|
||||
## 节点
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 表 | any | View 表 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 表 | any | 必填 | View 表 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | Result |
|
||||
| result | any | 原样返回输入 View 表,保留记录列表或列式表的实际形态 |
|
||||
|
||||
这里使用`表`。
|
||||
|
||||
原样返回 `表`,保留已有恒等入口。可接受列式表或记录列表;
|
||||
需要组合和嵌套时统一选择 @ 记录列表,让子表保持结构值而不是字符串。
|
||||
|
||||
*> component.nodes table=`表`*
|
||||
完成后返回*[调用 nodes](component.nodes(table=`表`))*。
|
||||
|
||||
## 合并
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 甲 | list | 第一组节点记录 |
|
||||
| 乙 | list | 第二组节点记录 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 甲 | list | 必填 | 第一组节点记录 |
|
||||
| 乙 | list | 必填 | 第二组节点记录 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 有序兄弟节点 |
|
||||
|
||||
这里使用`甲`、`乙`。
|
||||
|
||||
拼接 `甲` 与 `乙`,保留顺序和内部父子关系。输入均为 @ 记录列表;
|
||||
本工具不把平面节点变成两栏,需要双栏时再交给布局的分栏工具。
|
||||
|
||||
*> component.merge a=`甲` b=`乙`*
|
||||
完成后返回*[调用 merge](component.merge(a=`甲`, b=`乙`))*。
|
||||
|
||||
## 正文
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 文本 | text | 普通 Markdown |
|
||||
| 槽 | text | 区域名 |
|
||||
| 样式 | text | 可选类名 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 文本 | text | 必填 | 普通 Markdown |
|
||||
| 槽 | text | "" | 区域名 |
|
||||
| 样式 | text | "" | 可选类名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 单个 Markdown 叶子 |
|
||||
|
||||
这里使用`文本`、`槽`=""、`样式`=""。
|
||||
|
||||
将 Markdown `文本` 包成叶子,默认 `槽`=""、`样式`=""。
|
||||
不加载原生插件,输出仍为结构数据;标题、链接、列表与表格在渲染时处理。
|
||||
叶子不关心自己位于页脚左栏还是其他位置,父组件负责几何关系。
|
||||
|
||||
*> component.markdown text=`文本` slot=`槽` style=`样式`*
|
||||
完成后返回*[调用 markdown](component.markdown(text=`文本`, slot=`槽`, style=`样式`))*。
|
||||
|
||||
## 包裹
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 子节点 | list | 子块记录列表 |
|
||||
| 种类 | text | 容器类型 |
|
||||
| 槽 | text | 区域名 |
|
||||
| 样式 | text | 可选类名 |
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 子节点 | list | 必填 | 子块记录列表 |
|
||||
| 种类 | text | "column" | 容器类型 |
|
||||
| 槽 | text | "" | 区域名 |
|
||||
| 样式 | text | "" | 可选类名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 包含子节点的父块 |
|
||||
|
||||
这里使用`子节点`、`种类`="column"、`槽`=""、`样式`=""。
|
||||
|
||||
将 `子节点` 放进一层父容器,默认 `种类`="column"、`槽`=""、`样式`=""。
|
||||
几何类型为 row、column;语义类型包括 nav、header、footer、section、aside。
|
||||
值单元格保留子表,不承载拼好的 HTML;构造器只生成结构,实际形状由渲染器检查。
|
||||
|
||||
*> component.wrap children=`子节点` kind=`种类` slot=`槽` style=`样式`*
|
||||
完成后返回*[调用 wrap](component.wrap(children=`子节点`, kind=`种类`, slot=`槽`, style=`样式`))*。
|
||||
@@ -23,11 +23,11 @@ marqdo call ext/web/网页/能力/索引.mq.md 加载 --effects plugin --json
|
||||
|
||||
## 加载
|
||||
|
||||
通过 plugin.native_path 定位 ABI v2 web 动态库并 plugin.load。缺失时打印安装提
|
||||
示并以非零退出。无参数。
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 加载成功后为空 |
|
||||
|
||||
*> cap.load*
|
||||
通过 plugin.native_path 定位 ABI v2 web 动态库并 plugin.load。缺失时打印安装提
|
||||
示并以非零退出。无参数。
|
||||
|
||||
完成后返回*[加载本操作依赖的原生插件](cap.load())*。
|
||||
+37
-31
@@ -24,54 +24,60 @@ marqdo call ext/web/网页/路由/索引.mq.md 注册 '路由=$route' --effects
|
||||
|
||||
## 新建
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 应用 | any | 应用句柄 |
|
||||
| 路径 | text | URL 路径 |
|
||||
| 方法 | text | HTTP 方法 |
|
||||
| 页面 | any | Document 或 None |
|
||||
| 函数 | text | Endpoint 成员 |
|
||||
| 请求 | text | 请求体类型 |
|
||||
| 响应 | text | 响应类型 |
|
||||
| 鉴权 | text | 鉴权标签 |
|
||||
| 类别 | text | 路由类别 |
|
||||
|
||||
为 `应用` 在 `路径` 上构造路由句柄,`方法`="GET"。`页面`=None 或 `函数`="" 二
|
||||
选一。`请求`="json"、`响应`="json"、`鉴权`=""、`类别`=""。本工具尚未注册——再
|
||||
调 `注册`,或用门面 `路由` 一步完成。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | 必填 | 应用句柄 |
|
||||
| 路径 | text | 必填 | URL 路径 |
|
||||
| 方法 | text | "GET" | HTTP 方法 |
|
||||
| 页面 | any | None | Document 或 None |
|
||||
| 函数 | text | "" | Endpoint 成员 |
|
||||
| 请求 | text | "json" | 请求体类型 |
|
||||
| 响应 | text | "json" | 响应类型 |
|
||||
| 鉴权 | text | "" | 鉴权标签 |
|
||||
| 类别 | text | "" | 路由类别 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 路由句柄 |
|
||||
|
||||
*> route.new app=`应用` path=`路径` method=`方法` page=`页面` fn=`函数` request=`请求` response=`响应` auth=`鉴权` class=`类别`*
|
||||
这里使用`应用`、`路径`、`方法`="GET"、`页面`=None、`函数`=""、`请求`="json"、`响应`="json"、`鉴权`=""、`类别`=""。
|
||||
|
||||
为 `应用` 在 `路径` 上构造路由句柄,`方法`="GET"。`页面`=None 或 `函数`="" 二
|
||||
选一。`请求`="json"、`响应`="json"、`鉴权`=""、`类别`=""。本工具尚未注册——再
|
||||
调 `注册`,或用门面 `路由` 一步完成。
|
||||
|
||||
完成后返回*[调用 new](route.new(app=`应用`, path=`路径`, method=`方法`, page=`页面`, fn=`函数`, request=`请求`, response=`响应`, auth=`鉴权`, class=`类别`))*。
|
||||
|
||||
## 注册
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 路由 | any | 路由句柄 |
|
||||
| 应用 | any | 应用或 None |
|
||||
|
||||
把路由句柄 `路由` 注册到应用;可选 `应用`=None 时用句柄内保存的应用。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 路由 | any | 必填 | 路由句柄 |
|
||||
| 应用 | any | None | 应用或 None |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 注册结果 |
|
||||
|
||||
*> route.register route=`路由` app=`应用`*
|
||||
这里使用`路由`、`应用`=None。
|
||||
|
||||
把路由句柄 `路由` 注册到应用;可选 `应用`=None 时用句柄内保存的应用。
|
||||
|
||||
完成后返回*[调用 register](route.register(route=`路由`, app=`应用`))*。
|
||||
|
||||
## 使用
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 路由 | any | 路由句柄 |
|
||||
| 中间件 | any | 中间件表 |
|
||||
|
||||
给路由句柄 `路由` 挂上中间件表 `中间件`。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 路由 | any | 必填 | 路由句柄 |
|
||||
| 中间件 | any | 必填 | 中间件表 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 结果 |
|
||||
| result | any | 带 middleware 字段的路由记录;此步骤不注册或启动路由 |
|
||||
|
||||
*> route.use route=`路由` middleware=`中间件`*
|
||||
这里使用`路由`、`中间件`。
|
||||
|
||||
给路由句柄 `路由` 挂上中间件表 `中间件`。
|
||||
|
||||
完成后返回*[调用 use](route.use(route=`路由`, middleware=`中间件`))*。
|
||||
+28
-23
@@ -24,39 +24,44 @@ marqdo call ext/web/网页/页面/索引.mq.md 渲染 '页面=$pg' --effects plu
|
||||
|
||||
## 新建
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 标题 | text | 文档标题 |
|
||||
| 路由 | text | 路径 |
|
||||
| 方法 | text | HTTP 方法 |
|
||||
| 正文 | text | Markdown 正文 |
|
||||
| 节点 | any | View 表或 None |
|
||||
| 数据源 | text | 表名 |
|
||||
| 排序 | text | 排序键 |
|
||||
| 条件 | text | 过滤 |
|
||||
|
||||
构造 Document 句柄,默认 `标题`=""、`路由`="/"、`方法`="GET"、`正文`=""、
|
||||
`节点`=None、`数据源`=""、`排序`=""、`条件`=""。节点必须是统一 View 表。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 标题 | text | "" | 文档标题 |
|
||||
| 路由 | text | "/" | 路径 |
|
||||
| 方法 | text | "GET" | HTTP 方法 |
|
||||
| 正文 | text | "" | Markdown 正文 |
|
||||
| 节点 | any | None | View 表或 None |
|
||||
| 数据源 | text | "" | 表名 |
|
||||
| 排序 | text | "" | 排序键 |
|
||||
| 条件 | text | "" | 过滤 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 页面句柄 |
|
||||
|
||||
*> page.new title=`标题` route=`路由` method=`方法` body=`正文` nodes=`节点` data_source=`数据源` data_order=`排序` data_where=`条件`*
|
||||
这里使用`标题`=""、`路由`="/"、`方法`="GET"、`正文`=""、`节点`=None、`数据源`=""、`排序`=""、`条件`=""。
|
||||
|
||||
构造 Document 句柄,默认 `标题`=""、`路由`="/"、`方法`="GET"、`正文`=""、
|
||||
|
||||
`节点`=None、`数据源`=""、`排序`=""、`条件`=""。节点必须是统一 View 表。
|
||||
|
||||
完成后返回*[调用 new](page.new(title=`标题`, route=`路由`, method=`方法`, body=`正文`, nodes=`节点`, data_source=`数据源`, data_order=`排序`, data_where=`条件`))*。
|
||||
|
||||
## 渲染
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| 页面 | any | Document 句柄 |
|
||||
| 节点 | any | View 表或 None |
|
||||
| 数据库 | any | 可选 db |
|
||||
|
||||
渲染 Document 句柄 `页面`。可选 `节点`=None、`数据库`=None。不要把手写 HTML 当
|
||||
作页面壳。
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 页面 | any | 必填 | Document 句柄 |
|
||||
| 节点 | any | None | View 表或 None |
|
||||
| 数据库 | any | None | 可选 db |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | HTML 或渲染结果 |
|
||||
|
||||
*> page.render page=`页面` nodes=`节点` db=`数据库`*
|
||||
这里使用`页面`、`节点`=None、`数据库`=None。
|
||||
|
||||
渲染 Document 句柄 `页面`。可选 `节点`=None、`数据库`=None。不要把手写 HTML 当
|
||||
作页面壳。
|
||||
|
||||
完成后返回*[调用 render](page.render(page=`页面`, nodes=`节点`, db=`数据库`))*。
|
||||
Reference in new issue
Block a user