Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
@@ -5,6 +5,8 @@ description: Browser Runtime helpers (WASM bridge). Prefer lib/browser for effec
|
||||
import:
|
||||
cap: ext/web/_capability/index.mq.md
|
||||
table: lib/table.mq.md
|
||||
component: ext/web/component/index.mq.md
|
||||
html: lib/html.mq.md
|
||||
---
|
||||
|
||||
Browser helpers describe the official Marqdo WASM bridge and small effects.
|
||||
@@ -44,6 +46,7 @@ HTML snippet that loads the official browser Marqdo bridge (route C/D). Defaults
|
||||
`source`="", `boot`=True . With boot and non-empty source, auto-mounts. No author
|
||||
JS. Not a substitute for file-partitioned Document layout.
|
||||
|
||||
We **bridge = [Escape the bridge URL as an attribute value](html.escape(text=`bridge`))** and **wasm = [Escape the WASM URL as an attribute value](html.escape(text=`wasm`))** and **source = [Escape the client source URL as an attribute value](html.escape(text=`source`))**.
|
||||
1. `boot`
|
||||
1. `source` != ""
|
||||
Return *"<script type=\"module\" src=\"" + bridge + "\" data-mq-wasm=\"" + wasm + "\" data-mq-source-url=\"" + source + "\"></script>"*.
|
||||
@@ -101,3 +104,30 @@ We retain **`spec` = [Set the html field in the new record](table.put(in=None, a
|
||||
**_ = 1**
|
||||
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`))*.
|
||||
|
||||
## nodes
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| bridge | text | "/static/marqdo-bridge.js" | URL of the official browser bridge |
|
||||
| wasm | text | "/static/marqdo_wasm.wasm" | URL of the built WASM artifact |
|
||||
| source | text | "" | Optional Marqdo client program URL |
|
||||
| boot | bool | True | Whether the bridge automatically mounts the client |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | Structured script Resource rows for a component Document |
|
||||
|
||||
Use `bridge`="/static/marqdo-bridge.js", `wasm`="/static/marqdo_wasm.wasm", `source`="" and `boot`=True in a component tree. The resource references the official bridge as a module and retains the WASM and source addresses as typed attributes. Boot with a nonempty source mounts that Marqdo program; boot=False declares the bridge without automatic mounting. This pure tool creates no server, downloads nothing and writes no JavaScript or HTML. Build the current WASM artifact and mount the actual static directory before serving the page. Prefer these rows to embed when a Document already returns View nodes; embed remains a compatibility string adapter.
|
||||
|
||||
`attributes` =
|
||||
|
||||
| type | data-mq-wasm |
|
||||
|---|---|
|
||||
| module | `wasm` |
|
||||
|
||||
1. `boot` and `source` != ""
|
||||
We **attributes = [Declare the client program to mount](table.put(in=`attributes`, at="data-mq-source-url", value=`source`))**.
|
||||
1. not `boot`
|
||||
We **attributes = [Keep automatic mounting disabled](table.put(in=`attributes`, at="data-mq-no-boot", value="1"))**.
|
||||
Return *[Declare the official bridge as a structured resource](component.asset(url=`bridge`, attrs=`attributes`, slot="marqdo-runtime"))*.
|
||||
@@ -103,15 +103,16 @@ Return *nodes*.
|
||||
| kind | text | "column" | Container kind |
|
||||
| slot | text | "" | Stable region name |
|
||||
| style | text | "" | Optional class name |
|
||||
| attrs | any | None | Attribute record for the container, such as id or hidden |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | One parent containing its child rows |
|
||||
|
||||
Use `children`, `kind`="column", `slot`="", `style`="" as the inputs for this operation.
|
||||
Use `children`, `kind`="column", `slot`="", `style`="", `attrs`=None 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
|
||||
and `style`="" . Use row or column for geometry, nav/header/footer/section/aside; form/list/item/select preserve native controls
|
||||
for a semantic region. The value cell holds the child list itself, not rendered
|
||||
HTML. The native renderer diagnoses unknown child shapes at the render boundary;
|
||||
this pure constructor does not claim to validate a full site.
|
||||
@@ -120,6 +121,104 @@ this pure constructor does not claim to validate a full site.
|
||||
|
||||
| @ | type | slot | value | attrs | style |
|
||||
|---|------|------|-------|-------|-------|
|
||||
| 1 | `kind` | `slot` | `children` | "" | `style` |
|
||||
| 1 | `kind` | `slot` | `children` | `attrs` | `style` |
|
||||
|
||||
Return *nodes*.
|
||||
|
||||
## element
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| kind | text | required | Native leaf kind: input, button, textarea, label, pre, option, text or link |
|
||||
| value | text | "" | Plain control text or initial input value |
|
||||
| attrs | any | None | Typed attribute record; legacy text href also works for links |
|
||||
| slot | text | "" | Stable layout slot |
|
||||
| style | text | "" | Optional CSS class names |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | One leaf in the existing five-column View schema |
|
||||
|
||||
Use `kind`, `value`="", `attrs`=None, `slot`="" and `style`="" when Markdown cannot express a native input or client event target. Supply ids and field names as a record, boolean flags as booleans, and labels as plain text. The renderer escapes values and attribute content; value is never interpreted as HTML. For forms, lists and semantic regions, use wrap with child rows. The constructor is pure; supported kinds, scalar attribute values and forbidden event/style attributes are checked when rendering. Client state belongs in data/aria attributes, while style names reference the page's stylesheet. This keeps controls inspectable without embedding a complete page as HTML.
|
||||
|
||||
`nodes` =
|
||||
|
||||
| @ | type | slot | value | attrs | style |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | `kind` | `slot` | `value` | `attrs` | `style` |
|
||||
|
||||
After describing this control we return *nodes*.
|
||||
|
||||
|
||||
|
||||
## asset
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| url | text | required | Explicit script or stylesheet URL served by the application |
|
||||
| kind | text | "script" | script or stylesheet |
|
||||
| attrs | any | None | Typed attributes such as module type, integrity or data-mq options |
|
||||
| slot | text | "" | Optional stable resource slot |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | One structured resource leaf in the same five-column View schema |
|
||||
|
||||
Use `url`, `kind`="script", `attrs`=None and `slot`="" for an existing resource that the browser must load. A script leaf carries only a URL, never inline author JavaScript; a stylesheet leaf references a separate CSS artifact. Its address stays in value, while attrs holds scalar metadata. The native renderer escapes the URL and attributes, forbids duplicate src/href/rel attributes and rejects script-protocol URLs. Construction is pure and fetches nothing. Keep resource declarations beside the Document component that needs them, after layout and content have been split. The browser loads the actual files when that Document is opened; a node record is not proof that the resource exists.
|
||||
|
||||
`nodes` =
|
||||
|
||||
| @ | type | slot | value | attrs | style |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | `kind` | `slot` | `url` | `attrs` | "" |
|
||||
|
||||
After declaring this resource we return *nodes*.
|
||||
|
||||
|
||||
|
||||
## resource
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| value | map | required | Typed data_query, form_ref, view_navigation or pure document_head Resource |
|
||||
| slot | text | "" | Stable component slot for this dynamic region |
|
||||
| style | text | "" | Optional wrapper class names |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | One resource node in the existing five-column View schema |
|
||||
|
||||
Use `value`, `slot`="" and `style`="" to place a resource supplied by its responsible module. Database query resources come from ext/data/view.mq.md; form references from ext/data/form.mq.md; navigation uses the helper below; pure head declarations come from ext/web/head.mq.md. The resource remains a typed value in the value cell, preserving readable composition and its actual input contract.
|
||||
|
||||
Construction is pure and does not query data, load a plugin or submit a form. Serving resolves the resource after preparing request parameters, session state and CSRF. Unknown resources fail before listening; missing runtime resources remain request errors. Offline rendering without a request resolver reports missing context for query, form and session navigation. Pure document_head resources are supported by offline preview and collected into the actual head, never shown as body content.
|
||||
|
||||
`nodes` =
|
||||
|
||||
| @ | type | slot | value | attrs | style |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | resource | `slot` | `value` | None | `style` |
|
||||
|
||||
Return *nodes* for the parent layout to place alongside static Markdown and controls.
|
||||
|
||||
## navigation
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| items | any | required | Link records with label, href and optional when, class or media |
|
||||
| region | text | "nav" | nav, sidebar or footer |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Pure navigation Resource, to be placed with component.resource |
|
||||
|
||||
Use `items` and `region`="nav" for session-aware link presentation. Link rows describe destinations; when=guest or auth uses the request's actual session. Empty conditions keep links visible. The native navigation renderer retains its existing classes and conditional visibility, while the recursive parent component still owns placement and geometry.
|
||||
|
||||
This constructor does not authenticate a user or register a route. Hiding a link cannot protect its destination from direct access. The server must separately attach actual authentication and authorization gates. Reading or constructing navigation never logs in or out; that behavior belongs to the destination's explicit resource and route.
|
||||
|
||||
`resource` =
|
||||
|
||||
| _type | items | region |
|
||||
|---|---|---|
|
||||
| view_navigation | `items` | `region` |
|
||||
|
||||
Return *resource* for explicit placement in the same five-column View.
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: Document head Resource — SEO, fonts and resource links
|
||||
---
|
||||
|
||||
Use this single-file resource inside the existing five-column View schema. It preserves metadata and native head links when a structured Document owns the page body. Place its returned value through component.resource alongside the layout. The renderer collects it into the actual head, leaving no visible placeholder in body or fragment responses. No new Markdown mark, frontmatter dialect or page mutation chain is involved.
|
||||
|
||||
Construction is pure. Rendering validates the closed contract, escapes metadata and uses the same head-link renderer as ordinary Documents. It does not fetch a font, execute a script or prove an external resource exists. Browsers load the declared URLs only when they open the real page. A local pure construction example is ready from the checkout:
|
||||
|
||||
```sh
|
||||
marqdo call ext/web/head.mq.md resource 'meta=[{"key":"description","value":"A readable site"}]' --json
|
||||
```
|
||||
|
||||
## resource
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| meta | any | None | key/value records or a GFM column table; scalar SEO values |
|
||||
| links | any | None | Native rel/href link records, including optional type, media, crossorigin, defer and async |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Pure document_head descriptor for component.resource; no IO |
|
||||
|
||||
Use `meta`=None and `links`=None to declare only what this Document needs. Metadata includes description, og: names and other native SEO names. Native title overrides and canonical/icon link keys retain ordinary Document behavior. Charset, viewport and csrf-token remain owned by the runtime and cannot be redeclared here. An empty descriptor contributes no metadata rather than fabricating a page result.
|
||||
|
||||
Links reuse the existing native field aliases, with rel selecting stylesheet, preconnect, preload, icon, script or module behavior. URLs must start with / for site resources or use http(s); protocol-relative URLs, active data schemes and malformed cells fail. Use the official client nodes for the browser bridge rather than inlining business JavaScript. A link does not mount a file or register a server route.
|
||||
|
||||
Nested layout modules can contribute head resources. Equal link declarations are deduplicated; conflicting values for the same metadata key are diagnostics rather than silently replacing each other. Fragments omit these declarations because they update an existing Document, while offline preview supports this pure resource without inventing a request session. Request-dependent data, form and navigation resources still require their actual request renderer.
|
||||
|
||||
`head` =
|
||||
|
||||
| _type | meta | links |
|
||||
|---|---|---|
|
||||
| document_head | `meta` | `links` |
|
||||
|
||||
After describing the actual metadata and resource addresses, return *head* for explicit placement by the parent component.
|
||||
+19
-12
@@ -70,9 +70,8 @@ uses the same representation and renderer. Preview from the repo root, then
|
||||
change into the site directory to start the process:
|
||||
|
||||
```text
|
||||
marqdo run examples/web-layout-handbook/preview.mq.md
|
||||
cd examples/web-layout-handbook
|
||||
marqdo run serve.mq.md
|
||||
marqdo call examples/web-layout-handbook/preview.mq.md main --effects plugin,fs.read,output.write --fs-root examples/web-layout-handbook --json
|
||||
marqdo call ext/web/web.mq.md serve 'root="examples/web-layout-handbook"' --effects plugin,fs.read,network.write --fs-root examples/web-layout-handbook --json
|
||||
```
|
||||
|
||||
Check /, /about and /api/ping. The first is a genuinely nested layout, the second
|
||||
@@ -117,7 +116,7 @@ Document, Endpoint and lifecycle boundaries
|
||||
|
||||
Ordinary Documents declare type: web, route and title around Markdown body,
|
||||
retaining the existing Markdown/data-source path. A composed Document also
|
||||
declares view: main: its # main returns View rows. serve executes that assembly
|
||||
declares view: main: its ordinary main function returns View rows. serve executes that assembly
|
||||
once at startup and uses the same renderer as offline preview. Restart after
|
||||
content changes. Automatic data_source binding uses ordinary Documents and
|
||||
cannot be mixed with startup assembly. Assembly returns structure; it must not render again or launch
|
||||
@@ -125,9 +124,17 @@ a server. Request-time interaction belongs in Endpoints with type, path, method,
|
||||
request and response metadata. Startup assembly is not an automatic request-time
|
||||
template/data-binding system.
|
||||
|
||||
serve is a blocking lifecycle operation for a launcher run with marqdo run.
|
||||
call is for pure construction, previews and inspection; --effects plugin does
|
||||
not grant network or filesystem writes, so call serve is not a launch workflow.
|
||||
serve is a blocking lifecycle operation callable with marqdo call. Grant
|
||||
plugin,fs.read,network.write for a site that reads Markdown and listens. For
|
||||
additional resources, compose web.prepare, resource-owned bindings and
|
||||
web.listen in an ordinary callable launcher. Keep each returned app value.
|
||||
For current database rows, forms and session-aware navigation, place the typed resources from
|
||||
ext/data and component.navigation inside the same View tree. Pure document_head resources
|
||||
preserve SEO and font links in previews as well as responses; they never become body content.
|
||||
See [the request-resource design](../../doc/design/web-view-resources.md) and the real
|
||||
[network site](../../examples/web-net-site/index.mq.md).
|
||||
The network library owns WebSocket routes; the security library owns login
|
||||
and session policy. Preparing a site opens no listener.
|
||||
inspect with root scans disk declarations without listening; an empty app in a
|
||||
fresh process cannot inspect another process's private state.
|
||||
|
||||
@@ -142,7 +149,8 @@ Open the module for the next responsibility
|
||||
[page](page/index.mq.md) supplies handles and offline render;
|
||||
[route](route/index.mq.md) is for explicit advanced registration, while whole
|
||||
sites normally use Metadata. [dom](dom/index.mq.md) converts content, retaining
|
||||
raw HTML only at a compatibility boundary. [client](client/index.mq.md) loads
|
||||
raw HTML only at a compatibility boundary. [head](head.mq.md) contributes pure SEO/font/resource declarations to the real document head;
|
||||
[client](client/index.mq.md) loads
|
||||
the official Marqdo WASM bridge; business effects stay in lib/browser.
|
||||
[_capability](_capability/index.mq.md) diagnoses loading. The [facade](web.mq.md)
|
||||
keeps serve/render/inspect and the app API. Data, auth and HTTP clients belong
|
||||
@@ -159,9 +167,8 @@ Update src/ext_cli.rs if adding package files. Preserve ordinary Documents and
|
||||
Endpoints when changing startup assembly.
|
||||
|
||||
```text
|
||||
cargo test --locked --test web_handbook
|
||||
cargo test --locked --test call_cli web_
|
||||
cargo test --locked --test gold ext_web -- --test-threads=1
|
||||
marqdo call skills/marqdo-dev/index.mq.md test 'targets=["web_handbook"]' --effects plugin,process.exec --require-ok --json
|
||||
marqdo call skills/marqdo-dev/index.mq.md test 'targets=["call_cli","gold"]' 'filter="web"' --effects plugin,process.exec --require-ok --json
|
||||
```
|
||||
|
||||
Handbook tests execute the bilingual sh fences and author examples directly,
|
||||
@@ -194,7 +201,7 @@ The returned rows are a planning aid, not a generated site or a validation certi
|
||||
| step_C | declare home Document and view main for composed structure |
|
||||
| step_D | declare more Documents with their own routes |
|
||||
| step_E | declare Endpoint handlers for request-time work |
|
||||
| step_F | run serve.mq.md from the site directory |
|
||||
| step_F | call the blocking serve function with explicit site root and effects |
|
||||
| step_G | compare preview and live output; test routes and browser geometry |
|
||||
| stopping_rule | one Markdown responsibility and no internal layout |
|
||||
|
||||
|
||||
+49
-14
@@ -25,8 +25,8 @@ marqdo call ext/web/web.mq.md inspect 'root="examples/web-layout-handbook"' --ef
|
||||
|
||||
inspect with root scans declared metadata without starting a server. To inspect
|
||||
an in-memory app, pass its actual handle; an empty fresh process cannot inspect
|
||||
another process. serve is a blocking lifecycle operation: write a launcher and
|
||||
use marqdo run, not call. Explicit view: main Documents assemble once at startup
|
||||
another process. serve is a blocking lifecycle operation. Call it directly with explicit effects,
|
||||
or compose prepare, resource bindings and listen in an ordinary callable launcher. Explicit view: main Documents assemble once at startup
|
||||
through normal functions and imports. Restart after changing their content.
|
||||
|
||||
Develop layout structure in layout/component and the Go artifact renderer;
|
||||
@@ -149,23 +149,21 @@ Return *[Attach first-class middleware to app](web_app_use(app=`app`, middleware
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | None | app or None |
|
||||
| root | text | "" | Site directory to inspect without listening |
|
||||
| app | any | None | Current prepared application after all explicit Resource bindings |
|
||||
| root | text | "" | Optional metadata-only scan directory; takes precedence over app |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | {declared, system} |
|
||||
|---|---|---|
|
||||
| result | map | scope, declared and system; registered reports actual configured handlers, metadata reports file declarations and runtime templates |
|
||||
|
||||
Use `app`=None, `root`="" as the inputs for this operation.
|
||||
Use `app`=None and `root`="" deliberately. After prepare and Resource bindings, pass the retained app before listen to inspect its current routes. The registrar is shared with the actual HTTP server, so later WebSocket, JSON query, form, login, administration and static bindings appear without using a stale startup snapshot. Duplicate or conflicting registrations retain their native diagnostic.
|
||||
|
||||
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
|
||||
manual registration. Optional `app`=None selects which application to inspect.
|
||||
Supplying root scans Artifact metadata only. It does not execute the launcher or Documents, so it cannot observe Resource bindings performed by those functions. scope=metadata makes that limitation explicit; scope=registered reports the handler registrations of the supplied app. Neither scope proves that a server is listening, a database is available or authentication succeeds.
|
||||
|
||||
Optional `root`="" scans a site directory when supplied; it does not start a server.
|
||||
The operation needs plugin. It does not invoke request handlers, create sessions, reset runtime state, open a database or start a listener. Credentials and unrelated app fields are not returned. System routes include the actual configured parameterized form/part paths and session paths; declared routes retain their source identity when available.
|
||||
|
||||
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`))*.
|
||||
We **[Load the maintained native inspection boundary](cap.load())**.
|
||||
Return *[Observe the current declarations and registered runtime handlers](web_inspect(app=`app`, root=`root`))*.
|
||||
|
||||
## serve
|
||||
|
||||
@@ -191,7 +189,7 @@ simple). Optional `db`=None, `static_dir`="", and `middleware`=None bind
|
||||
resources without stuffing them into this facade as author APIs.
|
||||
|
||||
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`))*.
|
||||
Return *[Discover the site and listen on its configured address](web_serve_root(root=`root`, host=`host`, port=`port`, db=`db`, static_dir=`static_dir`, middleware=`middleware`))*.
|
||||
|
||||
## client_embed
|
||||
|
||||
@@ -318,6 +316,43 @@ 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`))*.
|
||||
|
||||
## prepare
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| root | text | "." | Site directory containing declared Documents and Endpoints |
|
||||
| host | text | "127.0.0.1" | Explicit listen address retained for later listen |
|
||||
| port | number | 18081 | Port retained for later listen |
|
||||
| db | any | None | Existing database Resource or None |
|
||||
| static_dir | text | "" | Optional static directory resolved under the site |
|
||||
| middleware | any | None | Optional security header table |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Prepared app resource; no socket is opened |
|
||||
|
||||
Use `root`=".", `host`="127.0.0.1", `port`=18081, `db`=None, `static_dir`="" and `middleware`=None to discover the same Documents and Endpoints as serve. Startup View assembly runs once here. Bind additional resources to the returned app, retaining each returned app value, before calling listen. The original absolute site root travels with the app so relative endpoint callbacks and static files keep their site context. This is a lifecycle boundary, not an alternative routing language. Reading metadata or evaluating a Document can fail before any listener starts.
|
||||
|
||||
We **[Load the existing native web implementation](cap.load())**.
|
||||
Return *[Discover routes without starting a listener](web_prepare_root(root=`root`, host=`host`, port=`port`, db=`db`, static_dir=`static_dir`, middleware=`middleware`))*.
|
||||
|
||||
|
||||
## listen
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | Prepared app after explicit resource bindings |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Blocking native listener result |
|
||||
|
||||
Use `app` after prepare and the resource-owned binding functions. This call opens the configured host and port and blocks for the server lifetime. It works in an ordinary callable launcher reached by marqdo call; grant plugin, filesystem and network effects required by that launcher. Returning a resource description does not start the server. A separate terminal or supervised test process owns shutdown; call does not turn this listener into a background daemon. Relative paths use the site root retained by prepare.
|
||||
|
||||
We **[Load the existing native web implementation](cap.load())**.
|
||||
Return *[Serve the prepared site with its bound resources](web_listen(app=`app`))*.
|
||||
|
||||
|
||||
# app
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|
||||
+62
-9
@@ -19,7 +19,7 @@ marqdo call ext/web/网页.mq.md 检视 '根="examples/web-layout-handbook"' --e
|
||||
```
|
||||
|
||||
页面结构用五列 View 记录,父值保留子表。纯布局、DOM 构造和客户端描述无需插件。
|
||||
整站服务通过 launcher 的 marqdo run 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
整站服务可通过 marqdo call 直接调用服务函数,也可在普通启动函数中组合准备、资源绑定与监听;检视磁盘站点请给出根目录,不能从新进程
|
||||
读取另一个进程的私有应用。结构化 Document 使用 视图: main,在启动时执行布局装配。
|
||||
|
||||
开发时先复用组件和布局模块,再改对应领域实现;保持中英入口与真实契约一致。
|
||||
@@ -131,20 +131,20 @@ Artifact,由 `服务` 发现;本工具供预览或程序化构造。节点
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | None | 应用或 None |
|
||||
| 根 | text | "" | 离线扫描的站点目录 |
|
||||
| 应用 | any | None | 完成显式资源绑定后保留的当前应用 |
|
||||
| 根 | text | "" | 可选的元数据扫描目录;给出时优先于应用 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | any | 路由检视 |
|
||||
|---|---|---|
|
||||
| 结果 | map | scope、declared 与 system;区分文件声明和当前应用的实际处理器注册 |
|
||||
|
||||
这里使用`应用`=None、`根`=""。
|
||||
使用`应用`=None、`根`="",应明确选择观察范围。准备应用并绑定资源后,把保留的应用交给检视,再开始监听。清单复用真实服务的路由注册流程,后加的 WebSocket、JSON 查询、表单、登录、后台和静态挂载都会出现,不读取已经过期的启动快照;冲突注册保留原生诊断。
|
||||
|
||||
返回 `{declared, system}` 路由表;可选 `应用`=None。
|
||||
给出根目录时只扫描 Artifact 元数据,不执行启动函数或页面,因此不能观察这些函数运行后才绑定的资源。scope 为 metadata 表示文件声明与运行时模板,为 registered 表示传入应用的实际处理器注册。它们都不能证明已经监听、数据库可用或登录成功。
|
||||
|
||||
可选 `根`="",给出时扫描站点目录,不启动服务器。
|
||||
需要 plugin。此操作不调用请求处理器、不创建或重置会话、不打开数据库、不启动监听,也不返回凭据和无关应用字段。系统清单包含实际配置的表单、片段及会话路径;已有来源信息的声明仍保留文件身份,便于继续阅读实现。
|
||||
|
||||
完成后返回*[调用 inspect](web.inspect(app=`应用`, root=`根`))*。
|
||||
完成后返回 *[观察当前声明及运行时注册](web.inspect(app=`应用`, root=`根`))*。
|
||||
|
||||
## 服务
|
||||
|
||||
@@ -189,3 +189,56 @@ Artifact,由 `服务` 发现;本工具供预览或程序化构造。节点
|
||||
`源`=""、`启动`=True。不是用 HTML 字符串拼整页的借口。
|
||||
|
||||
完成后返回*[调用 client embed](web.client_embed(bridge=`桥`, wasm=`wasm`, source=`源`, boot=`启动`))*。
|
||||
|
||||
## 准备站点
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 根 | text | "." | 含网页与端点声明的站点目录 |
|
||||
| 主机 | text | "127.0.0.1" | 监听地址;准备阶段不开启端口 |
|
||||
| 端口 | number | 18081 | 交给稍后监听阶段使用的端口 |
|
||||
| 数据库 | any | None | 已有数据库资源 |
|
||||
| 静态目录 | text | "" | 站点内的可选静态资源目录 |
|
||||
| 中间件 | any | None | 可选安全响应头表 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | 已发现路由并完成启动布局装配的应用资源 |
|
||||
|
||||
这里使用`根`="."、`主机`="127.0.0.1"、`端口`=18081、`数据库`=None、`静态目录`=""和`中间件`=None。准备阶段发现 Document 与 Endpoint,执行一次启动布局,但不启动监听。随后把应用交给网络、鉴权等资源的绑定函数,并保留每次返回的新应用,最后调用监听。原始站点的绝对根目录随应用保留,因此端点回调和静态资源的相对路径仍按站点解析。目录读取和布局执行可能在打开端口之前失败,应保留原始诊断。
|
||||
|
||||
完成准备后返回*[发现站点并保留其资源上下文](web.prepare(root=`根`, host=`主机`, port=`端口`, db=`数据库`, static_dir=`静态目录`, middleware=`中间件`))*.
|
||||
|
||||
|
||||
## 监听
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | 必填 | 准备站点后已完成资源绑定的应用 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | 阻塞的原生监听结果 |
|
||||
|
||||
输入`应用`后才启动已配置的主机和端口。可以在普通可调用启动函数中按顺序准备站点、绑定资源、监听,再通过 marqdo call 执行该函数。监听持续占用当前进程,由调用者或测试监督进程负责停止。显式授予启动流程所需的插件、文件读取与网络写入权限;返回一个应用描述本身不会启动后台服务。
|
||||
|
||||
最后返回*[在保留的站点根目录中启动服务](web.listen(app=`应用`))*.
|
||||
|
||||
|
||||
|
||||
## 编译样式
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 名称 | text | 必填 | 原生类选择器名,可含后代选择器尾部 |
|
||||
| 属性 | any | 必填 | 属性、值两列的声明式主题表 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | text | 原生样式编译器输出的 CSS 文本 |
|
||||
|
||||
使用`名称`与`属性`,授权 plugin。该入口对应英文 make_style,把可读属性表交给已有原生编译器;不接收整页 HTML,也不创造另一套布局语言。名称应由作者控制,对应 View 的样式类与原生内容结构。返回文本不会自动写入或挂载文件,调用者需显式选择生成路径并以原生文件能力保存。
|
||||
|
||||
纯属性构造不需要插件,真正编译才在这里加载原生实现。属性值的格式或选择器错误保留真实诊断,不能替换为旧产物继续声称已构建。动态业务数据不应该用来拼接选择器;测试应比较实际编译结果并查看对应区域的渲染效果。
|
||||
|
||||
完成编译后返回 *[使用已有主题编译器处理声明](web.make_style(name=`名称`, table=`属性`))*。
|
||||
+18
-1
@@ -16,7 +16,7 @@ marqdo call ext/web/网页/客户端/索引.mq.md 文本补丁 '选择器="#stat
|
||||
```
|
||||
|
||||
页面结构用五列 View 记录,父值保留子表。纯布局、DOM 构造和客户端描述无需插件。
|
||||
整站服务通过 launcher 的 marqdo run 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
整站服务通过网页.服务或工程入口的 serve 函数用 marqdo call 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
读取另一个进程的私有应用。结构化 Document 使用 视图: main,在启动时执行布局装配。
|
||||
|
||||
开发时先复用组件和布局模块,再改对应领域实现;保持中英入口与真实契约一致。
|
||||
@@ -79,3 +79,20 @@ marqdo call ext/web/网页/客户端/索引.mq.md 文本补丁 '选择器="#stat
|
||||
为选择器 `选择器` 构造 `dom` 效果表。可选 `html`=""、`属性`=None、`移除`=False。
|
||||
|
||||
完成后返回*[调用 dom patch](client.dom_patch(sel=`选择器`, html=`html`, attrs=`属性`, remove=`移除`))*。
|
||||
|
||||
## 挂载节点
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 桥 | text | "/static/marqdo-bridge.js" | 官方浏览器桥地址 |
|
||||
| wasm | text | "/static/marqdo_wasm.wasm" | 当前构建的 WASM 产物地址 |
|
||||
| 源 | text | "" | 可选客户端 Marqdo 程序地址 |
|
||||
| 启动 | bool | True | 是否自动挂载客户端程序 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | 组件 Document 可直接组合的脚本资源节点 |
|
||||
|
||||
这里使用`桥`="/static/marqdo-bridge.js"、`wasm`="/static/marqdo_wasm.wasm"、`源`=""和`启动`=True。节点引用官方模块资源,把 WASM 和程序地址保留为属性数据。启动关闭时只声明桥,不自动执行客户端。构造无需插件,不访问网络,也不生成业务 HTML;浏览器打开页面后才加载实际文件。应先构建当前 WASM 并挂载静态目录,再把这些节点与内容组件组合。旧的字符串挂载工具保留兼容用途。
|
||||
|
||||
完成后返回*[将官方运行时作为结构资源声明](client.nodes(bridge=`桥`, wasm=`wasm`, source=`源`, boot=`启动`))*.
|
||||
@@ -16,7 +16,7 @@ marqdo call ext/web/网页/文档对象模型/索引.mq.md 渲染 'dom=$body' --
|
||||
```
|
||||
|
||||
页面结构用五列 View 记录,父值保留子表。纯布局、DOM 构造和客户端描述无需插件。
|
||||
整站服务通过 launcher 的 marqdo run 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
整站服务通过网页.服务或工程入口的 serve 函数用 marqdo call 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
读取另一个进程的私有应用。结构化 Document 使用 视图: main,在启动时执行布局装配。
|
||||
|
||||
开发时先复用组件和布局模块,再改对应领域实现;保持中英入口与真实契约一致。
|
||||
|
||||
+11
-10
@@ -65,9 +65,8 @@ site/
|
||||
先从仓库根生成预览,再从站点目录运行服务:
|
||||
|
||||
```text
|
||||
marqdo run examples/web-layout-handbook-zh/preview.mq.md
|
||||
cd examples/web-layout-handbook-zh
|
||||
marqdo run serve.mq.md
|
||||
marqdo call examples/web-layout-handbook-zh/preview.mq.md main --effects plugin,fs.read,output.write --fs-root examples/web-layout-handbook-zh --json
|
||||
marqdo call ext/web/网页.mq.md 服务 '根="examples/web-layout-handbook-zh"' --effects plugin,fs.read,network.write --fs-root examples/web-layout-handbook-zh --json
|
||||
```
|
||||
|
||||
检查 / 首页、/about 普通文档、/api/ping JSON。首页应真的出现父子嵌套与两个页脚区域,
|
||||
@@ -106,14 +105,15 @@ markup: occlusion
|
||||
Document、Endpoint 与运行边界
|
||||
|
||||
普通 Document 用 类型: 网页、路由、标题和 Markdown 正文,保留原来的静态/数据源路径。
|
||||
组件 Document 另外声明 视图: main,其 # main 返回节点列表;服务在启动时执行装配一次,
|
||||
组件 Document 另外声明 视图: main,其普通 main 函数返回节点列表;服务在启动时执行装配一次,
|
||||
通过同一渲染器生成 HTML。改内容后重启。自动数据源绑定使用普通 Document,不与此启动装配混用。不要在这个装配函数里再启动服务器或调用渲染;
|
||||
它返回结构即可。请求期互动放在 Endpoint,声明 类型: 端点、路径、方法、请求、响应,
|
||||
主程序返回响应值。不要把启动时装配误解为自动的请求期模板绑定。
|
||||
|
||||
serve 是长时间运行的生命周期操作,用 launcher 的 marqdo run 启动。
|
||||
call 适合纯构造、离线预览与检视;--effects plugin 不授予网络或文件写入权限,
|
||||
不能把 call 服务当成起站方式。网页检视给出根目录时可离线扫描声明;新进程中的空应用
|
||||
服务是长时间阻塞的生命周期操作,可用 marqdo call 直接调用,并显式授予
|
||||
plugin、fs.read、network.write。需要更多资源时,在普通启动函数中顺序组合准备站点、
|
||||
各资源的绑定工具与监听,并保留每次更新后的应用。网络库负责 WebSocket,安全库负责
|
||||
登录与会话;准备阶段不会打开端口。网页检视给出根目录时可离线扫描声明;新进程中的空应用
|
||||
不能检视另一个进程的私有路由状态。
|
||||
|
||||
```sh
|
||||
@@ -129,6 +129,7 @@ Markdown 叶子与语义包裹;[页面](页面/索引.mq.md)负责句柄与离
|
||||
[客户端](客户端/索引.mq.md)挂载 Marqdo WASM,业务交互继续使用 lib/browser;
|
||||
[能力](能力/索引.mq.md)只诊断原生加载。[门面](../网页.mq.md)保留服务、渲染、检视和应用 API。
|
||||
数据库、鉴权、HTTP 客户端分别去 ext/data、ext/security、ext/net。
|
||||
[页头资源](../页头.mq.md)保留真实 SEO、字体与资源声明,能用于离线预览;它不会成为正文或片段占位。数据查询、表单引用和会话导航仍在真实请求中解析,继续沿用五列 View。完整中文实践见 [网络站点入口](../../../examples/web-net-site-zh/index.mq.md)。
|
||||
|
||||
开发路线与验收
|
||||
|
||||
@@ -138,9 +139,9 @@ Markdown 叶子与语义包裹;[页面](页面/索引.mq.md)负责句柄与离
|
||||
新增文件时更新 src/ext_cli.rs 安装清单。修改 Document 启动装配要保留普通文档与 API 的行为。
|
||||
|
||||
```text
|
||||
cargo test --locked --test web_handbook
|
||||
cargo test --locked --test call_cli web_
|
||||
cargo test --locked --test gold ext_web -- --test-threads=1
|
||||
marqdo call skills/marqdo-dev/index.mq.md test 'targets=["web_handbook"]' --effects plugin --fs-root . --require-ok --json
|
||||
marqdo call skills/marqdo-dev/index.mq.md test 'targets=["call_cli"]' 'filter="web_"' --effects plugin --fs-root . --require-ok --json
|
||||
marqdo call skills/marqdo-dev/index.mq.md test 'targets=["gold"]' 'filter="ext_web"' --effects plugin --fs-root . --require-ok --json
|
||||
```
|
||||
|
||||
手册门禁直接执行本包双语 sh 围栏与作者程序,另外预览并启动参考工程,核对路由、
|
||||
|
||||
+90
-2
@@ -16,6 +16,7 @@ import:
|
||||
marqdo call ext/web/网页/组件/索引.mq.md 正文 '文本="## 可读的叶子"' '槽="介绍"' --json
|
||||
marqdo call ext/web/网页/组件/索引.mq.md 包裹 '子节点=[{"type":"markdown","value":"左"},{"type":"markdown","value":"右"}]' '种类="row"' --json
|
||||
marqdo call ext/web/网页/组件/索引.mq.md 合并 '甲=[{"type":"text","value":"前"}]' '乙=[{"type":"text","value":"后"}]' --json
|
||||
marqdo call ext/web/网页/组件/索引.mq.md 资源 '地址="/static/generated/theme.css"' '种类="stylesheet"' --json
|
||||
```
|
||||
|
||||
复用组件使用 @ 记录表,合并只确定兄弟顺序,不会自动产生双栏。布局请转到
|
||||
@@ -86,15 +87,102 @@ marqdo call ext/web/网页/组件/索引.mq.md 合并 '甲=[{"type":"text","valu
|
||||
| 种类 | text | "column" | 容器类型 |
|
||||
| 槽 | text | "" | 区域名 |
|
||||
| 样式 | text | "" | 可选类名 |
|
||||
| 属性 | any | None | 容器属性记录,例如 id 与 hidden |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| result | list | 包含子节点的父块 |
|
||||
|
||||
这里使用`子节点`、`种类`="column"、`槽`=""、`样式`=""。
|
||||
这里使用`子节点`、`种类`="column"、`槽`=""、`样式`=""、`属性`=None。
|
||||
|
||||
将 `子节点` 放进一层父容器,默认 `种类`="column"、`槽`=""、`样式`=""。
|
||||
几何类型为 row、column;语义类型包括 nav、header、footer、section、aside。
|
||||
值单元格保留子表,不承载拼好的 HTML;构造器只生成结构,实际形状由渲染器检查。
|
||||
|
||||
完成后返回*[调用 wrap](component.wrap(children=`子节点`, kind=`种类`, slot=`槽`, style=`样式`))*。
|
||||
完成后返回*[调用 wrap](component.wrap(children=`子节点`, kind=`种类`, slot=`槽`, style=`样式`, attrs=`属性`))*。
|
||||
|
||||
## 控件
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 种类 | text | 必填 | input、button、textarea、label、pre、option、text 或 link |
|
||||
| 值 | text | "" | 控件文字或输入框初值 |
|
||||
| 属性 | any | None | id、name、布尔标志等属性记录 |
|
||||
| 槽 | text | "" | 布局区域名 |
|
||||
| 样式 | text | "" | 可选样式类名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | 现有五列 View 结构中的单个控件叶子 |
|
||||
|
||||
这里使用`种类`、`值`=""、`属性`=None、`槽`=""和`样式`=""。当普通 Markdown 无法表示编辑框或客户端事件目标时,才使用原生控件。属性记录中的 required、hidden 等必须是布尔值;控件文字按文本转义,不解释为 HTML。表单、列表和语义区域仍用包裹函数保存子节点关系。构造器本身是纯函数,实际渲染阶段检查类型与属性;事件处理器和内联样式不能混入属性表。客户端状态可用 data 与 aria 属性,外观通过类名引用站点样式表。
|
||||
|
||||
完成描述后返回*[构造可检查的原生控件](component.element(kind=`种类`, value=`值`, attrs=`属性`, slot=`槽`, style=`样式`))*.
|
||||
|
||||
|
||||
|
||||
## 资源
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 地址 | text | 必填 | 应用提供的脚本或样式表 URL |
|
||||
| 种类 | text | "script" | script 或 stylesheet |
|
||||
| 属性 | any | None | 模块类型、完整性或 data-mq 等属性记录 |
|
||||
| 槽 | text | "" | 可选资源区域名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | list | 现有五列 View 结构中的单个资源叶子 |
|
||||
|
||||
这里使用`地址`、`种类`="script"、`属性`=None、`槽`=""。脚本节点只引用资源地址,不承载内联业务 JavaScript;样式节点引用独立 CSS 文件。地址保留在值列,其余信息保留在属性记录。构造本身不访问网络,也不验证文件存在;原生渲染器负责转义和属性检查,浏览器打开页面后才加载资源。这样运行时桥和主题可以独立组织,不需要把整个页面写成 HTML 字符串。
|
||||
|
||||
完成后返回*[声明浏览器需要的独立资源](component.asset(url=`地址`, kind=`种类`, attrs=`属性`, slot=`槽`))*.
|
||||
|
||||
|
||||
|
||||
## 请求资源
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 值 | map | 必填 | 数据查询、表单引用、导航或纯页头声明的具型资源 |
|
||||
| 槽 | text | "" | 动态内容区域的稳定名称 |
|
||||
| 样式 | text | "" | 资源外层的可选类名 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | list | 五列 View 中的一个资源节点 |
|
||||
|
||||
使用`值`、`槽`=""与`样式`="",把职责模块提供的资源放进布局。查询来自数据视图模块,表单由表单模块显式挂载,导航由下方工具构造,纯页头来自 ext/web/页头.mq.md。值单元格保留资源本身,父组件不先把子内容渲染成 HTML。
|
||||
|
||||
构造是纯计算,不查询数据库、不提交表单,也不加载插件。服务器准备请求参数、会话与 CSRF 后才解析资源。未知种类在监听前失败,缺失运行资源保留实际请求诊断。离线渲染不能伪造请求上下文或返回固定成功;纯页头声明可以离线预览,并收集进真正的 head,不作为正文占位。
|
||||
|
||||
`节点` =
|
||||
|
||||
| @ | 类型 | 槽 | 值 | 属性 | 样式 |
|
||||
|---|---|---|---|---|---|
|
||||
| 1 | resource | `槽` | `值` | None | `样式` |
|
||||
|
||||
父布局确定位置后,返回 *节点*,与静态 Markdown 和控件继续组合。
|
||||
|
||||
## 导航资源
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 项 | any | 必填 | 含 label、href 及可选 when、class、media 的链接记录 |
|
||||
| 区域 | text | "nav" | nav、sidebar 或 footer |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | map | 由实际会话决定链接可见性的纯导航资源 |
|
||||
|
||||
使用`项`与`区域`="nav"声明链接目的地。when 为 guest 或 auth 时根据当前请求会话筛选;空条件始终显示。父组件仍决定布局,原生导航渲染器保留已有类名和条件显示能力,不在作者源码中拼写整段 HTML。
|
||||
|
||||
隐藏链接不能保护目标地址。鉴权与角色门禁仍须由服务端资源显式绑定,构造导航不注册隐式路由,也不执行登录或退出。把返回值放入资源节点后,监听期间才读取真实会话;离线读取不会伪造某个用户的登录状态。
|
||||
|
||||
`资源` =
|
||||
|
||||
| _type | items | region |
|
||||
|---|---|---|
|
||||
| view_navigation | `项` | `区域` |
|
||||
|
||||
声明完可见性与目的地后,返回 *资源*,交给相同的五列 View 组合。
|
||||
@@ -15,7 +15,7 @@ marqdo call ext/web/网页/能力/索引.mq.md 加载 --effects plugin --json
|
||||
```
|
||||
|
||||
页面结构用五列 View 记录,父值保留子表。纯布局、DOM 构造和客户端描述无需插件。
|
||||
整站服务通过 launcher 的 marqdo run 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
整站服务通过网页.服务或工程入口的 serve 函数用 marqdo call 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
读取另一个进程的私有应用。结构化 Document 使用 视图: main,在启动时执行布局装配。
|
||||
|
||||
开发时先复用组件和布局模块,再改对应领域实现;保持中英入口与真实契约一致。
|
||||
|
||||
@@ -16,7 +16,7 @@ marqdo call ext/web/网页/路由/索引.mq.md 注册 '路由=$route' --effects
|
||||
```
|
||||
|
||||
页面结构用五列 View 记录,父值保留子表。纯布局、DOM 构造和客户端描述无需插件。
|
||||
整站服务通过 launcher 的 marqdo run 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
整站服务通过网页.服务或工程入口的 serve 函数用 marqdo call 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
读取另一个进程的私有应用。结构化 Document 使用 视图: main,在启动时执行布局装配。
|
||||
|
||||
开发时先复用组件和布局模块,再改对应领域实现;保持中英入口与真实契约一致。
|
||||
|
||||
@@ -16,7 +16,7 @@ marqdo call ext/web/网页/页面/索引.mq.md 渲染 '页面=$pg' --effects plu
|
||||
```
|
||||
|
||||
页面结构用五列 View 记录,父值保留子表。纯布局、DOM 构造和客户端描述无需插件。
|
||||
整站服务通过 launcher 的 marqdo run 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
整站服务通过网页.服务或工程入口的 serve 函数用 marqdo call 启动;检视磁盘站点请给出根目录,不能从新进程
|
||||
读取另一个进程的私有应用。结构化 Document 使用 视图: main,在启动时执行布局装配。
|
||||
|
||||
开发时先复用组件和布局模块,再改对应领域实现;保持中英入口与真实契约一致。
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 文档页头资源:SEO、字体与资源链接
|
||||
import:
|
||||
head: ext/web/head.mq.md
|
||||
---
|
||||
|
||||
本文件对应 head.mq.md。结构化页面将本资源交给组件的请求资源节点,服务器与离线预览都把它收集到真正的 head,不在正文或片段中留下占位。沿用现有五列 View,不增加新标记、嵌套元数据或页面变异链。
|
||||
|
||||
```sh
|
||||
marqdo call ext/web/页头.mq.md 声明 '元数据=[{"key":"description","value":"可读的站点"}]' --json
|
||||
```
|
||||
|
||||
## 声明
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 元数据 | any | None | key/value 行记录或 GFM 列式表,值为原生标量 |
|
||||
| 链接 | any | None | rel/href 原生资源记录,支持媒体、跨域及脚本标志 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | map | 供组件安放的纯 document_head 描述 |
|
||||
|
||||
使用`元数据`=None、`链接`=None,构造不需要任何副作用。元数据保留 description、og: 等 SEO 名称,title、canonical、icon 等沿用普通文档约定;charset、viewport 和 csrf-token 归运行时所有,不在这里重声明。
|
||||
|
||||
链接复用原生 rel/href 表与中文字段别名,可声明字体预连接、样式、图标或显式脚本资源。地址只允许 / 开头的站内路径与 http(s),不接受活动数据方案或协议相对地址。这里不下载字体、不执行脚本、不挂载静态文件;浏览器打开实际页面后才请求地址。官方桥仍用客户端挂载节点,不在资源里写业务 JavaScript。
|
||||
|
||||
多个子组件可以贡献资源,相同链接去重,同名元数据有不同值时保留诊断,不静默覆盖。片段不会重复输出页头;离线预览能处理本纯资源,但查询、表单与会话导航仍需真实请求上下文。缺失文件、网络可用性和页面视觉效果须另做实际验证,构造描述不能证明这些条件。
|
||||
|
||||
声明完成后返回 *[复用同一个文档页头契约](head.resource(meta=`元数据`, links=`链接`))*。
|
||||
Reference in new issue
Block a user