Compare commits

...
6 Commits
Author SHA1 Message Date
cflmyandCursor 3287799959 docs(skill): note table-bound page.compose_intro for v1.0.2
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 21:06:30 +08:00
cflmyandCursor f95e5d3339 release: v1.0.2 — table-bound page intro (compose_intro)
Ship web_compose_intro / 引言装配 and web-site demo polish; bump Cargo and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 21:05:49 +08:00
cflmyandCursor 52b4bae423 feat(web-site): harden sample desk, auth login, and form layout
Align nav/side/foot slots and shell CSS with table-driven admin desk;
add session login/logout mount and widen form fields for usable create UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 19:44:12 +08:00
cflmyandCursor 037592087c feat(web): table-bound intro and demo-grade web-site sample
Add compose_intro (属性/值/样式) so page heroes are not HTML strings, and polish examples/web-site for WWW Demo: literary shell, card→detail routes, richer seeds, particle atmosphere without author JS.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 17:34:49 +08:00
cflmyandCursor 3eb8e732ea release: v1.0.1 — fix Go libweb dynamic-route query, Markdown, CSS false positives
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-15 14:48:47 +08:00
cflmyandCursor 761b92afce docs(public): keep narrative emphasis from executing as v0.3 code
Unbold code-shaped prose and give log.fields a map so pages and
`view output` stay green under markup v0.3.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-14 16:15:47 +08:00
49 changed files with 2887 additions and 173 deletions

No files matched your search

+1 -1
View File
@@ -199,7 +199,7 @@ data/ # sqlite runtime (gitignore)
**Typical flow:** `db.init` → `page.compose_*` → `app` + `static` / `listen`. Client: `marqdo wasm build -o static` + `web.client_embed source="/static/client.mq.md"` — **no author JS**; bridge may implement rich host effects ([browser-wasm-e.md](../../doc/roadmap/browser-wasm-e.md) · [browser-app](../../examples/browser-app/)).
**Shipped surface (W0–W7 + P3 + W8 + route D mount):** middleware + JSON API (`app.configure`); transactions, pagination, FTS search (`db.migrate`, `db.fts`, `db.search`); security (argon2, CSRF, SQLite sessions, login rate limit); SEO / RSS / Markdown (`page.meta`, `route_rss`, `lib/net.markdown_parse`); upload / download / gallery; sitemap / robots / error pages / redirects; RBAC (`app.gate`, user `role`); audit timestamps + FK in `db.init`; ETag on downloads; **W8** site icons (`app.icons` → `/favicon.ico`), head resource tables (`page.head`), image assembly (`make_images` / `page.images`); **D** `client_embed` auto-mount + DOM effect helpers (`text_patch` / `dom_patch`).
**Shipped surface (W0–W7 + P3 + W8 + route D mount):** middleware + JSON API (`app.configure`); transactions, pagination, FTS search (`db.migrate`, `db.fts`, `db.search`); security (argon2, CSRF, SQLite sessions, login rate limit); SEO / RSS / Markdown (`page.meta`, `route_rss`, `lib/net.markdown_parse`); upload / download / gallery; sitemap / robots / error pages / redirects; RBAC (`app.gate`, user `role`); audit timestamps + FK in `db.init`; ETag on downloads; **W8** site icons (`app.icons` → `/favicon.ico`), head resource tables (`page.head`), image assembly (`make_images` / `page.images`); **表驱动引言** `page.compose_intro` / `页面.引言装配`(属性/值/样式表 → `.main-intro`,避免手写 HTML 字符串);**D** `client_embed` auto-mount + DOM effect helpers (`text_patch` / `dom_patch`).
Design: [ext-web.md](../../doc/design/ext-web.md) · assets: [web-assets-and-images.md](../../doc/design/web-assets-and-images.md) · capability matrix: [web-net-capabilities.md](../../doc/design/web-net-capabilities.md) · example: [examples/marqdo-blog/](../../examples/marqdo-blog/) · client: [examples/web-client-site/](../../examples/web-client-site/).
+3 -2
View File
@@ -124,8 +124,9 @@ jobs:
## Marqdo ${{ github.ref_name }}
### 亮点 / Highlights
- **v1.0.0**:Markdown 语法映射 v0.3 为唯一运行时(`**` 代码 / `*` 返回 / 叙述 `` `名` ``)
- **v1.0.0**: markup mapping v0.3 is the sole runtime (`**` code / `*` return / prose decls)
- **v1.0.2**:表驱动页面引言 `compose_intro` / `引言装配`;web-site Demo 与后台门禁加固
- **v1.0.2**: table-bound page intro (`compose_intro`); web-site demo + desk auth polish
- **v1.0.1**:修复 Go `libweb` 动态路由 `{param}` 查询代入、详情 Markdown、CSS 数字误报
- **Linux 包必出**:`*-native-x86_64-unknown-linux-gnu.zip` + Linux CLI bundle
- Details: [CHANGELOG](https://github.com/cflmy/marqdo/blob/main/CHANGELOG.md) · [mapping v0.3](https://github.com/cflmy/marqdo/blob/main/doc/design/markdown-mapping-v0.3.md)
+47
View File
@@ -8,6 +8,53 @@
### Changed
## v1.0.2 — 2026-09-16
### Highlights
**表驱动页面引言(`compose_intro` / `引言装配`)**:英雄区用 GFM「属性 / 值 / 样式」表声明,不再手写 HTML 字符串;WWW Demo 样站与后台门禁一并加固。
```bash
git checkout v1.0.2
cargo build --release
bash ./scripts/build-web-plugin.sh
# 或:解压 Release 的 marqdo-1.0.2-*-native-*.zip / Linux CLI zip
marqdo run examples/web-site-zh/index.mq.md
```
### Added
- Go `libweb`:`web_compose_intro` — 将引言表装配为 `.main-intro` HTML;中英 API `页面.引言装配` / `page.compose_intro`(`ext/web`)。
- 验收样例:`tests/ext/web-intro-compose.mq.md`;`examples/web-site` / `web-site-zh` 升级为表驱动引言 + 文学风壳层 + 卡片→详情路由。
### Fixed
- 后台样站:导航/侧栏/页脚槽位与门禁登录挂载对齐;表单字段加宽便于创建。
### Changed
- Demo 叙述与种子数据面向 WWW Industry / 可复现演示;作者仍零业务 JS、零手写 `.css`。
## v1.0.1 — 2026-09-15
### Highlights
**ext/web(Go libweb)回归修复**:动态路由查询条件恢复 `{param}` 代入;详情 SSR + Markdown;样式表数字不再误报。
```bash
git checkout v1.0.1
cargo build --release
bash ./scripts/build-web-plugin.sh
# 或:解压 Release 的 marqdo-1.0.1-*-native-*.zip / Linux CLI zip
marqdo run examples/marqdo-blog/index.mq.md
```
### Added
- Go web plugin:详情页正文 Markdown(goldmark GFM),对齐 Rust `pulldown-cmark` 路径。
### Fixed
- **动态路由 `{param}` 未代入查询条件**(`ext/web` Go):`selectPageData` 递归展开 `query` 全部字符串叶子;`data-slot-src` / `_route` 同步替换。`examples/marqdo-blog` `/post/{slug}` 详情 SSR 恢复。
- **样式表数字单元格误报「可疑 `/` 除法」**:`cssValueSuspicious` 不再把合法 `z-index`/`opacity` 等 number 当警告。
- Go 1.22+ ServeMux:`/static/` 与 `/static/favicon.svg` 的 GET/HEAD 注册冲突导致博客启动 panic。
- Rust archive 同步:`resolve_placeholders` 递归 + CSS number 误报收窄(非默认构建路径)。
## v1.0.0 — 2026-09-14
### Highlights
Generated
+2 -2
View File
@@ -572,7 +572,7 @@ checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]]
name = "marqdo"
version = "1.0.0"
version = "1.0.2"
dependencies = [
"anyhow",
"assert_cmd",
@@ -603,7 +603,7 @@ dependencies = [
[[package]]
name = "marqdo-wasm"
version = "1.0.0"
version = "1.0.2"
dependencies = [
"marqdo",
"serde_json",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "marqdo"
version = "1.0.0"
version = "1.0.2"
edition = "2021"
license = "Apache-2.0"
description = "Marqdo — Markdown markers as an interpreted programming language"
+6 -5
View File
@@ -98,7 +98,7 @@ marqdo catalog public -o .marqdo
---
## 现状(v1.0.0)
## 现状(v1.0.2)
- 映射与解释器:**v0.3 语法宪法**(`**` 代码 / `*` 返回 / 叙述声明);Phase I 树遍历 + 字节码后端;金样例在 `tests/` 与 `tests/markup-v03/`
- **对象**:`#` = 类型/构造,`##`+ = 函数/方法;见 [objects.md](doc/design/objects.md)
@@ -108,7 +108,7 @@ marqdo catalog public -o .marqdo
- **`marqdo version --check`**:与 GitHub 最新 release 对比
- 标准库:**内置于二进制**(v0.1.2+);磁盘 `lib/` 或 `MARQDO_LIB` 可覆盖。模块含文本、表、**浏览器效应**、文件、系统、时间、JSON、网络、数学、外联、插件、**自写回**、**子任务**;**中层 Mid M1–M6** + **Mid2 M7–M10**(datetime/url/toml/html/fs++/stats/log.fields 等,见 [stdlib-mid.md](doc/design/stdlib-mid.md) · [stdlib-mid2.md](doc/design/stdlib-mid2.md))
- **官方扩展库 `ext/`**(**非** stdlib,本版收口):
- **`web`**:W0–W7 + P3 + **W8**;**定制 C0–C4**;**宿主 H1–H2**(`proxy`/`invoke`,见 [ext-hosting.md](doc/roadmap/ext-hosting.md));原生层默认 **Go `libweb`**([ADR 0004](doc/adr/0004-web-plugin-go.md),`scripts/build-web-plugin.sh`);示例 [marqdo-blog](examples/marqdo-blog/) · [anlian-mq](examples/anlian-mq/);生产路径见 [web-asgi-servers-and-marqdo.md](doc/design/web-asgi-servers-and-marqdo.md)
- **`web`**:W0–W7 + P3 + **W8**;**定制 C0–C4**;**宿主 H1–H2**(`proxy`/`invoke`,见 [ext-hosting.md](doc/roadmap/ext-hosting.md));**表驱动引言**(`compose_intro` / `引言装配`);原生层默认 **Go `libweb`**([ADR 0004](doc/adr/0004-web-plugin-go.md),`scripts/build-web-plugin.sh`);示例 [web-site](examples/web-site/) · [web-site-zh](examples/web-site-zh/) · [marqdo-blog](examples/marqdo-blog/) · [anlian-mq](examples/anlian-mq/);生产路径见 [web-asgi-servers-and-marqdo.md](doc/design/web-asgi-servers-and-marqdo.md)
- **`quantum`**:Q0–Q7 + Q8a/b 主题 SVG;示例 [quantum-entanglement](examples/quantum-entanglement/)
- **`linalg`**:L0–L6 + 公式文档面(中缀 / `declare` / 展示化简);示例 [linalg-transpose](examples/linalg-transpose/) · [linalg-svd](examples/linalg-svd/) · [linalg-least-squares](examples/linalg-least-squares/)
- **`agent`**:A1–A4 + **MCP Server stdio**(`mcp_server`);宿主缺口见 [ext-hosting.md](doc/roadmap/ext-hosting.md) · [agent-framework-gaps-after-a4.md](doc/research/agent-framework-gaps-after-a4.md)
@@ -120,12 +120,12 @@ marqdo catalog public -o .marqdo
- **浏览器 Marqdo(WASM)**:`marqdo wasm build` + 官方 bridge 自启(作者零业务 JS;桥内可含列表/路由/storage/ws/文件/Canvas/音频/Observer/拖放);`lib/browser` + GFM;`web.client_embed`;示例 [browser-hello](examples/browser-hello/) · [browser-app](examples/browser-app/) · [browser-media](examples/browser-media/) · [web-client-site](examples/web-client-site/)([ADR 0002](doc/adr/0002-browser-marqdo-wasm.md) · [D](doc/roadmap/browser-wasm-d.md) · [E](doc/roadmap/browser-wasm-e.md) · [F](doc/roadmap/browser-wasm-f.md))
- 选型:[ADR 0001 — Rust](doc/adr/0001-implementation-language.md) · [ADR 0002 — 浏览器 WASM](doc/adr/0002-browser-marqdo-wasm.md)(C0–C5 完结,见 [roadmap/browser-wasm.md](doc/roadmap/browser-wasm.md))· [ADR 0003 — 异步效应](doc/adr/0003-browser-async-effects.md)
### 如何使用最新 Marqdo(v1.0.0)
### 如何使用最新 Marqdo(v1.0.2)
```bash
# 1) 源码安装(跟 tag 或 main)
git clone https://github.com/cflmy/marqdo.git && cd marqdo
git checkout v1.0.0 # 或留在 main
git checkout v1.0.2 # 或留在 main
cargo build --release
export PATH="$PWD/target/release:$PATH"
marqdo version
@@ -149,6 +149,7 @@ marqdo ext add llm # 或:大模型(纯 .mq.md)
# 离线:解压 Windows zip(已含 ext/native)或手动放下 native zip;MARQDO_EXT_NO_DOWNLOAD=1
# 4) 动态站示例(扩展装好后)
marqdo run examples/web-site-zh/index.mq.md # 表驱动引言 Demo
marqdo run examples/marqdo-blog/index.mq.md
marqdo run examples/anlian-mq/index.mq.md # W-G14 验收站
# 浏览器打开终端打印的 listen 地址;/favicon.ico 与 logo 装配见 W8
@@ -158,7 +159,7 @@ marqdo wasm build
# → dist/wasm/ … 见 examples/browser-hello/
# 6) Releases:Windows exe/zip/vsix;Linux CLI zip + native `.so` zip
# https://github.com/cflmy/marqdo/releases/tag/v1.0.0
# https://github.com/cflmy/marqdo/releases/tag/v1.0.2
```
开发期也可用 `cargo run -- …` 代替已安装的 `marqdo`:
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "marqdo-wasm"
version = "1.0.0"
version = "1.0.2"
edition = "2021"
license = "Apache-2.0"
description = "Marqdo interpreter as WebAssembly (browser host bridge)"
+3 -4
View File
@@ -1,10 +1,9 @@
# examples/web-site-zh
中文作者面示例:只导入 `ext/web/网页.mq.md`(不用英文 `web.mq.md`)。
与 [`examples/web-site`](../web-site/) 对等(`ext/web/网页.mq.md`)。
```bash
cargo build -p marqdo_plugin_web
cargo run -- examples/web-site-zh/index.mq.md
marqdo run examples/web-site-zh/index.mq.md
```
打开 http://127.0.0.1:18082/ — `/about`、`/new`、`/admin`、`/static/site.css`。
http://127.0.0.1:18082/ — 演示脚本见英文样站 [DEMO.md](../web-site/DEMO.md)。
@@ -0,0 +1,29 @@
---
title: components/desk
description: 管理台壳 — 顶栏品牌为「后台」,无前台侧栏。
---
## nav
`nav` =
| 属性 | 值 | 样式 | 媒体 | 当 |
|------|-----|------|------|-----|
| 后台 | /admin | | | |
| 站点 | / | | | |
| 写文章 | /new | | | |
| 退出 | /admin/logout | | | auth |
*`nav`*
## foot
`foot` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 站点 | / | |
| 后台 | /admin | |
| 退出 | /admin/logout | |
*`foot`*
+3 -1
View File
@@ -4,6 +4,8 @@
| 属性 | 值 | 样式 |
|------|-----|------|
| Marqdo | https://github.com | |
| Marqdo | https://www.marqdo.com/ | |
| Source | https://github.com/cflmy/marqdo | |
*`foot`*
+10 -6
View File
@@ -1,12 +1,16 @@
## nav
顶栏:**登录**(访客)/ **后台** + **退出**(已登录)。
`nav` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 首页 | / | |
| 关于 | /about | |
| 写文章 | /new | |
| 后台 | /admin | |
| 属性 | 值 | 样式 | 媒体 | 当 |
|------|-----|------|------|-----|
| Marqdo | / | | | |
| 关于 | /about | | | |
| 写文章 | /new | | | |
| 登录 | /login | | | guest |
| 后台 | /admin | | | auth |
| 退出 | /admin/logout | | | auth |
*`nav`*
+7 -4
View File
@@ -2,9 +2,12 @@
`side` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 笔记 | / | |
| 文档 | https://github.com | |
| 属性 | 值 | 样式 | 媒体 | 当 |
|------|-----|------|------|-----|
| 1. 首页 | / | | | |
| 2. 写文章 | /new | | | |
| 3. 登录 | /login | | | guest |
| 3. 后台 | /admin | | | auth |
| 关于 | /about | | | |
*`side`*
+14 -4
View File
@@ -6,17 +6,27 @@
|------|------|------|
| id | integer | false |
| title | text | false |
| slug | text | false |
| summary | text | true |
| body | text | true |
*`fields`*
## seed
卡片显示 summary;/post/{slug} 显示完整 body(Markdown)。
`rows` =
| id | title | body |
|----|-------|------|
| 1 | 你好 Marqdo | 第一篇来自 GFM 表格。 |
| 2 | 代码即文档 | 页面表就是程序。 |
| id | title | slug | summary | body |
|----|-------|------|---------|------|
| 1 | 你好 Marqdo | hello-marqdo | 一份可执行 Markdown 既是站点说明,也是上线制品——路由、表单与样式都用表声明。 | "Marqdo 把 .mq.md 当作可执行文档。编辑器里读到的叙述,就是服务器跑起来的同一份制品:GFM 表变成 schema、表单、导航与 CSS。本 Demo 走完这条契约——打开「写文章」、触发规则表校验,再发布一行,首页与后台同时出现,全程无需作者业务 JavaScript。" |
| 2 | 表即全栈 | tables-full-stack | Schema、表单、路由、后台与主题令牌共用一套表方言,而不是 JS/CSS 分家。 | "常见技术栈把关切拆进多种语言:数据用 SQL/ORM,输入用表单库,URL 用路由,外观用手写样式。Marqdo 把这些表面收成作者本来就会写的 GFM 表。字段表、规则表、绑定表、样式表不是比喻,而是运行时。结果是一份既能当散文扫读、又能当程序执行的站点。" |
| 3 | 零作者 JS 与 CSS | zero-author-js-css | 业务留在 Markdown;外观是样式表加宿主壳——无作者业务 JS、无作者 .css。 | "作者业务 JavaScript 从构造上为零:校验来自服务端规则表,列表/详情由绑定表交给宿主渲染。主题令牌写在属性/值表里,经样式装配变成 CSS,作者也不必维护 .css 文件。本 Demo 关闭壳样式,只让声明过的样式上色——方便会议观众当场核对主张。" |
| 4 | 一表打通卡片与详情 | card-to-detail | 列表把 href 绑到 slug;/post/{slug} 加详情=真即可打开全文。 | "点击首页任意卡片。列表绑定用 articles.slug 作为 href,链接前缀补上 /post/。详情页复用同一张表,查询条件 slug = {slug},再页面.详情,首行就渲染成完整文章(标题 + Markdown 正文),而不是卡片网格。这与求道量子等更大的 Marqdo 站同一套路。" |
| 5 | 样式表不是样式文件 | style-tables | 具名样式表(kicker、intro_title、card_title)通过绑定表第三列挂上。 | "引言、卡片与壳层都用属性/值/样式绑定。样式列指向 styles/shell.mq.md 里的具名属性表。引言装配或主体装配时,这些表变成页面上的 CSS 类。改 Demo 外观不必打开 .css——改可读的 Markdown 表,文案与样式仍挨在一起。" |
| 6 | 表单来自字段表与规则表 | forms-from-tables | 「写文章」空标题会因规则表失败;合法提交写入与后台共享的一行。 | "写文章与后台挂载同一表单对象:字段表声明标签与类型,规则表声明 required、max 与提示文案。空标题提交时错误来自服务端,不是客户端脚本。填好标题与 slug 再提交,卡片网格与后台列表都会出现——一张 schema、两个表面、零作者 JS。" |
| 7 | 种子数据就是文档 | seed-is-docs | 这些段落写在 GFM 种子表里——Demo 正文也是程序的一部分。 | "种子行与 schema 同在 db/articles.mq.md。首次启动若表为空,宿主会插入它们。于是 Demo 叙述与代码同版本:卡片用稍长摘要,详情用更长正文,slug 保证深链稳定。审稿人打开种子表,就能看到会场站点将展示的内容。" |
| 8 | 为什么要做这个 Demo | why-demo-matters | WWW Demo 需要审稿人几分钟内能跑、能点、能对照源码的制品。 | "Demo 轨道要的是可运行系统,不是只靠幻灯片。本样站刻意很小:一张 SQLite 表、几条路由、一套文学风壳层——却覆盖论文主张(表即全栈),并配三步操作脚本。克隆仓库,运行样站,点开卡片,弄坏一次表单,再把 index.mq.md 与浏览器对照。这个闭环就是投稿本身。" |
*`rows`*
+146 -8
View File
@@ -1,37 +1,113 @@
---
title: 中文站点示例
description: Home + /about + /new(表单嵌入)+ 后台;只用 ext/web/网页.mq.md。
description: >-
与 examples/web-site 对等的 WWW Demo 样站:表驱动全站;作者业务 JS=0;作者 .css=0。
导入 网页:ext/web/网页.mq.md
import shell:styles/shell.mq.md
import nav:components/nav.mq.md
import side:components/side.mq.md
import foot:components/foot.mq.md
import desk:components/desk.mq.md
import articles:db/articles.mq.md
import db:db/index.mq.md
---
# main
本文件既是站点说明,也是可运行应用。
`home` =
| 组件 | 样式 |
|------|------|
| nav.`nav` | shell.`topnav` |
| side.`side` | shell.`side_panel` |
| foot.`foot` | |
| foot.`foot` | shell.`footer` |
后台壳:去掉前台侧栏,顶栏品牌改为「后台」。
`desk_shell` =
| 组件 | 样式 |
|------|------|
| desk.`nav` | shell.`topnav` |
| desk.`foot` | shell.`footer` |
`index` =
| 属性 | 值 | 样式 |
|------|-----|------|
| title | articles.`articles`.title | shell.`card_title` |
| body | articles.`articles`.body | shell.`card_body` |
| body | articles.`articles`.summary | shell.`card_body` |
| href | articles.`articles`.slug | |
`detail` =
| 属性 | 值 | 样式 |
|------|-----|------|
| title | articles.`articles`.title | shell.`card_title` |
| body | articles.`articles`.body | |
`by_slug` =
| 字段 | 操作 | 值 |
|------|------|-----|
| slug | = | {slug} |
`首页引言` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 眉题 | WWW Demo · 表即全栈 | shell.`kicker` |
| 标题 | Marqdo | shell.`intro_title` |
| 导语 | "一份可执行 Markdown 声明路由、表单、后台与样式——作者零业务 JavaScript、零手写 .css。点击卡片打开全文,再按下列三步动手试。" | shell.`lede` |
| 标签 | 0 作者 JS | shell.`claim` |
| 标签 | 0 作者 .css | shell.`claim` |
| 标签 | GFM 表 | shell.`claim` |
| 步骤 | "点击任意卡片 — /post/{slug} 用同一张 articles 表打开详情。" | shell.`step` |
| 步骤 | "打开 [写文章](/new),空标题提交(规则表校验)。" | shell.`step` |
| 步骤 | "点顶栏 **登录**(admin / demo),再进 **后台** — 门禁管理台:创建表单 + 列表。" | shell.`step` |
`关于引言` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 眉题 | 关于 | shell.`kicker` |
| 标题 | 关于 | shell.`intro_title` |
| 导语 | "文档与站点同一 .mq.md 制品。版式与主题是 styles/shell.mq.md 里的 GFM 样式表——无需手写 CSS 或业务 JavaScript。" | shell.`lede` |
`写文章引言` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 眉题 | 表单 · 试校验 | shell.`kicker` |
| 标题 | 写文章 | shell.`intro_title` |
| 导语 | 空标题提交应失败(规则表,非客户端 JS);填写标题、slug 与摘要后与后台、卡片网格共享一行。 | shell.`lede` |
`后台引言` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 眉题 | 管理台 · 已进入后台 | shell.`kicker` |
| 标题 | 后台 | shell.`intro_title` |
| 导语 | "这就是管理台(需登录):与前台共用 articles schema,装配成列表 + 创建表单——不是另写一套 SPA。顶栏「站点」回前台,「退出」结束会话。" | shell.`lede` |
| 标签 | 登录门禁 | shell.`claim` |
| 标签 | 表声明 | shell.`claim` |
| 标签 | "创建 + 列表" | shell.`claim` |
`文章引言` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 眉题 | 文章 · 表绑定详情 | shell.`kicker` |
`article_fields` =
| 字段 | 标签 | 类型 | 必填 | 默认 |
|------|------|------|------|------|
| title | 标题 | text | true | |
| slug | slug | text | true | |
| summary | 摘要 | textarea | false | |
| body | 正文 | textarea | false | |
`article_rules` =
@@ -40,26 +116,88 @@ import db:db/index.mq.md
|------|------|------|
| title | required | 标题不能为空 |
| title | max:120 | 标题太长 |
| slug | required | slug 不能为空 |
| slug | max:80 | slug 太长 |
| summary | max:500 | 摘要太长 |
| body | max:8000 | 正文太长 |
`home_meta` =
| key | value |
|-----|-------|
| description | 表即全栈 — Marqdo 网页示例;作者零业务 JavaScript。 |
| og:type | website |
| og:title | Marqdo 中文站 |
`fonts` =
| 关系 | 地址 | 跨域 |
|------|------|------|
| preconnect | https://fonts.googleapis.com | |
| preconnect | https://fonts.gstatic.com | anonymous |
| stylesheet | https://fonts.googleapis.com/css2?family=Great+Vibes&family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;600&display=swap | |
**store = > db.open**
**page = > 网页.页面 标题="Marqdo 中文站" 引言="<h1>中文站</h1><p>表格 + 类方法。</p>"**
**site_css = > shell.css**
**page = > 网页.页面 标题="Marqdo 中文站" 壳样式="off"**
**page = > page.引言装配 引言=`首页引言`**
**page = > page.元数据 元数据=home_meta**
**page = > page.头装配 表=fonts**
**page = > page.样式 样式=site_css**
**page = > page.组件装配 组件=home**
**page = > page.主体装配 主体=index**
**page = > page.链接前缀 前缀="/post/"**
**about = > 网页.页面 标题="关于" 引言="<h1>关于</h1><p>导入网页.mq.md 即用中文 API。</p>"**
**about = > 网页.页面 标题="关于 · Marqdo 中文站" 壳样式="off"**
**about = > about.引言装配 引言=`关于引言`**
**about = > about.头装配 表=fonts**
**about = > about.样式 样式=site_css**
**about = > about.组件装配 组件=home**
**article_form = > 网页.表单 表="articles" 动作="插入"**
**article_form = > article_form.字段 字段=article_fields**
**article_form = > article_form.规则 规则=article_rules**
**new = > 网页.页面 标题="写文章" 引言="<h1>写文章</h1><p>表单嵌在主区。</p>"**
**new = > 网页.页面 标题="写文章 · Marqdo 中文站" 壳样式="off"**
**new = > new.引言装配 引言=`写文章引言`**
**new = > new.头装配 表=fonts**
**new = > new.样式 样式=site_css**
**new = > new.组件装配 组件=home**
**new = > new.表单装配 id="article" 表单=article_form**
**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18082**
**desk = > 网页.页面 标题="后台 · Marqdo 中文站" 壳样式="off"**
**desk = > desk.壳HTML 体类="is-desk"**
**desk = > desk.引言装配 引言=`后台引言`**
**desk = > desk.头装配 表=fonts**
**desk = > desk.样式 样式=site_css**
**desk = > desk.组件装配 组件=desk_shell**
**desk = > desk.表单装配 id="article" 表单=article_form**
**desk = > desk.主体装配 主体=index**
**desk = > desk.链接前缀 前缀="/post/"**
**post = > 网页.页面 标题="文章 · Marqdo 中文站" 壳样式="off"**
**post = > post.引言装配 引言=`文章引言`**
**post = > post.头装配 表=fonts**
**post = > post.样式 样式=site_css**
**post = > post.组件装配 组件=home**
**post = > post.主体装配 主体=detail**
**post = > post.查询条件 条件=by_slug**
**post = > post.详情 详情=True**
演示账号(用户表声明;宿主会话鉴权,无作者 JS)。
`管理员` =
| 用户名 | 密码 | 角色 |
|--------|------|------|
| admin | demo | admin |
**app = > 网页.应用 页面=page 数据库=store 后台=False 主机="127.0.0.1" 端口=18082 壳样式="off" 登录回跳="/admin" 登出回跳="/"**
**app = > app.路由 路径="/about" 页面=about**
**app = > app.路由 路径="/new" 页面=new**
**app = > app.静态 目录="public" 挂载="/static"**
**app = > app.路由 路径="/admin" 页面=desk**
**app = > app.路由 路径="/post/{slug}" 页面=post**
**app = > app.鉴权 用户表=`管理员` 会话时长=3600 登录路径="/login" 登录回跳="/admin" 登出回跳="/"**
**app = > app.门禁 路径="/admin" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/login"**
> `app`.监听
-5
View File
@@ -1,5 +0,0 @@
/* 可选站点样式 — /static/site.css */
body.site-hint::before {
content: "static ok";
display: none;
}
+640 -7
View File
@@ -1,11 +1,233 @@
---
title: styles/shell
description: >-
Literary dark theme for examples/web-site — ink / wine / gold after the
anlian.cyou Zhang Ailing topic. GFM tables only; no author .css.
import web:ext/web/web.mq.md
import text:lib/text.mq.md
---
Authors style the site with **GFM tables** only. App pages use `shell_css=off`
so host defaults do not fight this theme. Palette mirrors
[海上花开](https://www.anlian.cyou/topics/author-zhangailing/): night ink,
wine, cold gold, serif display.
## vars
`vars` =
| 选择器 | 属性 | 值 |
|--------|------|-----|
| :root | --ink | #0a0809 |
| :root | --ink-lift | #141012 |
| :root | --wine | #6b1e3a |
| :root | --wine-soft | rgba(107,30,58,0.35) |
| :root | --gold | #d4af37 |
| :root | --gold-dim | rgba(212,175,55,0.45) |
| :root | --gold-soft | rgba(212,175,55,0.12) |
| :root | --paper | rgba(255,248,240,0.92) |
| :root | --paper-dim | rgba(255,248,240,0.72) |
| :root | --paper-faint | rgba(255,248,240,0.48) |
| :root | --glass | rgba(20,12,18,0.72) |
| :root | --glass-strong | rgba(20,12,18,0.88) |
| :root | --border | rgba(212,175,55,0.22) |
| :root | --border-soft | rgba(212,175,55,0.12) |
| :root | --danger | #e8a0a8 |
| :root | --radius | 4px |
| :root | --radius-sm | 2px |
| :root | --space-2 | 8px |
| :root | --space-3 | 12px |
| :root | --space-4 | 16px |
| :root | --space-5 | 20px |
| :root | --space-6 | 24px |
| :root | --space-8 | 32px |
| :root | --text | 16px |
| :root | --leading | "1.75" |
| :root | --shadow | "0 24px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06)" |
| :root | --shadow-card | "0 12px 40px rgba(107,30,58,.35)" |
| :root | --ring | "0 0 0 2px rgba(212,175,55,.35)" |
| :root | --serif | "'Noto Serif SC', 'Source Serif 4', Georgia, serif" |
| :root | --sans | "'Noto Sans SC', 'IBM Plex Sans', system-ui, sans-serif" |
| :root | --display | "'Great Vibes', 'Allura', cursive" |
| :root | --mono | "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" |
| ::selection | background | rgba(212,175,55,0.35) |
| ::selection | color | var(--paper) |
*`vars`*
## motion
`motion` =
| 选择器 | 属性 | 值 |
|--------|------|-----|
| @keyframes rise 0% | opacity | "0" |
| @keyframes rise 0% | transform | translateY(14px) |
| @keyframes rise 100% | opacity | "1" |
| @keyframes rise 100% | transform | translateY(0) |
| @keyframes float 0% | transform | translateY(0) |
| @keyframes float 0% | opacity | "0.7" |
| @keyframes float 50% | transform | translateY(6px) |
| @keyframes float 50% | opacity | "1" |
| @keyframes float 100% | transform | translateY(0) |
| @keyframes float 100% | opacity | "0.7" |
| @keyframes goldPulse 0% | text-shadow | "0 0 24px rgba(212,175,55,.2)" |
| @keyframes goldPulse 50% | text-shadow | "0 0 48px rgba(212,175,55,.45)" |
| @keyframes goldPulse 100% | text-shadow | "0 0 24px rgba(212,175,55,.2)" |
| @keyframes particleDrift 0% | transform | translate3d(0,0,0) |
| @keyframes particleDrift 50% | transform | translate3d(-2.5vw, 1.5vh, 0) |
| @keyframes particleDrift 100% | transform | translate3d(0,0,0) |
| @keyframes particleDrift2 0% | transform | translate3d(0,0,0) |
| @keyframes particleDrift2 50% | transform | translate3d(2vw, -2vh, 0) |
| @keyframes particleDrift2 100% | transform | translate3d(0,0,0) |
| @keyframes nebulaPulse 0% | opacity | "0.55" |
| @keyframes nebulaPulse 50% | opacity | "0.9" |
| @keyframes nebulaPulse 100% | opacity | "0.55" |
*`motion`*
## layout
`layout` =
| 选择器 | 属性 | 值 |
|--------|------|-----|
| * | box-sizing | border-box |
| html | scroll-behavior | smooth |
| html | -webkit-text-size-adjust | 100% |
| body | margin | "0" |
| body | min-height | 100vh |
| body | font-family | var(--sans) |
| body | font-weight | "400" |
| body | font-size | var(--text) |
| body | line-height | var(--leading) |
| body | color | var(--paper) |
| body | background | var(--ink) |
| body | background-image | "radial-gradient(ellipse 90% 55% at 50% -15%, rgba(107,30,58,.5), transparent 58%), radial-gradient(ellipse 55% 45% at 92% 75%, rgba(212,175,55,.14), transparent 55%), radial-gradient(ellipse 40% 35% at 8% 70%, rgba(107,30,58,.22), transparent 60%), linear-gradient(180deg, #0a0809 0%, #120c10 45%, #0a0809 100%)" |
| body | background-attachment | fixed |
| body | display | grid |
| body | grid-template-rows | "auto 1fr auto" |
| body | -webkit-font-smoothing | antialiased |
| body | position | relative |
| body | overflow-x | hidden |
| body::before | content | '""' |
| body::before | position | fixed |
| body::before | inset | "0" |
| body::before | z-index | "1" |
| body::before | pointer-events | none |
| body::before | opacity | "0.1" |
| body::before | background-image | "url(\"data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")" |
| html::before | content | '""' |
| html::before | position | fixed |
| html::before | inset | "0" |
| html::before | z-index | "0" |
| html::before | pointer-events | none |
| html::before | background-image | "radial-gradient(ellipse 50% 40% at 15% 30%, rgba(107,30,58,.35), transparent 70%), radial-gradient(ellipse 45% 35% at 85% 60%, rgba(212,175,55,.12), transparent 65%), radial-gradient(ellipse 40% 30% at 50% 90%, rgba(107,30,58,.25), transparent 70%)" |
| html::before | animation | "nebulaPulse 12s ease-in-out infinite" |
| body::after | content | '""' |
| body::after | position | fixed |
| body::after | top | "0" |
| body::after | left | "0" |
| body::after | width | "2px" |
| body::after | height | "2px" |
| body::after | z-index | "2" |
| body::after | pointer-events | none |
| body::after | border-radius | 50% |
| body::after | background | transparent |
| body::after | box-shadow | "82vw 15vh 0px 0px rgba(212,175,55,0.55),29vw 18vh 0px 1px rgba(212,175,55,0.25),95vw 70vh 1px 0px rgba(212,175,55,0.55),4vw 12vh 0px 1px rgba(212,175,55,0.35),78vw 4vh 0px 1px rgba(245,230,200,0.5),84vw 90vh 1px 0px rgba(245,230,200,0.5),58vw 76vh 0px 0px rgba(255,248,240,0.4),90vw 55vh 0px 0px rgba(255,248,240,0.4),28vw 98vh 0px 0px rgba(255,248,240,0.4),49vw 13vh 0px 1px rgba(255,248,240,0.4),34vw 6vh 1px 1px rgba(212,175,55,0.25),16vw 49vh 0px 1px rgba(212,175,55,0.55),80vw 47vh 0px 1px rgba(245,230,200,0.5),9vw 6vh 0px 0px rgba(212,175,55,0.25),11vw 30vh 1px 0px rgba(212,175,55,0.55),59vw 82vh 0px 0px rgba(255,248,240,0.4),46vw 27vh 0px 1px rgba(212,175,55,0.25),88vw 83vh 0px 1px rgba(212,175,55,0.55),94vw 32vh 1px 0px rgba(212,175,55,0.35),35vw 82vh 0px 1px rgba(212,175,55,0.25),42vw 99vh 0px 0px rgba(212,175,55,0.55),41vw 52vh 0px 0px rgba(255,248,240,0.4),73vw 92vh 0px 1px rgba(255,248,240,0.4),64vw 51vh 1px 0px rgba(212,175,55,0.25),34vw 18vh 0px 1px rgba(212,175,55,0.35),75vw 55vh 1px 0px rgba(245,230,200,0.5),29vw 18vh 1px 0px rgba(245,230,200,0.5),97vw 7vh 0px 1px rgba(212,175,55,0.55),21vw 88vh 0px 0px rgba(107,30,58,0.45),49vw 77vh 0px 1px rgba(107,30,58,0.45),2vw 88vh 0px 1px rgba(212,175,55,0.25),69vw 97vh 0px 0px rgba(255,248,240,0.4),38vw 56vh 1px 0px rgba(212,175,55,0.35),93vw 93vh 0px 1px rgba(255,248,240,0.4),14vw 81vh 0px 0px rgba(255,248,240,0.4),48vw 98vh 0px 1px rgba(212,175,55,0.35),42vw 63vh 0px 0px rgba(212,175,55,0.55),40vw 31vh 0px 1px rgba(212,175,55,0.55),11vw 11vh 1px 0px rgba(212,175,55,0.25),98vw 69vh 0px 1px rgba(212,175,55,0.35),61vw 71vh 0px 1px rgba(212,175,55,0.35),78vw 55vh 0px 1px rgba(212,175,55,0.35),40vw 52vh 0px 0px rgba(212,175,55,0.25),67vw 58vh 0px 0px rgba(212,175,55,0.55),9vw 44vh 0px 1px rgba(212,175,55,0.55),29vw 1vh 0px 0px rgba(212,175,55,0.55),9vw 5vh 0px 1px rgba(255,248,240,0.4),31vw 36vh 1px 0px rgba(212,175,55,0.25),70vw 17vh 1px 0px rgba(212,175,55,0.25),61vw 53vh 0px 0px rgba(212,175,55,0.35),85vw 56vh 1px 0px rgba(255,248,240,0.4),60vw 94vh 0px 0px rgba(212,175,55,0.55),52vw 94vh 0px 0px rgba(255,248,240,0.4),25vw 25vh 1px 0px rgba(245,230,200,0.5),55vw 24vh 1px 0px rgba(255,248,240,0.4),10vw 57vh 0px 0px rgba(245,230,200,0.5),84vw 70vh 0px 0px rgba(212,175,55,0.55),22vw 53vh 1px 0px rgba(107,30,58,0.45),52vw 8vh 1px 0px rgba(212,175,55,0.35),50vw 34vh 0px 0px rgba(107,30,58,0.45),90vw 94vh 1px 0px rgba(245,230,200,0.5),25vw 38vh 0px 1px rgba(212,175,55,0.35),95vw 70vh 0px 0px rgba(212,175,55,0.55),7vw 75vh 0px 0px rgba(107,30,58,0.45),66vw 11vh 0px 1px rgba(212,175,55,0.35),9vw 87vh 1px 0px rgba(212,175,55,0.35),73vw 32vh 0px 1px rgba(245,230,200,0.5),11vw 54vh 0px 0px rgba(212,175,55,0.25),27vw 86vh 0px 0px rgba(212,175,55,0.25),34vw 51vh 0px 0px rgba(212,175,55,0.35),41vw 97vh 0px 0px rgba(212,175,55,0.55),80vw 73vh 0px 1px rgba(212,175,55,0.55)" |
| body::after | animation | "particleDrift 48s ease-in-out infinite" |
| html::after | content | '""' |
| html::after | position | fixed |
| html::after | top | "0" |
| html::after | left | "0" |
| html::after | width | "1px" |
| html::after | height | "1px" |
| html::after | z-index | "2" |
| html::after | pointer-events | none |
| html::after | border-radius | 50% |
| html::after | background | transparent |
| html::after | box-shadow | "28vw 65vh 0 0 rgba(255,248,240,0.25),17vw 45vh 0 0 rgba(212,175,55,0.3),32vw 48vh 0 0 rgba(255,248,240,0.25),21vw 57vh 0 0 rgba(107,30,58,0.3),91vw 39vh 0 0 rgba(107,30,58,0.3),84vw 68vh 0 0 rgba(212,175,55,0.3),86vw 71vh 0 0 rgba(255,248,240,0.25),85vw 14vh 0 0 rgba(212,175,55,0.3),34vw 15vh 0 0 rgba(212,175,55,0.3),96vw 71vh 0 0 rgba(212,175,55,0.3),35vw 37vh 0 0 rgba(107,30,58,0.3),27vw 92vh 0 0 rgba(255,248,240,0.25),27vw 88vh 0 0 rgba(107,30,58,0.3),34vw 65vh 0 0 rgba(255,248,240,0.25),33vw 7vh 0 0 rgba(212,175,55,0.3),82vw 55vh 0 0 rgba(255,248,240,0.25),6vw 1vh 0 0 rgba(255,248,240,0.25),99vw 17vh 0 0 rgba(107,30,58,0.3),34vw 21vh 0 0 rgba(107,30,58,0.3),57vw 71vh 0 0 rgba(107,30,58,0.3),55vw 72vh 0 0 rgba(212,175,55,0.3),15vw 10vh 0 0 rgba(107,30,58,0.3),20vw 70vh 0 0 rgba(212,175,55,0.3),48vw 75vh 0 0 rgba(107,30,58,0.3),19vw 56vh 0 0 rgba(212,175,55,0.3),6vw 40vh 0 0 rgba(255,248,240,0.25),6vw 46vh 0 0 rgba(212,175,55,0.3),88vw 32vh 0 0 rgba(107,30,58,0.3),14vw 46vh 0 0 rgba(107,30,58,0.3),53vw 80vh 0 0 rgba(107,30,58,0.3),20vw 31vh 0 0 rgba(212,175,55,0.3),23vw 53vh 0 0 rgba(212,175,55,0.3),23vw 95vh 0 0 rgba(255,248,240,0.25),53vw 86vh 0 0 rgba(107,30,58,0.3),32vw 35vh 0 0 rgba(212,175,55,0.3),90vw 14vh 0 0 rgba(255,248,240,0.25),5vw 61vh 0 0 rgba(212,175,55,0.3),26vw 59vh 0 0 rgba(255,248,240,0.25),40vw 30vh 0 0 rgba(212,175,55,0.3),4vw 85vh 0 0 rgba(212,175,55,0.3),52vw 43vh 0 0 rgba(255,248,240,0.25),9vw 99vh 0 0 rgba(255,248,240,0.25),45vw 83vh 0 0 rgba(107,30,58,0.3),52vw 87vh 0 0 rgba(107,30,58,0.3),43vw 4vh 0 0 rgba(212,175,55,0.3),34vw 23vh 0 0 rgba(107,30,58,0.3),34vw 5vh 0 0 rgba(212,175,55,0.3),77vw 56vh 0 0 rgba(255,248,240,0.25)" |
| html::after | animation | "particleDrift2 64s ease-in-out infinite" |
| body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" |
| body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' |
| body.no-sidebar | grid-template-areas | '"top" "main" "foot"' |
| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' |
| body.is-desk | grid-template-areas | '"top" "main" "foot"' |
| header.topnav | grid-area | top |
| aside.side | grid-area | side |
| main.main | grid-area | main |
| footer.foot | grid-area | foot |
| header.topnav | position | relative |
| header.topnav | z-index | "20" |
| aside.side | position | relative |
| aside.side | z-index | "10" |
| main.main | position | relative |
| main.main | z-index | "10" |
| footer.foot | position | relative |
| footer.foot | z-index | "10" |
| main.main | width | "100%" |
| main.main | max-width | "min(78rem, 100%)" |
| main.main | padding | "var(--space-8) var(--space-6) 4rem" |
| main.main | animation | "rise .8s cubic-bezier(.22,1,.36,1) both" |
| a | color | var(--gold) |
| a | text-decoration | none |
| a | transition | color 0.25s ease |
| a:hover | color | #f5e6c8 |
| code | font-family | var(--mono) |
| code | font-size | "0.82em" |
| code | font-weight | "400" |
| code | background | rgba(0,0,0,0.35) |
| code | border | 1px solid var(--border-soft) |
| code | padding | "0.12em 0.45em" |
| code | border-radius | var(--radius-sm) |
| code | color | var(--gold) |
*`layout`*
## responsive
`responsive` =
| 媒体 | 选择器 | 属性 | 值 |
|------|--------|------|-----|
| (max-width: 860px) | body.has-sidebar | grid-template-columns | 1fr |
| (max-width: 860px) | body.has-sidebar | grid-template-areas | '"top" "main" "side" "foot"' |
| (max-width: 860px) | aside.side | border-right | "0" |
| (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) |
| (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" |
| (max-width: 860px) | .content.cards | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form form | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" |
| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" |
| (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" |
| (max-width: 860px) | .intro_title | font-size | "2.4rem" |
| (prefers-reduced-motion: reduce) | main.main | animation | none |
| (prefers-reduced-motion: reduce) | .kicker | animation | none |
| (prefers-reduced-motion: reduce) | article.card | transition | none |
| (prefers-reduced-motion: reduce) | body::after | animation | none |
| (prefers-reduced-motion: reduce) | html::after | animation | none |
| (prefers-reduced-motion: reduce) | html::before | animation | none |
*`responsive`*
## topnav
`topnav` =
| 属性 | 值 |
|------|-----|
| background | #ffffff |
| border-bottom | 1px solid #e7e5e4 |
| position | sticky |
| top | "0" |
| z-index | "40" |
| display | flex |
| align-items | center |
| justify-content | flex-start |
| gap | var(--space-4) |
| padding | "1rem var(--space-6)" |
| background | "linear-gradient(180deg, rgba(10,8,9,.92) 0%, rgba(10,8,9,.55) 70%, transparent 100%)" |
| backdrop-filter | blur(10px) |
| -webkit-backdrop-filter | blur(10px) |
| border-bottom | 1px solid var(--border-soft) |
*`topnav`*
@@ -15,18 +237,40 @@
| 属性 | 值 |
|------|-----|
| background | #f5f5f4 |
| background | "rgba(10,8,9,.55)" |
| padding | "var(--space-6) var(--space-4)" |
| border-right | 1px solid var(--border-soft) |
*`side_panel`*
## footer
`footer` =
| 属性 | 值 |
|------|-----|
| color | var(--paper-faint) |
| font-size | "0.8rem" |
| letter-spacing | "0.08em" |
| padding | "var(--space-5) var(--space-6)" |
| border-top | 1px solid var(--border-soft) |
| background | "rgba(10,8,9,.75)" |
*`footer`*
## card_title
`card_title` =
| 属性 | 值 |
|------|-----|
| font-size | 1.15rem |
| margin | 0 0 0.35rem |
| font-family | var(--serif) |
| font-size | "1.15rem" |
| font-weight | "600" |
| margin | "0 0 var(--space-2)" |
| color | var(--gold) |
| letter-spacing | "0.02em" |
| line-height | "1.35" |
*`card_title`*
@@ -36,7 +280,396 @@
| 属性 | 值 |
|------|-----|
| color | #57534e |
| margin | 0 |
| color | var(--paper-dim) |
| margin | "0" |
| line-height | "1.65" |
| font-size | "0.9rem" |
| font-weight | "400" |
| display | "-webkit-box" |
| -webkit-box-orient | vertical |
| -webkit-line-clamp | "3" |
| overflow | hidden |
*`card_body`*
## chrome
Panel + claim/steps group layout (field look comes from named bind styles).
`chrome` =
| 选择器 | 属性 | 值 |
|--------|------|-----|
| .main-intro | background | var(--glass) |
| .main-intro | border | 1px solid var(--border) |
| .main-intro | border-radius | var(--radius) |
| .main-intro | padding | "2.25rem 1.75rem 1.85rem" |
| .main-intro | box-shadow | var(--shadow) |
| .main-intro | backdrop-filter | blur(16px) |
| .main-intro | -webkit-backdrop-filter | blur(16px) |
| .main-intro | margin-bottom | var(--space-8) |
| .main-intro > .claim | display | flex |
| .main-intro > .claim | flex-wrap | wrap |
| .main-intro > .claim | gap | var(--space-2) |
| .main-intro > .claim | margin | "0 0 var(--space-6)" |
| .main-intro > .steps | margin | "0" |
| .main-intro > .steps | padding | "var(--space-5) var(--space-5) var(--space-5) 1.5rem" |
| .main-intro > .steps | color | var(--paper-dim) |
| .main-intro > .steps | background | "rgba(0,0,0,.35)" |
| .main-intro > .steps | border | 1px solid var(--border-soft) |
| .main-intro > .steps | border-left | 2px solid var(--gold-dim) |
| .main-intro > .steps | border-radius | var(--radius) |
| .main-intro > .steps | font-size | "0.95rem" |
| .main-intro > .steps | letter-spacing | "0.02em" |
| .main-intro > .steps a | color | var(--gold) |
| .main-intro > .steps a | font-weight | "500" |
| .main-intro > .steps a:hover | color | #f5e6c8 |
| .article | background | var(--glass) |
| .article | border | 1px solid var(--border) |
| .article | border-radius | var(--radius) |
| .article | padding | "2rem 1.75rem" |
| .article | box-shadow | var(--shadow) |
| .article | backdrop-filter | blur(16px) |
| .article | -webkit-backdrop-filter | blur(16px) |
| .article-title | font-family | var(--serif) |
| .article-title | font-size | "clamp(1.75rem, 4vw, 2.35rem)" |
| .article-title | font-weight | "600" |
| .article-title | color | var(--gold) |
| .article-title | letter-spacing | "0.04em" |
| .article-title | margin | "0 0 var(--space-5)" |
| .article-title | line-height | "1.25" |
| .article-body | color | var(--paper-dim) |
| .article-body | font-family | var(--sans) |
| .article-body | font-size | "1.02rem" |
| .article-body | line-height | "1.85" |
| .article-body.md p | margin | "0 0 1.1rem" |
| .article-body.md a | color | var(--gold) |
| article.card | cursor | pointer |
| a.card-link | color | inherit |
| a.card-link | text-decoration | none |
| a.card-link:hover | color | inherit |
*`chrome`*
## kicker
`kicker` =
| 属性 | 值 |
|------|-----|
| letter-spacing | "0.32em" |
| text-transform | uppercase |
| font-size | "0.72rem" |
| color | var(--gold-dim) |
| margin | "0 0 var(--space-4)" |
| font-weight | "400" |
| font-family | var(--sans) |
| animation | "float 2.8s ease-in-out infinite" |
*`kicker`*
## intro_title
`intro_title` =
| 属性 | 值 |
|------|-----|
| font-family | var(--display) |
| font-size | "clamp(3rem, 10vw, 4.8rem)" |
| font-weight | "400" |
| line-height | "1.15" |
| letter-spacing | "0.04em" |
| margin | "0 0 var(--space-4)" |
| color | transparent |
| background | "linear-gradient(135deg, #f5e6c8 0%, var(--gold) 42%, var(--wine) 100%)" |
| -webkit-background-clip | text |
| background-clip | text |
| animation | "goldPulse 4.5s ease-in-out infinite" |
*`intro_title`*
## lede
`lede` =
| 属性 | 值 |
|------|-----|
| color | var(--paper-dim) |
| max-width | "34rem" |
| line-height | "1.85" |
| margin | "0 0 var(--space-5)" |
| font-size | "1.05rem" |
| letter-spacing | "0.02em" |
| font-weight | "400" |
| font-family | var(--sans) |
*`lede`*
## claim
`claim` =
| 属性 | 值 |
|------|-----|
| display | inline-flex |
| align-items | center |
| padding | "0.2rem 0.65rem" |
| border-radius | var(--radius-sm) |
| background | var(--wine-soft) |
| color | #f0c9d4 |
| font-size | "0.68rem" |
| font-weight | "500" |
| letter-spacing | "0.14em" |
| border | 1px solid rgba(107,30,58,0.5) |
*`claim`*
## step
`step` =
| 属性 | 值 |
|------|-----|
| margin | "0.55rem 0" |
*`step`*
## widgets
`widgets` =
| 选择器 | 属性 | 值 |
|--------|------|-----|
| ul.nav | display | flex |
| ul.nav | flex-wrap | wrap |
| ul.nav | align-items | center |
| ul.nav | gap | "0.35rem 1rem" |
| ul.nav | list-style | none |
| ul.nav | margin | "0" |
| ul.nav | padding | "0" |
| ul.nav a | display | inline-flex |
| ul.nav a | align-items | center |
| ul.nav a | text-decoration | none |
| ul.nav a | color | var(--paper-dim) |
| ul.nav a | padding | "0.35rem 0" |
| ul.nav a | border-radius | "0" |
| ul.nav a | font-weight | "400" |
| ul.nav a | font-size | "0.8rem" |
| ul.nav a | letter-spacing | "0.14em" |
| ul.nav a | transition | color 0.25s ease |
| ul.nav a:hover | background | transparent |
| ul.nav a:hover | color | var(--gold) |
| ul.nav a:hover | text-decoration | none |
| ul.nav a[href="/admin"] | color | var(--gold) |
| ul.nav a[href="/admin"] | letter-spacing | "0.18em" |
| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) |
| ul.side-nav a[href="/admin"] | color | var(--gold) |
| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) |
| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" |
| body.is-desk .main-intro | border-left | 3px solid var(--wine) |
| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) |
| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" |
| body.is-desk .content.cards | margin-top | var(--space-6) |
| ul.nav li:first-child a | font-family | var(--display) |
| ul.nav li:first-child a | font-weight | "400" |
| ul.nav li:first-child a | color | var(--gold) |
| ul.nav li:first-child a | font-size | "1.85rem" |
| ul.nav li:first-child a | letter-spacing | "0.06em" |
| ul.nav li:first-child a | padding | "0.1rem 0.2rem 0.1rem 0" |
| ul.nav li:first-child a:hover | background | transparent |
| ul.nav li:first-child a:hover | color | #f5e6c8 |
| .side-label | display | block |
| .side-label | font-size | "0" |
| .side-label | margin | "0 0 var(--space-4)" |
| .side-label::before | content | '"Path"' |
| .side-label::before | display | block |
| .side-label::before | font-size | "0.68rem" |
| .side-label::before | letter-spacing | "0.28em" |
| .side-label::before | text-transform | uppercase |
| .side-label::before | color | var(--gold-dim) |
| .side-label::before | font-weight | "400" |
| ul.side-nav | list-style | none |
| ul.side-nav | margin | "0" |
| ul.side-nav | padding | "0" |
| ul.side-nav | display | grid |
| ul.side-nav | gap | "2px" |
| ul.side-nav | border-left | 1px solid var(--border) |
| ul.side-nav | padding-left | "0.85rem" |
| ul.side-nav | margin-left | "0.25rem" |
| ul.side-nav a | display | block |
| ul.side-nav a | text-decoration | none |
| ul.side-nav a | color | var(--paper-dim) |
| ul.side-nav a | padding | "0.45rem 0.35rem" |
| ul.side-nav a | border-radius | "0" |
| ul.side-nav a | font-weight | "400" |
| ul.side-nav a | font-size | "0.88rem" |
| ul.side-nav a | letter-spacing | "0.06em" |
| ul.side-nav a | border | "0" |
| ul.side-nav a | position | relative |
| ul.side-nav a:hover | background | transparent |
| ul.side-nav a:hover | border-color | transparent |
| ul.side-nav a:hover | color | var(--gold) |
| ul.side-nav a:hover | text-decoration | none |
| ul.side-nav a:hover | box-shadow | none |
| ul.foot-nav | display | flex |
| ul.foot-nav | gap | var(--space-4) |
| ul.foot-nav | list-style | none |
| ul.foot-nav | margin | "0" |
| ul.foot-nav | padding | "0" |
| ul.foot-nav a | color | var(--paper-faint) |
| ul.foot-nav a | font-weight | "400" |
| ul.foot-nav a | letter-spacing | "0.1em" |
| ul.foot-nav a | font-size | "0.78rem" |
| ul.foot-nav a:hover | color | var(--gold) |
| .content.cards | display | grid |
| .content.cards | gap | var(--space-4) |
| .content.cards | margin-top | "0" |
| .content.cards | grid-template-columns | "repeat(auto-fill, minmax(16rem, 1fr))" |
| article.card | background | "rgba(0,0,0,.35)" |
| article.card | border | 1px solid var(--border-soft) |
| article.card | border-radius | var(--radius-sm) |
| article.card | padding | "1.35rem 1.15rem" |
| article.card | box-shadow | none |
| article.card | transition | "border-color .35s ease, box-shadow .35s ease, transform .35s ease" |
| article.card:hover | transform | "translateY(-3px)" |
| article.card:hover | box-shadow | var(--shadow-card) |
| article.card:hover | border-color | var(--gold-dim) |
| .site-form | background | var(--glass) |
| .site-form | border | 1px solid var(--border) |
| .site-form | border-radius | var(--radius) |
| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" |
| .site-form | margin | "0 0 var(--space-6)" |
| .site-form | max-width | "100%" |
| .site-form | width | "100%" |
| .site-form | box-shadow | var(--shadow) |
| .site-form | backdrop-filter | blur(16px) |
| .site-form | -webkit-backdrop-filter | blur(16px) |
| .site-form .meta | display | none |
| .site-form form | display | grid |
| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" |
| .site-form form | column-gap | var(--space-5) |
| .site-form form | row-gap | var(--space-5) |
| .site-form form | gap | var(--space-5) |
| .site-form form | margin | "0" |
| .site-form form | width | "100%" |
| .site-form form | max-width | "100%" |
| .site-form label | display | grid |
| .site-form label | gap | var(--space-2) |
| .site-form label | margin | "0" |
| .site-form label | min-width | "0" |
| .site-form label | font-weight | "400" |
| .site-form label | color | var(--gold) |
| .site-form label | font-size | "0.78rem" |
| .site-form label | letter-spacing | "0.16em" |
| .site-form label | text-transform | uppercase |
| .site-form label:nth-child(1) | grid-column | "1" |
| .site-form label:nth-child(2) | grid-column | "2" |
| .site-form label:nth-child(n+3) | grid-column | "1 / -1" |
| .site-form .actions | grid-column | "1 / -1" |
| .site-form input | -webkit-appearance | none |
| .site-form textarea | -webkit-appearance | none |
| .site-form input | appearance | none |
| .site-form textarea | appearance | none |
| .site-form input | box-sizing | border-box |
| .site-form textarea | box-sizing | border-box |
| .site-form input | display | block |
| .site-form textarea | display | block |
| .site-form input | width | "100%" |
| .site-form textarea | width | "100%" |
| .site-form input | height | "2.75rem" |
| .site-form textarea | min-height | "10rem" |
| .site-form label:nth-child(4) textarea | min-height | "14rem" |
| .site-form textarea | resize | vertical |
| .site-form input | padding | "0 0.9rem" |
| .site-form textarea | padding | "0.75rem 0.9rem" |
| .site-form input | border | 1px solid var(--border) |
| .site-form textarea | border | 1px solid var(--border) |
| .site-form input | border-radius | var(--radius-sm) |
| .site-form textarea | border-radius | var(--radius-sm) |
| .site-form input | background | "rgba(0,0,0,.4)" |
| .site-form textarea | background | "rgba(0,0,0,.4)" |
| .site-form input | color | var(--paper) |
| .site-form textarea | color | var(--paper) |
| .site-form input | font | inherit |
| .site-form textarea | font | inherit |
| .site-form input | font-size | "0.95rem" |
| .site-form textarea | font-size | "0.95rem" |
| .site-form input | line-height | "1.4" |
| .site-form textarea | line-height | "1.65" |
| .site-form input | transition | "border-color .2s ease, box-shadow .2s ease" |
| .site-form textarea | transition | "border-color .2s ease, box-shadow .2s ease" |
| .site-form input:hover | border-color | var(--gold-dim) |
| .site-form textarea:hover | border-color | var(--gold-dim) |
| .site-form input:focus | outline | none |
| .site-form textarea:focus | outline | none |
| .site-form input:focus | border-color | var(--gold) |
| .site-form textarea:focus | border-color | var(--gold) |
| .site-form input:focus | box-shadow | var(--ring) |
| .site-form textarea:focus | box-shadow | var(--ring) |
| .site-form input[readonly] | background | "rgba(0,0,0,.25)" |
| .site-form input[readonly] | color | var(--paper-faint) |
| .site-form .err | color | var(--danger) |
| .site-form .err | font-size | "0.8rem" |
| .site-form .err | font-weight | "500" |
| .site-form .err | letter-spacing | "0.04em" |
| .site-form .actions | display | flex |
| .site-form .actions | align-items | center |
| .site-form .actions | gap | var(--space-4) |
| .site-form .actions | margin-top | var(--space-2) |
| .site-form .actions | flex-wrap | wrap |
| .site-form button | -webkit-appearance | none |
| .site-form button | appearance | none |
| .site-form button | height | "2.75rem" |
| .site-form button | padding | "0 1.35rem" |
| .site-form button | background | "linear-gradient(135deg, #f5e6c8, var(--gold))" |
| .site-form button | color | var(--ink) |
| .site-form button | border | "0" |
| .site-form button | border-radius | 999px |
| .site-form button | font-weight | "600" |
| .site-form button | font-size | "0.85rem" |
| .site-form button | letter-spacing | "0.12em" |
| .site-form button | cursor | pointer |
| .site-form button | box-shadow | "0 8px 28px rgba(212,175,55,.28)" |
| .site-form button | transition | "transform .2s ease, box-shadow .2s ease, filter .2s ease" |
| .site-form button:hover | filter | brightness(1.06) |
| .site-form button:hover | transform | "translateY(-1px)" |
| .site-form button:hover | box-shadow | "0 12px 36px rgba(212,175,55,.4)" |
| .site-form .actions a | color | var(--paper-faint) |
| .site-form .actions a | font-weight | "400" |
| .site-form .actions a | text-decoration | none |
| .site-form .actions a | font-size | "0.85rem" |
| .site-form .actions a | letter-spacing | "0.08em" |
| .site-form .actions a:hover | color | var(--gold) |
| .flash.err | color | var(--danger) |
| .flash.err | font-weight | "500" |
*`widgets`*
## css
**v = > vars**
**m = > motion**
**l = > layout**
**r = > responsive**
**c = > chrome**
**w = > widgets**
**css_v = > web.make_style name="vars" table=v**
**css_m = > web.make_style name="motion" table=m**
**css_l = > web.make_style name="layout" table=l**
**css_r = > web.make_style name="responsive" table=r**
**css_c = > web.make_style name="chrome" table=c**
**css_w = > web.make_style name="widgets" table=w**
`parts` =
| css |
|-----|
| `css_v` |
| `css_m` |
| `css_l` |
| `css_r` |
| `css_c` |
| `css_w` |
**out = > text.str_join xs=`parts` sep=""**
*out*
+40
View File
@@ -0,0 +1,40 @@
# Demo walkthrough (`examples/web-site`)
Aligned with The Web Conference **Demo** expectations: implemented system,
**hands-on** interaction, clear venue script, reproducible from the repo.
## Run
```bash
./scripts/build-web-plugin.sh
marqdo run examples/web-site/index.mq.md
```
Open http://127.0.0.1:18081/
## Venue script (≈3 minutes)
| Step | Action | What reviewers should notice |
|------|--------|------------------------------|
| 1 | Home | Claim badges + steps; **8 seed cards** with summaries |
| 2 | Click a card | `/post/{slug}` detail from the same table (`detail=True`) |
| 3 | Open `index.mq.md` beside the browser | Narrative = program; field/rule/route/intro tables |
| 4 | `/new` empty title → submit | Server validation from **rule table** (no author JS) |
| 5 | `/new` valid title+slug → submit | Row appears on Home and Admin |
| 6 | Top-nav **Login** (`admin` / `demo`) → **Admin** | Session gate; desk shell + create form |
| 7 | Terminal check | `find examples/web-site \( -name '*.js' -o -name '*.css' \)` → **0** |
## Authoring contract
| Surface | Source |
|---------|--------|
| Routes / forms / admin | GFM tables in `index.mq.md` |
| Styles | `styles/shell.mq.md` → `web.make_style` (ink / wine / gold; `shell_css=off`) |
| Intro | `| front | back | style |` → `page.compose_intro` (same bind as main) |
| Fonts | `page.head` table → Google Fonts (Noto Serif SC + Ma Shan Zheng) |
| Author `.js` / `.css` | **None** |
## Video
Same beats as above; English captions preferred. See thesis
`www-2027-demo/VIDEO.md` for length / upload tips.
+20 -3
View File
@@ -1,10 +1,27 @@
# examples/web-site
Canonical English sample for `ext/web` (design §4).
Canonical **English** sample for `ext/web` — WWW Demo walkthrough site.
**Hands-on script:** [DEMO.md](./DEMO.md)
## Authoring rules (checkable)
| Surface | How it is authored |
|---------|-------------------|
| Routes / forms / admin | GFM tables + class methods |
| Look-and-feel | Host shell CSS + **style tables** |
| Author business JavaScript | **none** |
| Author hand-written `.css` | **none** |
```bash
cargo build -p marqdo_plugin_web
cargo run -- examples/web-site/index.mq.md
marqdo run examples/web-site/index.mq.md
```
Then open http://127.0.0.1:18081/ — `/about`, `/new` (form in page slot), `/admin`, `/static/site.css`.
http://127.0.0.1:18081/ — `/about`, `/new` (validation), `/admin` (list + create).
```bash
find examples/web-site \( -name '*.js' -o -name '*.css' \) | wc -l # 0
```
Chinese twin: [`examples/web-site-zh/`](../web-site-zh/).
+29
View File
@@ -0,0 +1,29 @@
---
title: components/desk
description: Admin desk chrome — brand reads Admin; no public side rail.
---
## nav
`nav` =
| front | back | style | media | when |
|-------|------|-------|-------|------|
| Admin | /admin | | | |
| Site | / | | | |
| New | /new | | | |
| Logout | /admin/logout | | | auth |
*`nav`*
## foot
`foot` =
| front | back | style |
|-------|------|-------|
| Site | / | |
| Admin | /admin | |
| Logout | /admin/logout | |
*`foot`*
+5 -3
View File
@@ -2,8 +2,10 @@
`foot` =
| 属性 | 值 | 样式 |
|------|-----|------|
| Marqdo | https://github.com | |
| front | back | style |
|-------|------|-------|
| Marqdo | https://www.marqdo.com/ | |
| Source | https://github.com/cflmy/marqdo | |
*`foot`*
+9 -7
View File
@@ -1,14 +1,16 @@
## nav
Static top links for the shell.
Brand first, then demo routes. Guest sees **Login**; signed-in sees **Admin** + **Logout**.
`nav` =
| 属性 | 值 | 样式 |
|------|-----|------|
| Home | / | |
| About | /about | |
| New | /new | |
| Admin | /admin | |
| front | back | style | media | when |
|-------|------|-------|-------|------|
| Marqdo | / | | | |
| About | /about | | | |
| New | /new | | | |
| Login | /login | | | guest |
| Admin | /admin | | | auth |
| Logout | /admin/logout | | | auth |
*`nav`*
+9 -4
View File
@@ -1,10 +1,15 @@
## side
Hands-on demo checklist (links only — no JS).
`side` =
| 属性 | 值 | 样式 |
|------|-----|------|
| Notes | / | |
| Docs | https://github.com | |
| front | back | style | media | when |
|-------|------|-------|-------|------|
| 1. Home | / | | | |
| 2. New form | /new | | | |
| 3. Login | /login | | | guest |
| 3. Admin | /admin | | | auth |
| About | /about | | | |
*`side`*
+16 -6
View File
@@ -2,21 +2,31 @@
`fields` =
| 字段 | 类型 | 可空 |
|------|------|------|
| name | type | nullable |
|------|------|----------|
| id | integer | false |
| title | text | false |
| slug | text | false |
| summary | text | true |
| body | text | true |
*`fields`*
## seed
Longer demo rows — cards show summary; /post/{slug} shows full body (Markdown).
`rows` =
| id | title | body |
|----|-------|------|
| 1 | Hello Marqdo | First article from a GFM table. |
| 2 | Code as docs | The page table is the program. |
| id | title | slug | summary | body |
|----|-------|------|---------|------|
| 1 | Hello Marqdo | hello-marqdo | A runnable Markdown file is both the site docs and the deployed app — tables declare routes, forms, and styles. | "Marqdo treats an .mq.md file as an executable document. The narrative you read in the editor is the same artifact the server runs: GFM tables become schema, forms, navigation, and CSS. This demo shows that contract end-to-end — open New, trigger a rule-table validation error, then publish a row that appears on Home and Admin without any author JavaScript." |
| 2 | Tables as the full stack | tables-full-stack | Schema, forms, routes, admin pages, and theme tokens share one tabular dialect instead of a JS/CSS split. | "Most stacks split concerns across languages: SQL or an ORM for data, a form library for input, a router for URLs, and a stylesheet for look. Marqdo collapses those surfaces into GFM tables with the same geometry authors already use for documentation. Field tables, rule tables, bind tables, and style tables are not metaphors — they are the runtime. The result is a site you can skim as prose and execute as a program." |
| 3 | Zero author JS and CSS | zero-author-js-css | Business logic stays in Markdown; appearance is style tables plus the host shell — no hand-written business JS or author .css. | "Author business JavaScript is zero by construction: validation runs from rule tables on the server, and list/detail pages are bind tables rendered by the host. Author .css files are also unnecessary when theme tokens live in property/value tables assembled by make_style. The demo turns shell_css=off so only those declared styles paint the page — proving the claim for a conference audience." |
| 4 | Card to detail in one bind | card-to-detail | List cards bind href to slug; a /post/{slug} route plus detail=True opens the full article. | "Click any card on the home page. The list bind exposes href from articles.slug, and link_prefix prefixes /post/. The detail page reuses the same table with a query slug = {slug} and page.detail so the first row renders as a full article — title and Markdown body — instead of a card grid. That is the same pattern used by larger Marqdo sites such as 求道量子." |
| 5 | Style tables not stylesheets | style-tables | Named style tables (kicker, intro_title, card_title) bind through the third column of every layout table. | "Intro, cards, and chrome all use the bind shape front/back/style. The style column points at a named property table in styles/shell.mq.md. When compose_intro or compose_main runs, those tables become CSS classes on the page. Authors never open a .css file to tweak the demo look — they edit readable Markdown tables that stay next to the copy they style." |
| 6 | Forms from field and rule tables | forms-from-tables | Empty title on New fails from the rule table; a valid submit inserts a row shared with Admin. | "The New and Admin pages mount the same form object: a field table declares labels and types, a rule table declares required and max constraints with messages. Submit with an empty title and the error is server-side, not a client script. Fill a title and slug, submit again, and the row shows up in the card grid and under Admin — one schema, two surfaces, zero author JS." |
| 7 | Seed data is documentation | seed-is-docs | These paragraphs were written as a GFM seed table — the demo content is part of the program. | "Seed rows live beside the schema in db/articles.mq.md. On first boot the host inserts them when the articles table is empty. That means the demo narrative is versioned with the code: longer summaries for cards, fuller bodies for detail pages, and slugs that make deep links stable. Reviewers can open the seed table and see exactly what the venue site will show." |
| 8 | Why this Demo matters | why-demo-matters | WWW Demo needs a hands-on artifact reviewers can run, click, and compare to source in minutes. | "A Demo track asks for an implemented system, not a slide-only pitch. This sample is intentionally small: one SQLite table, a handful of routes, and a literary shell — yet it covers the paper claim (tables as the full stack) with a three-step script. Clone the repo, run the web-site sample, click a card, break a form, then open index.mq.md beside the browser. That loop is the publication." |
*`rows`*
+170 -22
View File
@@ -1,73 +1,221 @@
---
title: web-site
description: Home + /about + /new (form in page slot) + admin.
description: >-
WWW Demo sample — GFM tables for shell, schema, forms, styles, and admin.
Author business JavaScript: none. Author hand-written .css: none.
import web:ext/web/web.mq.md
import shell:styles/shell.mq.md
import nav:components/nav.mq.md
import side:components/side.mq.md
import foot:components/foot.mq.md
import desk:components/desk.mq.md
import articles:db/articles.mq.md
import db:db/index.mq.md
---
# main
This Markdown file is both the **site documentation** and the **running app**.
Routes, forms, validation, admin pages, and look-and-feel are **GFM tables** —
no hand-written business JavaScript and no author .css file.
`home` =
| 组件 | 样式 |
|------|------|
| src | style |
|-----|-------|
| nav.`nav` | shell.`topnav` |
| side.`side` | shell.`side_panel` |
| foot.`foot` | |
| foot.`foot` | shell.`footer` |
Main content is not a reusable component, so it is authored here.
Public shell (nav + side + foot). Desk shell drops the public side rail.
`desk_shell` =
| src | style |
|-----|-------|
| desk.`nav` | shell.`topnav` |
| desk.`foot` | shell.`footer` |
List cards: summary + slug link (click through to detail).
`index` =
| 属性 | 值 | 样式 |
|------|-----|------|
| front | back | style |
|-------|------|-------|
| title | articles.`articles`.title | shell.`card_title` |
| body | articles.`articles`.body | shell.`card_body` |
| body | articles.`articles`.summary | shell.`card_body` |
| href | articles.`articles`.slug | |
Article create form (design §5.5): field table + rules table.
Detail bind for /post/{slug} (full Markdown body).
`detail` =
| front | back | style |
|-------|------|-------|
| title | articles.`articles`.title | shell.`card_title` |
| body | articles.`articles`.body | |
`by_slug` =
| field | op | value |
|-------|-----|-------|
| slug | = | {slug} |
Home intro — same bind shape as main (front / back / style).
`home_intro` =
| front | back | style |
|-------|------|-------|
| kicker | WWW demo · tables as the full stack | shell.`kicker` |
| title | Marqdo | shell.`intro_title` |
| lede | "One executable Markdown artifact declares routes, forms, admin pages, and styles — no hand-written business JavaScript, no author .css. Click a card for the full article, then try the three steps below." | shell.`lede` |
| claim | 0 author JS | shell.`claim` |
| claim | 0 author .css | shell.`claim` |
| claim | GFM tables | shell.`claim` |
| step | "Click any card — /post/{slug} opens the detail page from the same articles table." | shell.`step` |
| step | "Open [New](/new) and submit with an empty title (validation from a rule table)." | shell.`step` |
| step | "Open top-nav **Login** (admin / demo), then **Admin** — gated desk with create form + list." | shell.`step` |
`about_intro` =
| front | back | style |
|-------|------|-------|
| kicker | about | shell.`kicker` |
| title | About | shell.`intro_title` |
| lede | "Documentation and the deployed site stay one .mq.md artifact. Layout and theme are GFM style tables in styles/shell.mq.md — structure without hand-written CSS or business JavaScript." | shell.`lede` |
| claim | docs = program | shell.`claim` |
| claim | server-side rules | shell.`claim` |
| claim | hands-on | shell.`claim` |
`new_intro` =
| front | back | style |
|-------|------|-------|
| kicker | form · try validation | shell.`kicker` |
| title | New article | shell.`intro_title` |
| lede | "Leave Title empty and submit — the error comes from the rule table, not client JavaScript. Then fill title, slug, and summary to create a row shared with Admin and the card grid." | shell.`lede` |
`admin_intro` =
| front | back | style |
|-------|------|-------|
| kicker | desk · you are in admin | shell.`kicker` |
| title | Admin | shell.`intro_title` |
| lede | "This is the management desk (login required): same articles schema as the public site, assembled as list + create form — not a separate SPA. Use Site in the topnav to return, or Logout to end the session." | shell.`lede` |
| claim | login-gated | shell.`claim` |
| claim | table-declared | shell.`claim` |
| claim | "create + list" | shell.`claim` |
`post_intro` =
| front | back | style |
|-------|------|-------|
| kicker | article · table-bound detail | shell.`kicker` |
Article create form: field table + rules table (server-side validation).
`article_fields` =
| 字段 | 标签 | 类型 | 必填 | 默认 |
|------|------|------|------|------|
| name | label | type | required | default |
|------|-------|------|----------|---------|
| title | Title | text | true | |
| slug | Slug | text | true | |
| summary | Summary | textarea | false | |
| body | Body | textarea | false | |
`article_rules` =
| 字段 | 规则 | 消息 |
|------|------|------|
| field | rule | message |
|-------|------|---------|
| title | required | Title is required |
| title | max:120 | Title is too long |
| slug | required | Slug is required |
| slug | max:80 | Slug is too long |
| summary | max:500 | Summary is too long |
| body | max:8000 | Body is too long |
SEO / Open Graph for the home page (still a table).
`home_meta` =
| key | value |
|-----|-------|
| description | Tables as the full stack — Marqdo Web demo with zero author business JavaScript. |
| og:type | website |
| og:title | Marqdo Web Site |
Neat CJK sans for body; Great Vibes for English display.
`fonts` =
| rel | href | crossorigin |
|-----|------|-------------|
| preconnect | https://fonts.googleapis.com | |
| preconnect | https://fonts.gstatic.com | anonymous |
| stylesheet | https://fonts.googleapis.com/css2?family=Great+Vibes&family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;600&display=swap | |
**store = > db.open**
**page = > web.page title="Marqdo Web Site" intro="<h1>Web Site</h1><p>Tables + class methods.</p>"**
**site_css = > shell.css**
**page = > web.page title="Marqdo Web Site" shell_css="off"**
**page = > page.compose_intro intro=home_intro**
**page = > page.meta meta=home_meta**
**page = > page.head table=fonts**
**page = > page.css css=site_css**
**page = > page.compose_components components=home**
**page = > page.compose_main main=index**
**page = > page.link_prefix prefix="/post/"**
About page: same shell, different intro (no main bind).
**about = > web.page title="About" intro="<h1>About</h1><p>Marqdo web = tables + class methods.</p>"**
**about = > web.page title="About · Marqdo Web" shell_css="off"**
**about = > about.compose_intro intro=about_intro**
**about = > about.head table=fonts**
**about = > about.css css=site_css**
**about = > about.compose_components components=home**
**article_form = > web.form table="articles" action="insert"**
**article_form = > article_form.fields fields=article_fields**
**article_form = > article_form.rules rules=article_rules**
New article: form embedded in the page main slot (design §5.5.4).
**new = > web.page title="New article" intro="<h1>New article</h1><p>Form lives in the main slot.</p>"**
**new = > web.page title="New article · Marqdo Web" shell_css="off"**
**new = > new.compose_intro intro=new_intro**
**new = > new.head table=fonts**
**new = > new.css css=site_css**
**new = > new.compose_components components=home**
**new = > new.compose_form id="article" form=article_form**
**app = > web.app page=page db=store admin=True host="127.0.0.1" port=18081**
**desk = > web.page title="Admin · Marqdo Web" shell_css="off"**
**desk = > desk.chrome body_class="is-desk"**
**desk = > desk.compose_intro intro=admin_intro**
**desk = > desk.head table=fonts**
**desk = > desk.css css=site_css**
**desk = > desk.compose_components components=desk_shell**
**desk = > desk.compose_form id="article" form=article_form**
**desk = > desk.compose_main main=index**
**desk = > desk.link_prefix prefix="/post/"**
**post = > web.page title="Article · Marqdo Web" shell_css="off"**
**post = > post.compose_intro intro=post_intro**
**post = > post.head table=fonts**
**post = > post.css css=site_css**
**post = > post.compose_components components=home**
**post = > post.compose_main main=detail**
**post = > post.query query=by_slug**
**post = > post.detail detail=True**
Demo credentials (table-declared users — host session auth, no author JS).
`admins` =
| username | password | role |
|----------|----------|------|
| admin | demo | admin |
**app = > web.app page=page db=store admin=False host="127.0.0.1" port=18081 shell_css="off" login_redirect="/admin" logout_redirect="/"**
**app = > app.route path="/about" page=about**
**app = > app.route path="/new" page=new**
**app = > app.static dir="public" mount="/static"**
**app = > app.route path="/admin" page=desk**
**app = > app.route path="/post/{slug}" page=post**
**app = > app.auth users=admins session_ttl=3600 login_path="/login" login_redirect="/admin" logout_redirect="/"**
**app = > app.gate path="/admin" roles="admin" match="prefix" on_deny="redirect" exclude="/login"**
> `app`.listen
-5
View File
@@ -1,5 +0,0 @@
/* Optional site stylesheet — served at /static/site.css */
body.site-hint::before {
content: "static ok";
display: none;
}
+648 -15
View File
@@ -1,11 +1,233 @@
---
title: styles/shell
description: >-
Literary dark theme for examples/web-site — ink / wine / gold after the
anlian.cyou Zhang Ailing topic. GFM tables only; no author .css.
import web:ext/web/web.mq.md
import text:lib/text.mq.md
---
Authors style the site with **GFM tables** only. App pages use `shell_css=off`
so host defaults do not fight this theme. Palette mirrors
[海上花开](https://www.anlian.cyou/topics/author-zhangailing/): night ink,
wine, cold gold, serif display.
## vars
`vars` =
| selector | property | value |
|----------|----------|-------|
| :root | --ink | #0a0809 |
| :root | --ink-lift | #141012 |
| :root | --wine | #6b1e3a |
| :root | --wine-soft | rgba(107,30,58,0.35) |
| :root | --gold | #d4af37 |
| :root | --gold-dim | rgba(212,175,55,0.45) |
| :root | --gold-soft | rgba(212,175,55,0.12) |
| :root | --paper | rgba(255,248,240,0.92) |
| :root | --paper-dim | rgba(255,248,240,0.72) |
| :root | --paper-faint | rgba(255,248,240,0.48) |
| :root | --glass | rgba(20,12,18,0.72) |
| :root | --glass-strong | rgba(20,12,18,0.88) |
| :root | --border | rgba(212,175,55,0.22) |
| :root | --border-soft | rgba(212,175,55,0.12) |
| :root | --danger | #e8a0a8 |
| :root | --radius | 4px |
| :root | --radius-sm | 2px |
| :root | --space-2 | 8px |
| :root | --space-3 | 12px |
| :root | --space-4 | 16px |
| :root | --space-5 | 20px |
| :root | --space-6 | 24px |
| :root | --space-8 | 32px |
| :root | --text | 16px |
| :root | --leading | "1.75" |
| :root | --shadow | "0 24px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06)" |
| :root | --shadow-card | "0 12px 40px rgba(107,30,58,.35)" |
| :root | --ring | "0 0 0 2px rgba(212,175,55,.35)" |
| :root | --serif | "'Noto Serif SC', 'Source Serif 4', Georgia, serif" |
| :root | --sans | "'Noto Sans SC', 'IBM Plex Sans', system-ui, sans-serif" |
| :root | --display | "'Great Vibes', 'Allura', cursive" |
| :root | --mono | "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" |
| ::selection | background | rgba(212,175,55,0.35) |
| ::selection | color | var(--paper) |
*`vars`*
## motion
`motion` =
| selector | property | value |
|----------|----------|-------|
| @keyframes rise 0% | opacity | "0" |
| @keyframes rise 0% | transform | translateY(14px) |
| @keyframes rise 100% | opacity | "1" |
| @keyframes rise 100% | transform | translateY(0) |
| @keyframes float 0% | transform | translateY(0) |
| @keyframes float 0% | opacity | "0.7" |
| @keyframes float 50% | transform | translateY(6px) |
| @keyframes float 50% | opacity | "1" |
| @keyframes float 100% | transform | translateY(0) |
| @keyframes float 100% | opacity | "0.7" |
| @keyframes goldPulse 0% | text-shadow | "0 0 24px rgba(212,175,55,.2)" |
| @keyframes goldPulse 50% | text-shadow | "0 0 48px rgba(212,175,55,.45)" |
| @keyframes goldPulse 100% | text-shadow | "0 0 24px rgba(212,175,55,.2)" |
| @keyframes particleDrift 0% | transform | translate3d(0,0,0) |
| @keyframes particleDrift 50% | transform | translate3d(-2.5vw, 1.5vh, 0) |
| @keyframes particleDrift 100% | transform | translate3d(0,0,0) |
| @keyframes particleDrift2 0% | transform | translate3d(0,0,0) |
| @keyframes particleDrift2 50% | transform | translate3d(2vw, -2vh, 0) |
| @keyframes particleDrift2 100% | transform | translate3d(0,0,0) |
| @keyframes nebulaPulse 0% | opacity | "0.55" |
| @keyframes nebulaPulse 50% | opacity | "0.9" |
| @keyframes nebulaPulse 100% | opacity | "0.55" |
*`motion`*
## layout
`layout` =
| selector | property | value |
|----------|----------|-------|
| * | box-sizing | border-box |
| html | scroll-behavior | smooth |
| html | -webkit-text-size-adjust | 100% |
| body | margin | "0" |
| body | min-height | 100vh |
| body | font-family | var(--sans) |
| body | font-weight | "400" |
| body | font-size | var(--text) |
| body | line-height | var(--leading) |
| body | color | var(--paper) |
| body | background | var(--ink) |
| body | background-image | "radial-gradient(ellipse 90% 55% at 50% -15%, rgba(107,30,58,.5), transparent 58%), radial-gradient(ellipse 55% 45% at 92% 75%, rgba(212,175,55,.14), transparent 55%), radial-gradient(ellipse 40% 35% at 8% 70%, rgba(107,30,58,.22), transparent 60%), linear-gradient(180deg, #0a0809 0%, #120c10 45%, #0a0809 100%)" |
| body | background-attachment | fixed |
| body | display | grid |
| body | grid-template-rows | "auto 1fr auto" |
| body | -webkit-font-smoothing | antialiased |
| body | position | relative |
| body | overflow-x | hidden |
| body::before | content | '""' |
| body::before | position | fixed |
| body::before | inset | "0" |
| body::before | z-index | "1" |
| body::before | pointer-events | none |
| body::before | opacity | "0.1" |
| body::before | background-image | "url(\"data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")" |
| html::before | content | '""' |
| html::before | position | fixed |
| html::before | inset | "0" |
| html::before | z-index | "0" |
| html::before | pointer-events | none |
| html::before | background-image | "radial-gradient(ellipse 50% 40% at 15% 30%, rgba(107,30,58,.35), transparent 70%), radial-gradient(ellipse 45% 35% at 85% 60%, rgba(212,175,55,.12), transparent 65%), radial-gradient(ellipse 40% 30% at 50% 90%, rgba(107,30,58,.25), transparent 70%)" |
| html::before | animation | "nebulaPulse 12s ease-in-out infinite" |
| body::after | content | '""' |
| body::after | position | fixed |
| body::after | top | "0" |
| body::after | left | "0" |
| body::after | width | "2px" |
| body::after | height | "2px" |
| body::after | z-index | "2" |
| body::after | pointer-events | none |
| body::after | border-radius | 50% |
| body::after | background | transparent |
| body::after | box-shadow | "82vw 15vh 0px 0px rgba(212,175,55,0.55),29vw 18vh 0px 1px rgba(212,175,55,0.25),95vw 70vh 1px 0px rgba(212,175,55,0.55),4vw 12vh 0px 1px rgba(212,175,55,0.35),78vw 4vh 0px 1px rgba(245,230,200,0.5),84vw 90vh 1px 0px rgba(245,230,200,0.5),58vw 76vh 0px 0px rgba(255,248,240,0.4),90vw 55vh 0px 0px rgba(255,248,240,0.4),28vw 98vh 0px 0px rgba(255,248,240,0.4),49vw 13vh 0px 1px rgba(255,248,240,0.4),34vw 6vh 1px 1px rgba(212,175,55,0.25),16vw 49vh 0px 1px rgba(212,175,55,0.55),80vw 47vh 0px 1px rgba(245,230,200,0.5),9vw 6vh 0px 0px rgba(212,175,55,0.25),11vw 30vh 1px 0px rgba(212,175,55,0.55),59vw 82vh 0px 0px rgba(255,248,240,0.4),46vw 27vh 0px 1px rgba(212,175,55,0.25),88vw 83vh 0px 1px rgba(212,175,55,0.55),94vw 32vh 1px 0px rgba(212,175,55,0.35),35vw 82vh 0px 1px rgba(212,175,55,0.25),42vw 99vh 0px 0px rgba(212,175,55,0.55),41vw 52vh 0px 0px rgba(255,248,240,0.4),73vw 92vh 0px 1px rgba(255,248,240,0.4),64vw 51vh 1px 0px rgba(212,175,55,0.25),34vw 18vh 0px 1px rgba(212,175,55,0.35),75vw 55vh 1px 0px rgba(245,230,200,0.5),29vw 18vh 1px 0px rgba(245,230,200,0.5),97vw 7vh 0px 1px rgba(212,175,55,0.55),21vw 88vh 0px 0px rgba(107,30,58,0.45),49vw 77vh 0px 1px rgba(107,30,58,0.45),2vw 88vh 0px 1px rgba(212,175,55,0.25),69vw 97vh 0px 0px rgba(255,248,240,0.4),38vw 56vh 1px 0px rgba(212,175,55,0.35),93vw 93vh 0px 1px rgba(255,248,240,0.4),14vw 81vh 0px 0px rgba(255,248,240,0.4),48vw 98vh 0px 1px rgba(212,175,55,0.35),42vw 63vh 0px 0px rgba(212,175,55,0.55),40vw 31vh 0px 1px rgba(212,175,55,0.55),11vw 11vh 1px 0px rgba(212,175,55,0.25),98vw 69vh 0px 1px rgba(212,175,55,0.35),61vw 71vh 0px 1px rgba(212,175,55,0.35),78vw 55vh 0px 1px rgba(212,175,55,0.35),40vw 52vh 0px 0px rgba(212,175,55,0.25),67vw 58vh 0px 0px rgba(212,175,55,0.55),9vw 44vh 0px 1px rgba(212,175,55,0.55),29vw 1vh 0px 0px rgba(212,175,55,0.55),9vw 5vh 0px 1px rgba(255,248,240,0.4),31vw 36vh 1px 0px rgba(212,175,55,0.25),70vw 17vh 1px 0px rgba(212,175,55,0.25),61vw 53vh 0px 0px rgba(212,175,55,0.35),85vw 56vh 1px 0px rgba(255,248,240,0.4),60vw 94vh 0px 0px rgba(212,175,55,0.55),52vw 94vh 0px 0px rgba(255,248,240,0.4),25vw 25vh 1px 0px rgba(245,230,200,0.5),55vw 24vh 1px 0px rgba(255,248,240,0.4),10vw 57vh 0px 0px rgba(245,230,200,0.5),84vw 70vh 0px 0px rgba(212,175,55,0.55),22vw 53vh 1px 0px rgba(107,30,58,0.45),52vw 8vh 1px 0px rgba(212,175,55,0.35),50vw 34vh 0px 0px rgba(107,30,58,0.45),90vw 94vh 1px 0px rgba(245,230,200,0.5),25vw 38vh 0px 1px rgba(212,175,55,0.35),95vw 70vh 0px 0px rgba(212,175,55,0.55),7vw 75vh 0px 0px rgba(107,30,58,0.45),66vw 11vh 0px 1px rgba(212,175,55,0.35),9vw 87vh 1px 0px rgba(212,175,55,0.35),73vw 32vh 0px 1px rgba(245,230,200,0.5),11vw 54vh 0px 0px rgba(212,175,55,0.25),27vw 86vh 0px 0px rgba(212,175,55,0.25),34vw 51vh 0px 0px rgba(212,175,55,0.35),41vw 97vh 0px 0px rgba(212,175,55,0.55),80vw 73vh 0px 1px rgba(212,175,55,0.55)" |
| body::after | animation | "particleDrift 48s ease-in-out infinite" |
| html::after | content | '""' |
| html::after | position | fixed |
| html::after | top | "0" |
| html::after | left | "0" |
| html::after | width | "1px" |
| html::after | height | "1px" |
| html::after | z-index | "2" |
| html::after | pointer-events | none |
| html::after | border-radius | 50% |
| html::after | background | transparent |
| html::after | box-shadow | "28vw 65vh 0 0 rgba(255,248,240,0.25),17vw 45vh 0 0 rgba(212,175,55,0.3),32vw 48vh 0 0 rgba(255,248,240,0.25),21vw 57vh 0 0 rgba(107,30,58,0.3),91vw 39vh 0 0 rgba(107,30,58,0.3),84vw 68vh 0 0 rgba(212,175,55,0.3),86vw 71vh 0 0 rgba(255,248,240,0.25),85vw 14vh 0 0 rgba(212,175,55,0.3),34vw 15vh 0 0 rgba(212,175,55,0.3),96vw 71vh 0 0 rgba(212,175,55,0.3),35vw 37vh 0 0 rgba(107,30,58,0.3),27vw 92vh 0 0 rgba(255,248,240,0.25),27vw 88vh 0 0 rgba(107,30,58,0.3),34vw 65vh 0 0 rgba(255,248,240,0.25),33vw 7vh 0 0 rgba(212,175,55,0.3),82vw 55vh 0 0 rgba(255,248,240,0.25),6vw 1vh 0 0 rgba(255,248,240,0.25),99vw 17vh 0 0 rgba(107,30,58,0.3),34vw 21vh 0 0 rgba(107,30,58,0.3),57vw 71vh 0 0 rgba(107,30,58,0.3),55vw 72vh 0 0 rgba(212,175,55,0.3),15vw 10vh 0 0 rgba(107,30,58,0.3),20vw 70vh 0 0 rgba(212,175,55,0.3),48vw 75vh 0 0 rgba(107,30,58,0.3),19vw 56vh 0 0 rgba(212,175,55,0.3),6vw 40vh 0 0 rgba(255,248,240,0.25),6vw 46vh 0 0 rgba(212,175,55,0.3),88vw 32vh 0 0 rgba(107,30,58,0.3),14vw 46vh 0 0 rgba(107,30,58,0.3),53vw 80vh 0 0 rgba(107,30,58,0.3),20vw 31vh 0 0 rgba(212,175,55,0.3),23vw 53vh 0 0 rgba(212,175,55,0.3),23vw 95vh 0 0 rgba(255,248,240,0.25),53vw 86vh 0 0 rgba(107,30,58,0.3),32vw 35vh 0 0 rgba(212,175,55,0.3),90vw 14vh 0 0 rgba(255,248,240,0.25),5vw 61vh 0 0 rgba(212,175,55,0.3),26vw 59vh 0 0 rgba(255,248,240,0.25),40vw 30vh 0 0 rgba(212,175,55,0.3),4vw 85vh 0 0 rgba(212,175,55,0.3),52vw 43vh 0 0 rgba(255,248,240,0.25),9vw 99vh 0 0 rgba(255,248,240,0.25),45vw 83vh 0 0 rgba(107,30,58,0.3),52vw 87vh 0 0 rgba(107,30,58,0.3),43vw 4vh 0 0 rgba(212,175,55,0.3),34vw 23vh 0 0 rgba(107,30,58,0.3),34vw 5vh 0 0 rgba(212,175,55,0.3),77vw 56vh 0 0 rgba(255,248,240,0.25)" |
| html::after | animation | "particleDrift2 64s ease-in-out infinite" |
| body.has-sidebar | grid-template-columns | "14rem minmax(0, 1fr)" |
| body.has-sidebar | grid-template-areas | '"top top" "side main" "foot foot"' |
| body.no-sidebar | grid-template-areas | '"top" "main" "foot"' |
| body.layout-stacked | grid-template-areas | '"top" "main" "foot"' |
| body.is-desk | grid-template-areas | '"top" "main" "foot"' |
| header.topnav | grid-area | top |
| aside.side | grid-area | side |
| main.main | grid-area | main |
| footer.foot | grid-area | foot |
| header.topnav | position | relative |
| header.topnav | z-index | "20" |
| aside.side | position | relative |
| aside.side | z-index | "10" |
| main.main | position | relative |
| main.main | z-index | "10" |
| footer.foot | position | relative |
| footer.foot | z-index | "10" |
| main.main | width | "100%" |
| main.main | max-width | "min(78rem, 100%)" |
| main.main | padding | "var(--space-8) var(--space-6) 4rem" |
| main.main | animation | "rise .8s cubic-bezier(.22,1,.36,1) both" |
| a | color | var(--gold) |
| a | text-decoration | none |
| a | transition | color 0.25s ease |
| a:hover | color | #f5e6c8 |
| code | font-family | var(--mono) |
| code | font-size | "0.82em" |
| code | font-weight | "400" |
| code | background | rgba(0,0,0,0.35) |
| code | border | 1px solid var(--border-soft) |
| code | padding | "0.12em 0.45em" |
| code | border-radius | var(--radius-sm) |
| code | color | var(--gold) |
*`layout`*
## responsive
`responsive` =
| media | selector | property | value |
|-------|----------|----------|-------|
| (max-width: 860px) | body.has-sidebar | grid-template-columns | 1fr |
| (max-width: 860px) | body.has-sidebar | grid-template-areas | '"top" "main" "side" "foot"' |
| (max-width: 860px) | aside.side | border-right | "0" |
| (max-width: 860px) | aside.side | border-top | 1px solid var(--border-soft) |
| (max-width: 860px) | main.main | padding | "var(--space-6) var(--space-4) var(--space-8)" |
| (max-width: 860px) | .content.cards | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form form | grid-template-columns | 1fr |
| (max-width: 860px) | .site-form label:nth-child(1) | grid-column | "1 / -1" |
| (max-width: 860px) | .site-form label:nth-child(2) | grid-column | "1 / -1" |
| (max-width: 860px) | header.topnav | padding | "0.85rem var(--space-4)" |
| (max-width: 860px) | .intro_title | font-size | "2.4rem" |
| (prefers-reduced-motion: reduce) | main.main | animation | none |
| (prefers-reduced-motion: reduce) | .kicker | animation | none |
| (prefers-reduced-motion: reduce) | article.card | transition | none |
| (prefers-reduced-motion: reduce) | body::after | animation | none |
| (prefers-reduced-motion: reduce) | html::after | animation | none |
| (prefers-reduced-motion: reduce) | html::before | animation | none |
*`responsive`*
## topnav
`topnav` =
| 属性 | 值 |
|------|-----|
| background | #ffffff |
| border-bottom | 1px solid #e7e5e4 |
| property | value |
|----------|-------|
| position | sticky |
| top | "0" |
| z-index | "40" |
| display | flex |
| align-items | center |
| justify-content | flex-start |
| gap | var(--space-4) |
| padding | "1rem var(--space-6)" |
| background | "linear-gradient(180deg, rgba(10,8,9,.92) 0%, rgba(10,8,9,.55) 70%, transparent 100%)" |
| backdrop-filter | blur(10px) |
| -webkit-backdrop-filter | blur(10px) |
| border-bottom | 1px solid var(--border-soft) |
*`topnav`*
@@ -13,20 +235,42 @@
`side_panel` =
| 属性 | 值 |
|------|-----|
| background | #f5f5f4 |
| property | value |
|----------|-------|
| background | "rgba(10,8,9,.55)" |
| padding | "var(--space-6) var(--space-4)" |
| border-right | 1px solid var(--border-soft) |
*`side_panel`*
## footer
`footer` =
| property | value |
|----------|-------|
| color | var(--paper-faint) |
| font-size | "0.8rem" |
| letter-spacing | "0.08em" |
| padding | "var(--space-5) var(--space-6)" |
| border-top | 1px solid var(--border-soft) |
| background | "rgba(10,8,9,.75)" |
*`footer`*
## card_title
`card_title` =
| 属性 | 值 |
|------|-----|
| font-size | 1.15rem |
| margin | 0 0 0.35rem |
| property | value |
|----------|-------|
| font-family | var(--serif) |
| font-size | "1.15rem" |
| font-weight | "600" |
| margin | "0 0 var(--space-2)" |
| color | var(--gold) |
| letter-spacing | "0.02em" |
| line-height | "1.35" |
*`card_title`*
@@ -34,9 +278,398 @@
`card_body` =
| 属性 | 值 |
|------|-----|
| color | #57534e |
| margin | 0 |
| property | value |
|----------|-------|
| color | var(--paper-dim) |
| margin | "0" |
| line-height | "1.65" |
| font-size | "0.9rem" |
| font-weight | "400" |
| display | "-webkit-box" |
| -webkit-box-orient | vertical |
| -webkit-line-clamp | "3" |
| overflow | hidden |
*`card_body`*
## chrome
Panel + claim/steps group layout (field look comes from named bind styles).
`chrome` =
| selector | property | value |
|----------|----------|-------|
| .main-intro | background | var(--glass) |
| .main-intro | border | 1px solid var(--border) |
| .main-intro | border-radius | var(--radius) |
| .main-intro | padding | "2.25rem 1.75rem 1.85rem" |
| .main-intro | box-shadow | var(--shadow) |
| .main-intro | backdrop-filter | blur(16px) |
| .main-intro | -webkit-backdrop-filter | blur(16px) |
| .main-intro | margin-bottom | var(--space-8) |
| .main-intro > .claim | display | flex |
| .main-intro > .claim | flex-wrap | wrap |
| .main-intro > .claim | gap | var(--space-2) |
| .main-intro > .claim | margin | "0 0 var(--space-6)" |
| .main-intro > .steps | margin | "0" |
| .main-intro > .steps | padding | "var(--space-5) var(--space-5) var(--space-5) 1.5rem" |
| .main-intro > .steps | color | var(--paper-dim) |
| .main-intro > .steps | background | "rgba(0,0,0,.35)" |
| .main-intro > .steps | border | 1px solid var(--border-soft) |
| .main-intro > .steps | border-left | 2px solid var(--gold-dim) |
| .main-intro > .steps | border-radius | var(--radius) |
| .main-intro > .steps | font-size | "0.95rem" |
| .main-intro > .steps | letter-spacing | "0.02em" |
| .main-intro > .steps a | color | var(--gold) |
| .main-intro > .steps a | font-weight | "500" |
| .main-intro > .steps a:hover | color | #f5e6c8 |
| .article | background | var(--glass) |
| .article | border | 1px solid var(--border) |
| .article | border-radius | var(--radius) |
| .article | padding | "2rem 1.75rem" |
| .article | box-shadow | var(--shadow) |
| .article | backdrop-filter | blur(16px) |
| .article | -webkit-backdrop-filter | blur(16px) |
| .article-title | font-family | var(--serif) |
| .article-title | font-size | "clamp(1.75rem, 4vw, 2.35rem)" |
| .article-title | font-weight | "600" |
| .article-title | color | var(--gold) |
| .article-title | letter-spacing | "0.04em" |
| .article-title | margin | "0 0 var(--space-5)" |
| .article-title | line-height | "1.25" |
| .article-body | color | var(--paper-dim) |
| .article-body | font-family | var(--sans) |
| .article-body | font-size | "1.02rem" |
| .article-body | line-height | "1.85" |
| .article-body.md p | margin | "0 0 1.1rem" |
| .article-body.md a | color | var(--gold) |
| article.card | cursor | pointer |
| a.card-link | color | inherit |
| a.card-link | text-decoration | none |
| a.card-link:hover | color | inherit |
*`chrome`*
## kicker
`kicker` =
| property | value |
|----------|-------|
| letter-spacing | "0.32em" |
| text-transform | uppercase |
| font-size | "0.72rem" |
| color | var(--gold-dim) |
| margin | "0 0 var(--space-4)" |
| font-weight | "400" |
| font-family | var(--sans) |
| animation | "float 2.8s ease-in-out infinite" |
*`kicker`*
## intro_title
`intro_title` =
| property | value |
|----------|-------|
| font-family | var(--display) |
| font-size | "clamp(3rem, 10vw, 4.8rem)" |
| font-weight | "400" |
| line-height | "1.15" |
| letter-spacing | "0.04em" |
| margin | "0 0 var(--space-4)" |
| color | transparent |
| background | "linear-gradient(135deg, #f5e6c8 0%, var(--gold) 42%, var(--wine) 100%)" |
| -webkit-background-clip | text |
| background-clip | text |
| animation | "goldPulse 4.5s ease-in-out infinite" |
*`intro_title`*
## lede
`lede` =
| property | value |
|----------|-------|
| color | var(--paper-dim) |
| max-width | "34rem" |
| line-height | "1.85" |
| margin | "0 0 var(--space-5)" |
| font-size | "1.05rem" |
| letter-spacing | "0.02em" |
| font-weight | "400" |
| font-family | var(--sans) |
*`lede`*
## claim
`claim` =
| property | value |
|----------|-------|
| display | inline-flex |
| align-items | center |
| padding | "0.2rem 0.65rem" |
| border-radius | var(--radius-sm) |
| background | var(--wine-soft) |
| color | #f0c9d4 |
| font-size | "0.68rem" |
| font-weight | "500" |
| letter-spacing | "0.14em" |
| border | 1px solid rgba(107,30,58,0.5) |
*`claim`*
## step
`step` =
| property | value |
|----------|-------|
| margin | "0.55rem 0" |
*`step`*
## widgets
`widgets` =
| selector | property | value |
|----------|----------|-------|
| ul.nav | display | flex |
| ul.nav | flex-wrap | wrap |
| ul.nav | align-items | center |
| ul.nav | gap | "0.35rem 1rem" |
| ul.nav | list-style | none |
| ul.nav | margin | "0" |
| ul.nav | padding | "0" |
| ul.nav a | display | inline-flex |
| ul.nav a | align-items | center |
| ul.nav a | text-decoration | none |
| ul.nav a | color | var(--paper-dim) |
| ul.nav a | padding | "0.35rem 0" |
| ul.nav a | border-radius | "0" |
| ul.nav a | font-weight | "400" |
| ul.nav a | font-size | "0.8rem" |
| ul.nav a | letter-spacing | "0.14em" |
| ul.nav a | transition | color 0.25s ease |
| ul.nav a:hover | background | transparent |
| ul.nav a:hover | color | var(--gold) |
| ul.nav a:hover | text-decoration | none |
| ul.nav a[href="/admin"] | color | var(--gold) |
| ul.nav a[href="/admin"] | letter-spacing | "0.18em" |
| ul.nav a[href="/admin"] | border-bottom | 1px solid var(--gold-dim) |
| ul.side-nav a[href="/admin"] | color | var(--gold) |
| body.is-desk header.topnav | border-bottom | 1px solid rgba(107,30,58,0.55) |
| body.is-desk header.topnav | box-shadow | "0 12px 40px rgba(107,30,58,.18)" |
| body.is-desk .main-intro | border-left | 3px solid var(--wine) |
| body.is-desk .site-form | border-color | rgba(107,30,58,0.45) |
| body.is-desk .site-form | box-shadow | "0 0 0 1px rgba(212,175,55,.12), 0 18px 48px rgba(0,0,0,.35)" |
| body.is-desk .content.cards | margin-top | var(--space-6) |
| ul.nav li:first-child a | font-family | var(--display) |
| ul.nav li:first-child a | font-weight | "400" |
| ul.nav li:first-child a | color | var(--gold) |
| ul.nav li:first-child a | font-size | "1.85rem" |
| ul.nav li:first-child a | letter-spacing | "0.06em" |
| ul.nav li:first-child a | padding | "0.1rem 0.2rem 0.1rem 0" |
| ul.nav li:first-child a:hover | background | transparent |
| ul.nav li:first-child a:hover | color | #f5e6c8 |
| .side-label | display | block |
| .side-label | font-size | "0" |
| .side-label | margin | "0 0 var(--space-4)" |
| .side-label::before | content | '"Path"' |
| .side-label::before | display | block |
| .side-label::before | font-size | "0.68rem" |
| .side-label::before | letter-spacing | "0.28em" |
| .side-label::before | text-transform | uppercase |
| .side-label::before | color | var(--gold-dim) |
| .side-label::before | font-weight | "400" |
| ul.side-nav | list-style | none |
| ul.side-nav | margin | "0" |
| ul.side-nav | padding | "0" |
| ul.side-nav | display | grid |
| ul.side-nav | gap | "2px" |
| ul.side-nav | border-left | 1px solid var(--border) |
| ul.side-nav | padding-left | "0.85rem" |
| ul.side-nav | margin-left | "0.25rem" |
| ul.side-nav a | display | block |
| ul.side-nav a | text-decoration | none |
| ul.side-nav a | color | var(--paper-dim) |
| ul.side-nav a | padding | "0.45rem 0.35rem" |
| ul.side-nav a | border-radius | "0" |
| ul.side-nav a | font-weight | "400" |
| ul.side-nav a | font-size | "0.88rem" |
| ul.side-nav a | letter-spacing | "0.06em" |
| ul.side-nav a | border | "0" |
| ul.side-nav a | position | relative |
| ul.side-nav a:hover | background | transparent |
| ul.side-nav a:hover | border-color | transparent |
| ul.side-nav a:hover | color | var(--gold) |
| ul.side-nav a:hover | text-decoration | none |
| ul.side-nav a:hover | box-shadow | none |
| ul.foot-nav | display | flex |
| ul.foot-nav | gap | var(--space-4) |
| ul.foot-nav | list-style | none |
| ul.foot-nav | margin | "0" |
| ul.foot-nav | padding | "0" |
| ul.foot-nav a | color | var(--paper-faint) |
| ul.foot-nav a | font-weight | "400" |
| ul.foot-nav a | letter-spacing | "0.1em" |
| ul.foot-nav a | font-size | "0.78rem" |
| ul.foot-nav a:hover | color | var(--gold) |
| .content.cards | display | grid |
| .content.cards | gap | var(--space-4) |
| .content.cards | margin-top | "0" |
| .content.cards | grid-template-columns | "repeat(auto-fill, minmax(16rem, 1fr))" |
| article.card | background | "rgba(0,0,0,.35)" |
| article.card | border | 1px solid var(--border-soft) |
| article.card | border-radius | var(--radius-sm) |
| article.card | padding | "1.35rem 1.15rem" |
| article.card | box-shadow | none |
| article.card | transition | "border-color .35s ease, box-shadow .35s ease, transform .35s ease" |
| article.card:hover | transform | "translateY(-3px)" |
| article.card:hover | box-shadow | var(--shadow-card) |
| article.card:hover | border-color | var(--gold-dim) |
| .site-form | background | var(--glass) |
| .site-form | border | 1px solid var(--border) |
| .site-form | border-radius | var(--radius) |
| .site-form | padding | "var(--space-6) var(--space-6) var(--space-7, 1.75rem)" |
| .site-form | margin | "0 0 var(--space-6)" |
| .site-form | max-width | "100%" |
| .site-form | width | "100%" |
| .site-form | box-shadow | var(--shadow) |
| .site-form | backdrop-filter | blur(16px) |
| .site-form | -webkit-backdrop-filter | blur(16px) |
| .site-form .meta | display | none |
| .site-form form | display | grid |
| .site-form form | grid-template-columns | "minmax(0, 1fr) minmax(0, 1fr)" |
| .site-form form | column-gap | var(--space-5) |
| .site-form form | row-gap | var(--space-5) |
| .site-form form | gap | var(--space-5) |
| .site-form form | margin | "0" |
| .site-form form | width | "100%" |
| .site-form form | max-width | "100%" |
| .site-form label | display | grid |
| .site-form label | gap | var(--space-2) |
| .site-form label | margin | "0" |
| .site-form label | min-width | "0" |
| .site-form label | font-weight | "400" |
| .site-form label | color | var(--gold) |
| .site-form label | font-size | "0.78rem" |
| .site-form label | letter-spacing | "0.16em" |
| .site-form label | text-transform | uppercase |
| .site-form label:nth-child(1) | grid-column | "1" |
| .site-form label:nth-child(2) | grid-column | "2" |
| .site-form label:nth-child(n+3) | grid-column | "1 / -1" |
| .site-form .actions | grid-column | "1 / -1" |
| .site-form input | -webkit-appearance | none |
| .site-form textarea | -webkit-appearance | none |
| .site-form input | appearance | none |
| .site-form textarea | appearance | none |
| .site-form input | box-sizing | border-box |
| .site-form textarea | box-sizing | border-box |
| .site-form input | display | block |
| .site-form textarea | display | block |
| .site-form input | width | "100%" |
| .site-form textarea | width | "100%" |
| .site-form input | height | "2.75rem" |
| .site-form textarea | min-height | "10rem" |
| .site-form label:nth-child(4) textarea | min-height | "14rem" |
| .site-form textarea | resize | vertical |
| .site-form input | padding | "0 0.9rem" |
| .site-form textarea | padding | "0.75rem 0.9rem" |
| .site-form input | border | 1px solid var(--border) |
| .site-form textarea | border | 1px solid var(--border) |
| .site-form input | border-radius | var(--radius-sm) |
| .site-form textarea | border-radius | var(--radius-sm) |
| .site-form input | background | "rgba(0,0,0,.4)" |
| .site-form textarea | background | "rgba(0,0,0,.4)" |
| .site-form input | color | var(--paper) |
| .site-form textarea | color | var(--paper) |
| .site-form input | font | inherit |
| .site-form textarea | font | inherit |
| .site-form input | font-size | "0.95rem" |
| .site-form textarea | font-size | "0.95rem" |
| .site-form input | line-height | "1.4" |
| .site-form textarea | line-height | "1.65" |
| .site-form input | transition | "border-color .2s ease, box-shadow .2s ease" |
| .site-form textarea | transition | "border-color .2s ease, box-shadow .2s ease" |
| .site-form input:hover | border-color | var(--gold-dim) |
| .site-form textarea:hover | border-color | var(--gold-dim) |
| .site-form input:focus | outline | none |
| .site-form textarea:focus | outline | none |
| .site-form input:focus | border-color | var(--gold) |
| .site-form textarea:focus | border-color | var(--gold) |
| .site-form input:focus | box-shadow | var(--ring) |
| .site-form textarea:focus | box-shadow | var(--ring) |
| .site-form input[readonly] | background | "rgba(0,0,0,.25)" |
| .site-form input[readonly] | color | var(--paper-faint) |
| .site-form .err | color | var(--danger) |
| .site-form .err | font-size | "0.8rem" |
| .site-form .err | font-weight | "500" |
| .site-form .err | letter-spacing | "0.04em" |
| .site-form .actions | display | flex |
| .site-form .actions | align-items | center |
| .site-form .actions | gap | var(--space-4) |
| .site-form .actions | margin-top | var(--space-2) |
| .site-form .actions | flex-wrap | wrap |
| .site-form button | -webkit-appearance | none |
| .site-form button | appearance | none |
| .site-form button | height | "2.75rem" |
| .site-form button | padding | "0 1.35rem" |
| .site-form button | background | "linear-gradient(135deg, #f5e6c8, var(--gold))" |
| .site-form button | color | var(--ink) |
| .site-form button | border | "0" |
| .site-form button | border-radius | 999px |
| .site-form button | font-weight | "600" |
| .site-form button | font-size | "0.85rem" |
| .site-form button | letter-spacing | "0.12em" |
| .site-form button | cursor | pointer |
| .site-form button | box-shadow | "0 8px 28px rgba(212,175,55,.28)" |
| .site-form button | transition | "transform .2s ease, box-shadow .2s ease, filter .2s ease" |
| .site-form button:hover | filter | brightness(1.06) |
| .site-form button:hover | transform | "translateY(-1px)" |
| .site-form button:hover | box-shadow | "0 12px 36px rgba(212,175,55,.4)" |
| .site-form .actions a | color | var(--paper-faint) |
| .site-form .actions a | font-weight | "400" |
| .site-form .actions a | text-decoration | none |
| .site-form .actions a | font-size | "0.85rem" |
| .site-form .actions a | letter-spacing | "0.08em" |
| .site-form .actions a:hover | color | var(--gold) |
| .flash.err | color | var(--danger) |
| .flash.err | font-weight | "500" |
*`widgets`*
## css
**v = > vars**
**m = > motion**
**l = > layout**
**r = > responsive**
**c = > chrome**
**w = > widgets**
**css_v = > web.make_style name="vars" table=v**
**css_m = > web.make_style name="motion" table=m**
**css_l = > web.make_style name="layout" table=l**
**css_r = > web.make_style name="responsive" table=r**
**css_c = > web.make_style name="chrome" table=c**
**css_w = > web.make_style name="widgets" table=w**
`parts` =
| css |
|-----|
| `css_v` |
| `css_m` |
| `css_l` |
| `css_r` |
| `css_c` |
| `css_w` |
**out = > text.str_join xs=`parts` sep=""**
*out*
+27
View File
@@ -38,6 +38,18 @@ them into CSS — 样式即数据、装配即函数.
> ensure_plugin
*> web_style name=`name` table=`table` strict=`strict`*
## make_intro
+ `table`
Assemble an intro bind table (`|属性|值|样式|` / `|front|back|style|`) into an
HTML fragment for `.main-intro`. Same slot vocabulary as `compose_intro`
(`kicker`/`title`/`lede`/`claim`/`step`, plus ZH aliases). The `样式` column is
treated as a class name only here — prefer `page.compose_intro` when styles
should resolve from `shell.*` tables into `styles_css`.
> ensure_plugin
*> web_intro table=`table`*
## make_images
+ `table`
@@ -230,6 +242,21 @@ Assemble main from a bind table (`|属性|值|样式|` or `|front|back|css|`).
*> web_compose_main page=`self` main=`main`*
## compose_intro
+ `intro`
Assemble page intro from the same bind shape as `compose_main`
(`|属性|值|样式|` / `|front|back|style|`). `值` is literal copy (light
`[label](url)` / `**bold**`); `样式` resolves `shell.*` named
tables into `styles_css` like `card_title`. Consecutive `claim` / `step` rows
group into `.claim` / `.steps`. Slot aliases: `kicker`/`眉题`, `title`/`标题`,
`lede`/`导语`, `claim`/`标签`, `step`/`步骤`, plus `mount`/`插槽` and
`html`/`原文`. Replaces string `intro=` HTML. In `.mq.md` table cells, avoid
inline `` `code` `` — backtick refs are Marqdo variables; quote long prose
and use plain filenames or `[label](url)` links instead.
*> web_compose_intro page=`self` intro=`intro`*
## query
+ `query`
+23
View File
@@ -35,6 +35,16 @@ import table:lib/table.mq.md
> 确保插件
*> web_style name=`名` table=`表` strict=`严格`*
## 引言装配
+ `表`
把引言绑定表(`|属性|值|样式|` / `|front|back|style|`)装配成 `.main-intro` HTML 片段。
槽位与 `页面.引言装配` 相同。此处 `样式` 只当 class 名;要从 `shell.*` 解析进
`styles_css` 请用 `页面.引言装配`。
> 确保插件
*> web_intro table=`表`*
## 图片装配
+ `表`
@@ -217,6 +227,19 @@ import table:lib/table.mq.md
*> web_compose_main page=`self` main=`主体`*
## 引言装配
+ `引言`
与 `主体装配` 同一绑定表形(`|属性|值|样式|`)。`值` 为文案(支持轻量
`[文](url)` / `**粗**`);`样式` 解析 `shell.*` 具名表写入
`styles_css`(同 `card_title`)。连续 `claim`/`标签`、`step`/`步骤` 会分组。
槽位别名:`kicker`/`眉题`、`title`/`标题`、`lede`/`导语`、`claim`/`标签`、
`step`/`步骤`,以及 `mount`/`插槽`、`html`/`原文`。用于替代字符串 `引言=` HTML。
在 `.mq.md` 表单元格里请勿写行内 `` `code` ``(反引号是 Marqdo 变量语法);
长文加引号,文件名用纯文本或 `[文](url)`。
*> web_compose_intro page=`self` intro=`引言`*
## 查询条件
+ `条件`
+27 -15
View File
@@ -462,18 +462,8 @@ fn select_page_data(
offset: i64,
) -> Value {
let mut where_v = args.get("query").cloned();
if let Some(m) = where_v.as_ref().and_then(|v| v.as_object()) {
if m.iter().any(|(_, v)| v.as_str().is_some_and(|s| s.contains('{'))) {
let mut resolved = Map::new();
for (k, v) in m {
let v = match v {
Value::String(s) => Value::String(resolve_params(s.as_str(), args)),
other => other.clone(),
};
resolved.insert(k.clone(), v);
}
where_v = Some(Value::Object(resolved));
}
if let Some(v) = where_v.take() {
where_v = Some(resolve_placeholders(v, args));
}
let order = args.get("order").and_then(|v| v.as_str());
let paginate = args.get("paginate").is_some();
@@ -493,6 +483,26 @@ fn select_page_data(
.unwrap_or(json!({ "rows": [] }))
}
/// Recursively replace `{param}` in all string leaves (columnar / row tables).
fn resolve_placeholders(v: Value, args: &Value) -> Value {
match v {
Value::String(s) => Value::String(resolve_params(&s, args)),
Value::Array(arr) => Value::Array(
arr.into_iter()
.map(|x| resolve_placeholders(x, args))
.collect(),
),
Value::Object(map) => {
let mut out = Map::new();
for (k, val) in map {
out.insert(k, resolve_placeholders(val, args));
}
Value::Object(out)
}
other => other,
}
}
/// Replace `{param}` placeholders with values from `args["params"]` (a map).
fn resolve_params(s: &str, args: &Value) -> String {
let params = args
@@ -532,8 +542,11 @@ fn field_css(obj: &Map<String, Value>, field: &str) -> String {
}
fn part_src_prefix(args: &Value) -> String {
match args.get("_route").and_then(|v| v.as_str()) {
Some(r) if !r.is_empty() && r != "/" => {
let raw = args.get("_route").and_then(|v| v.as_str()).unwrap_or("");
let resolved = resolve_params(raw, args);
match resolved.as_str() {
"" | "/" => String::new(),
r => {
let mut p = r.to_string();
while p.len() > 1 && p.ends_with('/') {
p.pop();
@@ -544,7 +557,6 @@ fn part_src_prefix(args: &Value) -> String {
format!("/{p}")
}
}
_ => String::new(),
}
}
+2 -3
View File
@@ -475,10 +475,9 @@ pub fn as_css_named_checked(name: &str, table: &Value, strict: bool) -> Result<S
}
fn css_value_suspicious(v: &Value) -> Option<&'static str> {
// Numbers are normal CSS (z-index, opacity, …). Do not treat Markup-evaluated
// ints/floats as bare `/` division false positives.
match v {
Value::Number(_) => Some(
"numeric CSS value (likely bare `/` division such as `1 / 5`; quote the cell, e.g. `\"1 / 5\"`)",
),
Value::Bool(_) => Some("boolean CSS value (quote the cell if intentional)"),
_ => None,
}
+1
View File
@@ -18,6 +18,7 @@ require (
github.com/mattn/go-isatty v0.0.24 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/yuin/goldmark v1.7.8 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/sys v0.47.0 // indirect
+2
View File
@@ -34,6 +34,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
@@ -0,0 +1,437 @@
package compose
import (
"fmt"
"html"
"strings"
"github.com/marqdo/marqdo/plugins/web/internal/table"
)
// ComposeIntro binds an intro table (|属性|值|样式| / |front|back|style|) onto the
// page — same shape as ComposeMain. Literals go in 值/back; 样式 resolves like
// card_title into styles_css + element class names. Sets page.intro HTML.
//
// Unlike AsBind, the 值/back column is not NormalizeRef'd so inline `code`
// markers survive for richText.
func ComposeIntro(page any, introTable any, callLib CallLib) (any, error) {
obj := asObject(page)
arr := asIntroRows(introTable)
css := strField(obj, "styles_css")
seenStyle := map[string]bool{}
binds := make([]map[string]any, 0, len(arr))
for _, bm := range arr {
front := table.NormalizeRef(strField(bm, "front"))
backRaw := strings.TrimSpace(strField(bm, "back"))
cssRaw := table.NormalizeRef(strField(bm, "css"))
back := backRaw
switch sp := table.ParseSitePath(backRaw); sp.Kind {
case table.SitePathLibMember:
// Intro copy is almost always prose; only resolve clear lib.member refs
// that look like style/module paths (no spaces).
if !strings.ContainsAny(backRaw, " \t\n") {
v, err := callLib(sp.Lib + "." + sp.Member)
if err != nil {
back = sp.Lib + "." + sp.Member
} else if s, ok := v.(string); ok {
back = s
} else {
back = fmt.Sprint(v)
}
}
}
cssName := ""
if cssRaw != "" {
switch sp := table.ParseSitePath(cssRaw); sp.Kind {
case table.SitePathLibMember:
cssName = sp.Member
if !seenStyle[cssName] {
st, err := callLib(sp.Lib + "." + sp.Member)
if err != nil {
return nil, err
}
css += table.AsCSSNamed(sp.Member, st)
seenStyle[cssName] = true
}
case table.SitePathPlain:
cssName = sp.Plain
case table.SitePathDbField:
cssName = table.NormalizeRef(cssRaw)
}
}
if front == "" && back == "" {
continue
}
binds = append(binds, map[string]any{
"front": front,
"back": back,
"css": cssName,
})
}
obj["intro"] = RenderIntroHTML(binds)
obj["intro_bind"] = binds
if css != "" {
obj["styles_css"] = css
}
return obj, nil
}
// MakeIntroHTML builds intro HTML from a bind table without resolving lib styles
// (css column used as class name as-is). Preserves backticks in 值/back.
func MakeIntroHTML(introTable any) string {
arr := asIntroRows(introTable)
binds := make([]map[string]any, 0, len(arr))
for _, bm := range arr {
front := table.NormalizeRef(strField(bm, "front"))
back := strings.TrimSpace(strField(bm, "back"))
cssName := table.NormalizeRef(strField(bm, "css"))
if front == "" && back == "" {
continue
}
binds = append(binds, map[string]any{
"front": front,
"back": back,
"css": cssName,
})
}
return RenderIntroHTML(binds)
}
func asIntroRows(v any) []map[string]any {
switch t := v.(type) {
case []any:
out := make([]map[string]any, 0, len(t))
for _, row := range t {
m, ok := row.(map[string]any)
if !ok {
continue
}
front, back, css := "", "", ""
if x, ok := pickIntro(m, []string{"属性", "前端变量", "front", "field"}); ok {
front = cellIntro(x)
}
if x, ok := pickIntro(m, []string{"值", "后端数据库", "back", "db", "text", "文"}); ok {
back = cellIntro(x)
}
if x, ok := pickIntro(m, []string{"样式", "绑定css样式", "css", "class", "style"}); ok {
css = cellIntro(x)
}
if front != "" || back != "" {
out = append(out, map[string]any{"front": front, "back": back, "css": css})
}
}
return out
case map[string]any:
// Column-oriented map of lists (GFM multi-row table).
fronts, backs, csses := []string{}, []string{}, []string{}
if x, ok := pickIntro(t, []string{"属性", "前端变量", "front", "field"}); ok {
fronts = asIntroStrList(x)
}
if x, ok := pickIntro(t, []string{"值", "后端数据库", "back", "db", "text", "文"}); ok {
backs = asIntroStrList(x)
}
if x, ok := pickIntro(t, []string{"样式", "绑定css样式", "css", "class", "style"}); ok {
csses = asIntroStrList(x)
}
n := len(fronts)
if len(backs) > n {
n = len(backs)
}
out := make([]map[string]any, 0, n)
for i := 0; i < n; i++ {
front, back, css := "", "", ""
if i < len(fronts) {
front = fronts[i]
}
if i < len(backs) {
back = backs[i]
}
if i < len(csses) {
css = csses[i]
}
if front != "" || back != "" {
out = append(out, map[string]any{"front": front, "back": back, "css": css})
}
}
return out
default:
return nil
}
}
func asIntroStrList(v any) []string {
switch t := v.(type) {
case []any:
out := make([]string, 0, len(t))
for _, x := range t {
out = append(out, cellIntro(x))
}
return out
case []string:
return t
default:
s := cellIntro(v)
if s == "" {
return nil
}
return []string{s}
}
}
func pickIntro(m map[string]any, keys []string) (any, bool) {
for _, k := range keys {
if v, ok := m[k]; ok {
return v, true
}
}
return nil, false
}
func cellIntro(v any) string {
switch t := v.(type) {
case nil:
return ""
case string:
return t
case bool:
if t {
return "true"
}
return "false"
case float64:
if t == float64(int64(t)) {
return fmt.Sprintf("%d", int64(t))
}
return fmt.Sprintf("%v", t)
default:
return fmt.Sprint(t)
}
}
// RenderIntroHTML turns normalized intro binds into .main-intro inner HTML.
func RenderIntroHTML(binds []map[string]any) string {
if len(binds) == 0 {
return ""
}
var out strings.Builder
i := 0
for i < len(binds) {
front := strings.TrimSpace(strField(binds[i], "front"))
kind := introKind(front)
switch kind {
case "claim":
j := i
for j < len(binds) && introKind(strField(binds[j], "front")) == "claim" {
j++
}
out.WriteString(`<p class="claim">`)
for _, row := range binds[i:j] {
cls := classAttr(strField(row, "css"))
out.WriteString(fmt.Sprintf("<span%s>%s</span>", cls, richText(strField(row, "back"))))
}
out.WriteString(`</p>`)
i = j
case "step":
j := i
for j < len(binds) && introKind(strField(binds[j], "front")) == "step" {
j++
}
out.WriteString(`<ol class="steps">`)
for _, row := range binds[i:j] {
cls := classAttr(strField(row, "css"))
out.WriteString(fmt.Sprintf("<li%s>%s</li>", cls, richText(strField(row, "back"))))
}
out.WriteString(`</ol>`)
i = j
case "mount":
id := strField(binds[i], "back")
if id == "" {
id = front
}
id = strings.TrimPrefix(id, "#")
out.WriteString(fmt.Sprintf(`<div id="%s"></div>`, html.EscapeString(id)))
i++
case "html":
out.WriteString(strField(binds[i], "back"))
i++
default:
tag, baseClass := introTagClass(kind, front)
cssName := strField(binds[i], "css")
cls := mergeClass(baseClass, cssName)
out.WriteString(fmt.Sprintf("<%s%s>%s</%s>", tag, classAttr(cls), richText(strField(binds[i], "back")), tag))
i++
}
}
return out.String()
}
func introKind(front string) string {
s := strings.ToLower(strings.TrimSpace(front))
switch s {
case "kicker", "eyebrow", "眉题":
return "kicker"
case "title", "h1", "标题":
return "title"
case "lede", "lead", "导语":
return "lede"
case "claim", "badge", "标签":
return "claim"
case "step", "步骤":
return "step"
case "h2", "小标题":
return "h2"
case "p", "段落":
return "p"
case "mount", "插槽", "slot":
return "mount"
case "html", "原文", "raw":
return "html"
default:
return s
}
}
func introTagClass(kind, front string) (tag, baseClass string) {
switch kind {
case "kicker":
return "p", "kicker"
case "title":
return "h1", ""
case "lede":
return "p", "lede"
case "h2":
return "h2", ""
case "p":
return "p", ""
default:
if front != "" {
return "p", front
}
return "p", ""
}
}
func mergeClass(base, style string) string {
base = strings.TrimSpace(base)
style = strings.TrimSpace(style)
switch {
case base == "":
return style
case style == "" || style == base:
return base
default:
return base + " " + style
}
}
func classAttr(class string) string {
class = strings.TrimSpace(class)
if class == "" {
return ""
}
return ` class="` + html.EscapeString(class) + `"`
}
// richText escapes text then applies a tiny Markdown subset: [label](url), `code`, **bold**.
func richText(s string) string {
if s == "" {
return ""
}
type span struct {
kind string // text|a|code|strong
a string
b string
}
var spans []span
rest := s
for len(rest) > 0 {
// find earliest special
iLink := strings.Index(rest, "[")
iCode := strings.Index(rest, "`")
iBold := strings.Index(rest, "**")
next := -1
which := ""
if iLink >= 0 && (next < 0 || iLink < next) {
next, which = iLink, "a"
}
if iCode >= 0 && (next < 0 || iCode < next) {
next, which = iCode, "code"
}
if iBold >= 0 && (next < 0 || iBold < next) {
next, which = iBold, "strong"
}
if next < 0 {
spans = append(spans, span{kind: "text", a: rest})
break
}
if next > 0 {
spans = append(spans, span{kind: "text", a: rest[:next]})
}
rest = rest[next:]
switch which {
case "a":
// [label](url)
endLabel := strings.Index(rest, "](")
if endLabel < 0 {
spans = append(spans, span{kind: "text", a: rest[:1]})
rest = rest[1:]
continue
}
endURL := strings.Index(rest[endLabel+2:], ")")
if endURL < 0 {
spans = append(spans, span{kind: "text", a: rest[:1]})
rest = rest[1:]
continue
}
label := rest[1:endLabel]
url := rest[endLabel+2 : endLabel+2+endURL]
spans = append(spans, span{kind: "a", a: label, b: url})
rest = rest[endLabel+2+endURL+1:]
case "code":
end := strings.Index(rest[1:], "`")
if end < 0 {
spans = append(spans, span{kind: "text", a: rest[:1]})
rest = rest[1:]
continue
}
spans = append(spans, span{kind: "code", a: rest[1 : 1+end]})
rest = rest[1+end+1:]
case "strong":
end := strings.Index(rest[2:], "**")
if end < 0 {
spans = append(spans, span{kind: "text", a: rest[:2]})
rest = rest[2:]
continue
}
spans = append(spans, span{kind: "strong", a: rest[2 : 2+end]})
rest = rest[2+end+2:]
}
}
var out strings.Builder
for _, sp := range spans {
switch sp.kind {
case "a":
out.WriteString(`<a href="`)
out.WriteString(html.EscapeString(sp.b))
out.WriteString(`">`)
out.WriteString(html.EscapeString(sp.a))
out.WriteString(`</a>`)
case "code":
out.WriteString(`<code>`)
out.WriteString(html.EscapeString(sp.a))
out.WriteString(`</code>`)
case "strong":
out.WriteString(`<strong>`)
out.WriteString(html.EscapeString(sp.a))
out.WriteString(`</strong>`)
default:
out.WriteString(html.EscapeString(sp.a))
}
}
return out.String()
}
@@ -1,11 +1,80 @@
package compose_test
import (
"strings"
"testing"
"github.com/marqdo/marqdo/plugins/web/internal/compose"
)
func TestComposeIntroBindAndRichText(t *testing.T) {
page := map[string]any{"title": "Home"}
intro := []any{
map[string]any{"属性": "kicker", "值": "WWW Demo", "样式": "shell.kicker"},
map[string]any{"属性": "title", "值": "Marqdo", "样式": "shell.intro_title"},
map[string]any{"属性": "lede", "值": "Zero author `JS`.", "样式": "shell.lede"},
map[string]any{"属性": "claim", "值": "0 JS", "样式": "shell.claim"},
map[string]any{"属性": "claim", "值": "GFM", "样式": "shell.claim"},
map[string]any{"属性": "step", "值": "Open [New](/new) now.", "样式": "shell.step"},
map[string]any{"属性": "step", "值": "Compare source.", "样式": "shell.step"},
}
callLib := func(path string) (any, error) {
switch path {
case "shell.kicker", "shell.intro_title", "shell.lede", "shell.claim", "shell.step":
return map[string]any{
"property": []any{"color"},
"value": []any{"red"},
}, nil
default:
t.Fatalf("unexpected callLib %q", path)
return nil, nil
}
}
out, err := compose.ComposeIntro(page, intro, callLib)
if err != nil {
t.Fatal(err)
}
obj := out.(map[string]any)
html, _ := obj["intro"].(string)
for _, want := range []string{
`class="kicker"`,
`<h1 class="intro_title">Marqdo</h1>`,
`<code>JS</code>`,
`<p class="claim">`,
`<span class="claim">0 JS</span>`,
`<ol class="steps">`,
`<a href="/new">New</a>`,
} {
if !strings.Contains(html, want) {
t.Fatalf("missing %q in html=%q", want, html)
}
}
css, _ := obj["styles_css"].(string)
if !strings.Contains(css, ".kicker") || !strings.Contains(css, ".intro_title") {
t.Fatalf("styles_css incomplete: %q", css)
}
}
func TestMakeIntroHTMLZHAliases(t *testing.T) {
tbl := []any{
map[string]any{"属性": "眉题", "值": "演示", "样式": "kicker"},
map[string]any{"属性": "标题", "值": "站名", "样式": "intro_title"},
map[string]any{"属性": "标签", "值": "A", "样式": "claim"},
map[string]any{"属性": "步骤", "值": "第一步", "样式": "step"},
}
html := compose.MakeIntroHTML(tbl)
for _, want := range []string{
`class="kicker"`,
`<h1 class="intro_title">站名</h1>`,
`<p class="claim">`,
`<ol class="steps">`,
} {
if !strings.Contains(html, want) {
t.Fatalf("missing %q in %q", want, html)
}
}
}
func TestComposeComponentsFakeCallLib(t *testing.T) {
page := map[string]any{
"title": "Home",
+24 -16
View File
@@ -314,9 +314,10 @@ func (st *state) mountAuthRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET "+altLogin, st.handleLoginGet)
mux.HandleFunc("POST "+altLogin, st.handleLoginPost)
}
// Logout is part of session auth, not only built-in admin=True chrome.
logoutPath := strings.TrimRight(st.auth.adminPrefix, "/") + "/logout"
mux.HandleFunc("GET "+logoutPath, st.handleLogout)
if st.auth.admin {
logoutPath := strings.TrimRight(st.auth.adminPrefix, "/") + "/logout"
mux.HandleFunc("GET "+logoutPath, st.handleLogout)
adminHome := strings.TrimRight(st.auth.adminPrefix, "/")
if adminHome == "" {
adminHome = "/admin"
@@ -427,29 +428,34 @@ func loginPageHTML(loginAction string, errMsg *string, csrf string, next string)
nextField = fmt.Sprintf("<input type=\"hidden\" name=\"next\" value=\"%s\"/>", esc(next))
}
return fmt.Sprintf(`<!DOCTYPE html>
<html lang="zh-CN"><head>
<html lang="en"><head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Admin Login</title>
<style>
:root { --ink:#1c1917; --muted:#78716c; --paper:#fafaf9; --line:#e7e5e4; --accent:#0f766e; --err:#b91c1c; }
:root { --ink:#0a0809; --paper:#f5e6c8; --gold:#d4af37; --wine:#6b1e3a; --err:#b91c1c; }
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; display:grid; place-items:center; background:var(--paper); color:var(--ink); font-family:"IBM Plex Sans","Noto Sans SC",sans-serif; }
.login { background:rgba(255,255,255,.45); border:1px solid rgba(255,255,255,.5); border-radius:14px; padding:2rem 2.25rem; width:min(92vw,22rem); box-shadow:0 8px 24px rgba(253,189,219,.18); backdrop-filter:blur(14px); }
.login h1 { margin:0 0 .25rem; font-size:1.4rem; color:#a85878; }
.login .sub { color:#666; margin:0 0 1.25rem; font-size:.9rem; }
body { margin:0; min-height:100vh; display:grid; place-items:center; color:var(--paper); font-family:"Noto Sans SC","IBM Plex Sans",system-ui,sans-serif;
background: radial-gradient(ellipse 90%% 55%% at 50%% -15%%, rgba(107,30,58,.5), transparent 58%%), linear-gradient(180deg,#0a0809,#120c10 45%%,#0a0809); }
.login { background:rgba(0,0,0,.45); border:1px solid rgba(212,175,55,.28); border-radius:12px; padding:2rem 2.25rem; width:min(92vw,22rem); box-shadow:0 24px 80px rgba(0,0,0,.55); backdrop-filter:blur(14px); }
.login h1 { margin:0 0 .25rem; font-size:1.55rem; color:var(--gold); letter-spacing:.04em; }
.login .sub { color:rgba(245,230,200,.72); margin:0 0 1.25rem; font-size:.9rem; line-height:1.55; }
.login .hint { color:rgba(245,230,200,.5); margin:1rem 0 0; font-size:.78rem; letter-spacing:.04em; }
.login form { display:grid; gap:.9rem; }
.login label { display:grid; gap:.25rem; font-size:.9rem; }
.login input { padding:.55rem .65rem; border:1px solid rgba(253,189,219,.55); border-radius:999px; font:inherit; background:rgba(255,255,255,.7); }
.login button { background:linear-gradient(120deg,#f0a8c4,#fdbbdb); color:#a85878; border:0; padding:.6rem 1rem; border-radius:999px; cursor:pointer; font:inherit; font-weight:600; }
.login button:hover { filter:brightness(1.05); }
.flash.err { background:#fef2f2; color:#b91c1c; border:1px solid #fecaca; padding:.6rem .8rem; border-radius:6px; margin:0 0 .9rem; font-size:.9rem; }
.login label { display:grid; gap:.25rem; font-size:.85rem; letter-spacing:.08em; }
.login input { padding:.6rem .75rem; border:1px solid rgba(212,175,55,.35); border-radius:8px; font:inherit; color:var(--paper); background:rgba(10,8,9,.7); }
.login input:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 2px rgba(212,175,55,.25); }
.login button { background:linear-gradient(135deg,#f5e6c8,var(--gold)); color:var(--ink); border:0; padding:.65rem 1rem; border-radius:999px; cursor:pointer; font:inherit; font-weight:600; letter-spacing:.1em; }
.login button:hover { filter:brightness(1.06); }
.flash.err { background:rgba(185,28,28,.15); color:#fecaca; border:1px solid rgba(185,28,28,.45); padding:.6rem .8rem; border-radius:8px; margin:0 0 .9rem; font-size:.9rem; }
a.back { color:var(--gold); text-decoration:none; font-size:.85rem; }
a.back:hover { color:#f5e6c8; }
</style>
</head>
<body style="background:#f8f9fa url('/static/img/bg-body-960.webp') center/cover fixed;">
<body>
<div class="login">
<h1>暗恋见君</h1>
<p class="sub">登录后发帖与管理。</p>
<h1>Marqdo Admin</h1>
<p class="sub">Sign in to open the table-declared desk.</p>
%s
<form method="post" action="%s">
%s%s
@@ -457,6 +463,8 @@ body { margin:0; min-height:100vh; display:grid; place-items:center; background:
<label>Password<input name="password" type="password" autocomplete="current-password" required/></label>
<button type="submit">Sign in</button>
</form>
<p class="hint">Demo · admin / demo</p>
<p style="margin:1.1rem 0 0"><a class="back" href="/">← Site</a></p>
</div>
</body></html>`, errHTML, esc(loginAction), csrfField, nextField)
}
+35 -9
View File
@@ -136,19 +136,17 @@ func NewHandler(appBag map[string]any, entryDir string) (http.Handler, error) {
})
}
if staticDir != "" {
fmt.Fprintf(os.Stderr, "marqdo web static: %s → %s\n", staticMount, staticDir)
fs := http.StripPrefix(staticMount, http.FileServer(http.Dir(staticDir)))
mux.Handle("GET "+staticMount+"/", fs)
mux.Handle("HEAD "+staticMount+"/", fs)
mux.Handle("GET "+staticMount, fs)
mux.Handle("HEAD "+staticMount, fs)
}
// Icon routes before the static prefix so /static/favicon.svg does not
// conflict with Go 1.22+ ServeMux method/path overlap rules.
for _, ir := range iconRoutes {
url := ir.URL
path := ir.Path
ct := ir.ContentType
if staticDir != "" && (url == staticMount || strings.HasPrefix(url, staticMount+"/")) {
// FileServer under staticMount already serves these paths.
fmt.Fprintf(os.Stderr, "marqdo web icon: %s → static %s (via %s)\n", url, path, staticMount)
continue
}
fmt.Fprintf(os.Stderr, "marqdo web icon: %s → %s (%s)\n", url, path, ct)
mux.HandleFunc("GET "+url, func(w http.ResponseWriter, r *http.Request) {
st.serveIcon(w, path, ct)
@@ -158,6 +156,27 @@ func NewHandler(appBag map[string]any, entryDir string) (http.Handler, error) {
})
}
if staticDir != "" {
fmt.Fprintf(os.Stderr, "marqdo web static: %s → %s\n", staticMount, staticDir)
fs := http.StripPrefix(staticMount, http.FileServer(http.Dir(staticDir)))
// Register without method so GET+HEAD share one pattern (avoids conflicts
// with more-specific GET/HEAD icon paths under the same prefix).
mux.Handle(staticMount+"/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet && r.Method != http.MethodHead {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
fs.ServeHTTP(w, r)
}))
mux.Handle(staticMount, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet && r.Method != http.MethodHead {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
fs.ServeHTTP(w, r)
}))
}
for _, from := range sortedKeys(st.redirects) {
spec, _ := st.redirects[from].(map[string]any)
to := strOpt(spec, "to", "/")
@@ -625,11 +644,18 @@ func collectPageForms(page map[string]any, forms map[string]any) {
func injectParams(page map[string]any, params map[string]any) {
page["params"] = params
// Stamp concrete path onto `_route` so part slot URLs use /post/slug not /post/{slug}.
if r, ok := page["_route"].(string); ok && r != "" && len(params) > 0 {
page["_route"] = render.ResolveRouteParams(r, params)
}
if parts, ok := page["parts"].(map[string]any); ok {
for k, cfg := range parts {
if m, ok := cfg.(map[string]any); ok {
cp := cloneMap(m)
cp["params"] = params
if r, ok := cp["_route"].(string); ok && r != "" {
cp["_route"] = render.ResolveRouteParams(r, params)
}
parts[k] = cp
}
}
+38
View File
@@ -0,0 +1,38 @@
package render
import (
"bytes"
"strings"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
)
// markdownToHTML renders article body Markdown to HTML (GFM subset), matching
// the Rust web plugin's pulldown-cmark path.
func markdownToHTML(md string) string {
md = strings.TrimSpace(md)
if md == "" {
return ""
}
gm := goldmark.New(
goldmark.WithExtensions(
extension.GFM,
extension.Strikethrough,
),
goldmark.WithParserOptions(
parser.WithAutoHeadingID(),
),
goldmark.WithRendererOptions(
html.WithHardWraps(),
html.WithXHTML(),
),
)
var buf bytes.Buffer
if err := gm.Convert([]byte(md), &buf); err != nil {
return `<div class="article-body"><p class="article-p">` + esc(md) + `</p></div>`
}
return `<div class="article-body md">` + buf.String() + `</div>`
}
+80 -3
View File
@@ -191,7 +191,8 @@ func navWhenVisible(when navWhen, auth *bool) bool {
func selectPageData(url, tableName string, page map[string]any, limit, offset int64) map[string]any {
var where any
if q, ok := page["query"]; ok {
where = q
// Expand `{param}` placeholders from dynamic route params (ABI: 查询条件).
where = resolvePlaceholders(q, pageParams(page))
}
order, _ := page["order"].(string)
opts := db.SelectOpts{Where: where, Order: order}
@@ -205,6 +206,78 @@ func selectPageData(url, tableName string, page map[string]any, limit, offset in
return out
}
func pageParams(page map[string]any) map[string]any {
if page == nil {
return nil
}
p, _ := page["params"].(map[string]any)
return p
}
// resolvePlaceholders walks query / route values and replaces `{name}` with
// page.params[name]. Unmatched placeholders are left as `{name}` for debugging.
func resolvePlaceholders(v any, params map[string]any) any {
if len(params) == 0 {
return v
}
switch t := v.(type) {
case string:
return resolveParamsString(t, params)
case map[string]any:
out := make(map[string]any, len(t))
for k, val := range t {
out[k] = resolvePlaceholders(val, params)
}
return out
case []any:
out := make([]any, len(t))
for i, val := range t {
out[i] = resolvePlaceholders(val, params)
}
return out
default:
return v
}
}
// ResolveRouteParams substitutes `{name}` in a route pattern using params.
func ResolveRouteParams(pattern string, params map[string]any) string {
return resolveParamsString(pattern, params)
}
func resolveParamsString(s string, params map[string]any) string {
if !strings.Contains(s, "{") || len(params) == 0 {
return s
}
var out strings.Builder
rest := s
for {
start := strings.Index(rest, "{")
if start < 0 {
out.WriteString(rest)
break
}
out.WriteString(rest[:start])
rest = rest[start+1:]
end := strings.Index(rest, "}")
if end < 0 {
out.WriteByte('{')
out.WriteString(rest)
break
}
key := rest[:end]
if val, ok := params[key]; ok {
out.WriteString(text(val))
} else {
out.WriteByte('{')
out.WriteString(key)
out.WriteByte('}')
}
rest = rest[end+1:]
}
return out.String()
}
func resolveLinks(raw any, dbURL string, page map[string]any) []navLink {
if raw == nil {
return nil
@@ -400,6 +473,7 @@ func fieldCSS(obj map[string]any, field string) string {
func partSrcPrefix(page map[string]any) string {
r, _ := page["_route"].(string)
r = resolveParamsString(r, pageParams(page))
if r == "" || r == "/" {
return ""
}
@@ -479,6 +553,10 @@ const shellWidgets = `
.site-form { margin-top:1.25rem; max-width:28rem; }
.article { background:#fff; border:1px solid var(--line); border-radius:8px; padding:2rem; margin-top:1.5rem; }
.article-title { margin:0 0 .75rem; font-size:2rem; }
.article-body { line-height:1.75; color:var(--ink); }
.article-body.md { line-height: 1.75; }
.article-body.md pre { background:#f5f5f4; border:1px solid var(--line); border-radius:6px; padding:1rem; overflow-x:auto; }
.article-body.md code { font-size:.9em; }
.pagination { display:flex; gap:1rem; align-items:center; margin:1.5rem 0; font-size:.95rem; }
`
@@ -624,8 +702,7 @@ func renderArticle(it map[string]any) string {
s.WriteString(fmt.Sprintf(`<div class="article-tags">%s</div>`, esc(tag)))
}
if body != "" {
// Minimal: escape as paragraphs (full markdown deferred).
s.WriteString(fmt.Sprintf(`<div class="article-body"><p class="article-p">%s</p></div>`, esc(body)))
s.WriteString(markdownToHTML(body))
}
s.WriteString("</article>")
return s.String()
@@ -227,3 +227,33 @@ func TestRenderPageNavChrome(t *testing.T) {
}
}
}
func TestResolveRouteParams(t *testing.T) {
got := render.ResolveRouteParams("/post/{slug}", map[string]any{"slug": "hello-marqdo"})
if got != "/post/hello-marqdo" {
t.Fatalf("got %q", got)
}
got = render.ResolveRouteParams("/post/{slug}", map[string]any{})
if got != "/post/{slug}" {
t.Fatalf("unmatched must stay: %q", got)
}
}
func TestPartSlotSrcUsesResolvedRoute(t *testing.T) {
page := map[string]any{
"title": "post",
"intro": "",
"_route": "/post/{slug}",
"params": map[string]any{"slug": "hello-marqdo"},
"parts": map[string]any{
"index": map[string]any{"slot": "main"},
},
}
html := render.RenderPage(page, "", "")
if strings.Contains(html, "/post/{slug}/_part/") {
t.Fatalf("slot src still has placeholder: %s", html)
}
if !strings.Contains(html, `data-slot-src="/post/hello-marqdo/_part/index"`) {
t.Fatalf("missing resolved slot src: %s", html)
}
}
@@ -0,0 +1,105 @@
package render
import (
"path/filepath"
"strings"
"testing"
"github.com/marqdo/marqdo/plugins/web/internal/db"
)
func TestResolvePlaceholdersColumnarAndRows(t *testing.T) {
params := map[string]any{"slug": "hello-marqdo"}
col := map[string]any{
"字段": []any{"slug"},
"操作": []any{"="},
"值": []any{"{slug}"},
}
got := resolvePlaceholders(col, params).(map[string]any)
vals := got["值"].([]any)
if vals[0] != "hello-marqdo" {
t.Fatalf("columnar 值=%v", vals)
}
rows := []any{
map[string]any{"字段": "slug", "操作": "=", "值": "{slug}"},
}
gotRows := resolvePlaceholders(rows, params).([]any)
m := gotRows[0].(map[string]any)
if m["值"] != "hello-marqdo" {
t.Fatalf("row 值=%v", m["值"])
}
top := map[string]any{"slug": "{slug}"}
gotTop := resolvePlaceholders(top, params).(map[string]any)
if gotTop["slug"] != "hello-marqdo" {
t.Fatalf("map string=%v", gotTop["slug"])
}
}
func TestSelectPageDataResolvesSlug(t *testing.T) {
dir := t.TempDir()
dbPath := filepath.Join(dir, "t.db")
url := "sqlite:" + dbPath
t.Cleanup(db.ResetPool)
fields := []any{
map[string]any{"name": "slug", "type": "text", "nullable": false},
map[string]any{"name": "title", "type": "text", "nullable": false},
map[string]any{"name": "body", "type": "text", "nullable": true},
}
if _, err := db.Init(url, "posts", fields); err != nil {
t.Fatal(err)
}
if _, err := db.Insert(url, "posts", []any{
map[string]any{"slug": "hello-marqdo", "title": "Hello", "body": "## Hi\n\n*world*"},
}); err != nil {
t.Fatal(err)
}
page := map[string]any{
"title": "post",
"detail": true,
"_route": "/post/{slug}",
"params": map[string]any{"slug": "hello-marqdo"},
"query": map[string]any{
"字段": []any{"slug"},
"操作": []any{"="},
"值": []any{"{slug}"},
},
"main": []any{
map[string]any{"front": "title", "back": "posts.title"},
map[string]any{"front": "body", "back": "posts.body"},
},
"parts": map[string]any{
"index": map[string]any{"slot": "main"},
},
}
html := RenderPage(page, url, "")
if !strings.Contains(html, `class="article-title"`) || !strings.Contains(html, "Hello") {
t.Fatalf("missing article title: %s", html)
}
if !strings.Contains(html, `class="article-body md"`) {
t.Fatalf("missing markdown body wrapper: %s", html)
}
if !strings.Contains(html, "world") {
t.Fatalf("missing markdown content: %s", html)
}
if strings.Contains(html, "{slug}") {
t.Fatalf("literal {slug} still present: %s", html)
}
if !strings.Contains(html, `/post/hello-marqdo/_part/`) {
t.Fatalf("slot prefix not resolved: %s", html)
}
}
func TestMarkdownToHTML(t *testing.T) {
out := markdownToHTML("## Title\n\n**bold** and `code`")
if !strings.Contains(out, `class="article-body md"`) {
t.Fatalf("%s", out)
}
if !strings.Contains(out, "<h2") || !strings.Contains(out, "<strong>bold</strong>") {
t.Fatalf("%s", out)
}
}
+20 -2
View File
@@ -38,12 +38,30 @@ func TestStyleStrictKeepsQuotedSlash(t *testing.T) {
}
}
func TestStyleStrictRejectsNumeric(t *testing.T) {
func TestStyleStrictAllowsNumeric(t *testing.T) {
css, err := style.Style(map[string]any{
"name": "x",
"strict": true,
"table": []any{
map[string]any{"选择器": ".x", "属性": "z-index", "值": float64(20)},
map[string]any{"选择器": ".y", "属性": "opacity", "值": float64(0.5)},
map[string]any{"选择器": ".z", "属性": "font-weight", "值": float64(700)},
},
})
if err != nil {
t.Fatalf("numeric CSS must not be suspicious: %v", err)
}
if !strings.Contains(css, "z-index: 20") || !strings.Contains(css, "opacity: 0.5") {
t.Fatalf("%q", css)
}
}
func TestStyleStrictRejectsBoolean(t *testing.T) {
_, err := style.Style(map[string]any{
"name": "x",
"strict": true,
"table": []any{
map[string]any{"选择器": ".x", "属性": "grid-column", "值": float64(0)},
map[string]any{"选择器": ".x", "属性": "display", "值": true},
},
})
if err == nil || !strings.Contains(err.Error(), "suspicious") {
+2 -2
View File
@@ -693,9 +693,9 @@ func AsCSSNamedChecked(name string, table any, strict bool) (string, error) {
}
func cssValueSuspicious(v any) string {
// Numbers are normal CSS (z-index, opacity, font-weight, unitless 0).
// Do not treat Markup-evaluated ints/floats as "bare `/` division".
switch v.(type) {
case float64, int, int64:
return "numeric CSS value (likely bare `/` division such as `1 / 5`; quote the cell, e.g. `\"1 / 5\"`)"
case bool:
return "boolean CSS value (quote the cell if intentional)"
default:
+44
View File
@@ -60,6 +60,8 @@ extern int web_page_chrome(char *args_json, char **out_json, char **err_msg);
extern int web_style(char *args_json, char **out_json, char **err_msg);
extern int web_compose_components(char *args_json, char **out_json, char **err_msg);
extern int web_compose_main(char *args_json, char **out_json, char **err_msg);
extern int web_compose_intro(char *args_json, char **out_json, char **err_msg);
extern int web_intro(char *args_json, char **out_json, char **err_msg);
extern int web_render(char *args_json, char **out_json, char **err_msg);
extern int web_db_new(char *args_json, char **out_json, char **err_msg);
extern int web_db_init(char *args_json, char **out_json, char **err_msg);
@@ -153,6 +155,8 @@ static int register_core(void) {
if (host_register((char *)"web_style", (char *)"name,table,strict", web_style) != 0) return 1;
if (host_register((char *)"web_compose_components", (char *)"page,components", web_compose_components) != 0) return 1;
if (host_register((char *)"web_compose_main", (char *)"page,main", web_compose_main) != 0) return 1;
if (host_register((char *)"web_compose_intro", (char *)"page,intro", web_compose_intro) != 0) return 1;
if (host_register((char *)"web_intro", (char *)"table", web_intro) != 0) return 1;
if (host_register((char *)"web_compose_form", (char *)"page,form,id,target", web_compose_form) != 0) return 1;
if (host_register((char *)"web_render", (char *)"page", web_render) != 0) return 1;
if (host_register((char *)"web_db_new", (char *)"url", web_db_new) != 0) return 1;
@@ -509,6 +513,46 @@ func web_compose_main(argsJSON *C.char, outJSON **C.char, errMsg **C.char) C.int
return replyJSON(outJSON, errMsg, out, err)
}
//export web_compose_intro
func web_compose_intro(argsJSON *C.char, outJSON **C.char, errMsg **C.char) C.int {
args, err := parseArgs(argsJSON)
if err != nil {
return replyJSON(outJSON, errMsg, nil, err)
}
pageBag := asPageMap(args["page"])
intro := args["intro"]
if intro == nil {
intro = args["引言"]
}
if intro == nil {
intro = args["table"]
}
if intro == nil {
return replyJSON(outJSON, errMsg, nil, fmt.Errorf("missing `intro`"))
}
out, err := compose.ComposeIntro(pageBag, intro, callLib)
return replyJSON(outJSON, errMsg, out, err)
}
//export web_intro
func web_intro(argsJSON *C.char, outJSON **C.char, errMsg **C.char) C.int {
args, err := parseArgs(argsJSON)
if err != nil {
return replyJSON(outJSON, errMsg, nil, err)
}
tbl := args["table"]
if tbl == nil {
tbl = args["intro"]
}
if tbl == nil {
tbl = args["表"]
}
if tbl == nil {
return replyJSON(outJSON, errMsg, nil, fmt.Errorf("missing `table`"))
}
return replyJSON(outJSON, errMsg, compose.MakeIntroHTML(tbl), nil)
}
//export web_render
func web_render(argsJSON *C.char, outJSON **C.char, errMsg **C.char) C.int {
args, err := parseArgs(argsJSON)
+1 -1
View File
@@ -34,7 +34,7 @@ ext/llm — OpenAI-compatible chat. Design: doc/design/ext-llm.md
ext/agent — agent framework + native plugin. Design: doc/design/ext-agent.md
ext/web — HTTP / SQLite·Postgres site helpers + native plugin (default *Go libweb*, v0.4.0). **W0–W7 + P3 + W8** + **customization C0–C4**; acceptance example `examples/anlian-mq/`. **Browser embed (routes D/E/F, v0.3.4)**: `web.client_embed` auto-mounts WASM — zero author JS; `lib/browser` + GFM tables; build with `marqdo wasm build`; examples: browser-hello · browser-app · browser-media · web-client-site. Design: doc/design/ext-web.md · WASM: doc/adr/0002-browser-marqdo-wasm.md · roadmaps D/E/F.
ext/web — HTTP / SQLite·Postgres site helpers + native plugin (default *Go libweb*, v0.4.0). W0–W7, P3, W8, and customization C0–C4; acceptance example `examples/anlian-mq/`. Browser embed (routes D/E/F, v0.3.4): `web.client_embed` auto-mounts WASM — zero author JS; `lib/browser` + GFM tables; build with `marqdo wasm build`; examples: browser-hello · browser-app · browser-media · web-client-site. Design: doc/design/ext-web.md · WASM: doc/adr/0002-browser-marqdo-wasm.md · roadmaps D/E/F.
ext/quantum — circuits, draw, noise, formula matrix custom gates, Q7 density/viz, Q8 themed SVG (`theme=dark|light|bw`). Design: doc/design/ext-quantum.md · doc/design/ext-quantum-viz-style.md
+1 -1
View File
@@ -34,7 +34,7 @@ ext/llm(大模型)— OpenAI 兼容聊天。设计:doc/design/ext-llm.md
ext/agent(智能体)— 智能体框架 + 原生插件。设计:doc/design/ext-agent.md
ext/web(网页)— HTTP / SQLite 站点助手 + 原生插件(默认 *Go libweb*,v0.4.0)。**W0–W7 + P3 + W8** + **定制 C0–C4**;验收示例 `examples/anlian-mq/`。**浏览器挂载(路线 D/E/F,v0.3.4)**:`网页.客户端挂载` / `web.client_embed` 自动 mount(作者零业务 JS);`lib/浏览器` + GFM;先 `marqdo wasm build`;示例 examples/browser-hello/ · examples/browser-app/ · examples/browser-media/ · examples/web-client-site/。设计:doc/design/ext-web.md · WASM:doc/adr/0002-browser-marqdo-wasm.md · 路线 D/E/F:doc/roadmap/browser-wasm-*.md
ext/web(网页)— HTTP / SQLite 站点助手 + 原生插件(默认 *Go libweb*,v0.4.0)。W0–W7、P3、W8 与定制 C0–C4;验收示例 `examples/anlian-mq/`。浏览器挂载(路线 D/E/F,v0.3.4):`网页.客户端挂载` / `web.client_embed` 自动 mount(作者零业务 JS);`lib/浏览器` + GFM;先 `marqdo wasm build`;示例 examples/browser-hello/ · examples/browser-app/ · examples/browser-media/ · examples/web-client-site/。设计:doc/design/ext-web.md · WASM:doc/adr/0002-browser-marqdo-wasm.md · 路线 D/E/F:doc/roadmap/browser-wasm-*.md
ext/quantum(量子)— 电路、绘图、噪声、公式矩阵自定义门、Q7 密度/高级图、Q8 主题 SVG(`主题=dark|light|bw`)。设计:doc/design/ext-quantum.md · doc/design/ext-quantum-viz-style.md
+3 -3
View File
@@ -24,8 +24,8 @@ Light statistics and optional `fields=` on log lines — no remote sinks, no dat
`fld` =
| step |
|------|
| done |
| step | status |
|------|--------|
| done | ok |
> log.info text="mid2-m10" fields=`fld`
+1 -1
View File
@@ -13,7 +13,7 @@ No extra allow flags: importing a module means you intend to use it. Under marqd
Modules: text (text / 文本), table (table / 表), files (fs / 文件), time (time / 时间), system (sys / 系统), json (json only), net (net / 网络), math (math / 数学), foreign (foreign / 外联), plugin (plugin / 插件), writeback (writeback / 自写回), subtask (subtask / 子任务).
From **v0.1.2**, official `lib/*.mq.md` is **embedded in the `marqdo` binary** (disk `lib/` or `MARQDO_LIB` still overrides). Standalone `.exe` works without a separate stdlib zip.
From v0.1.2, official `lib/*.mq.md` is embedded in the `marqdo` binary (disk `lib/` or `MARQDO_LIB` still overrides). Standalone `.exe` works without a separate stdlib zip.
Official optional extensions live under ext/ (not stdlib): ext/llm, ext/agent — see features/05-extensions.mq.md and doc/design/ext-llm.md / ext-agent.md.
+1 -1
View File
@@ -13,7 +13,7 @@ description: 如何导入官方 lib 模块
模块:文本(text / 文本)、表(table / 表)、文件(fs / 文件)、时间(time / 时间)、系统(sys / 系统)、json(仅 json)、网络(net / 网络)、数学(math / 数学)、外联(foreign / 外联)、插件(plugin / 插件)、自写回(writeback / 自写回)、子任务(subtask / 子任务)。
自 **v0.1.2** 起,官方 `lib/*.mq.md` **内置于 `marqdo` 二进制**(磁盘 `lib/` 或 `MARQDO_LIB` 仍可覆盖)。单独下载 `.exe` 即可导入标准库,无需再解压 stdlib 包。
自 v0.1.2 起,官方 `lib/*.mq.md` 内置于 `marqdo` 二进制(磁盘 `lib/` 或 `MARQDO_LIB` 仍可覆盖)。单独下载 `.exe` 即可导入标准库,无需再解压 stdlib 包。
官方可选扩展在 ext/(不是标准库):ext/llm、ext/agent — 见 features/05-扩展.mq.md。
+55
View File
@@ -0,0 +1,55 @@
---
title: web compose_intro bind table
description: Intro uses the same front/back/style bind as compose_main.
import web:ext/web/web.mq.md
import sys:lib/sys.mq.md
---
# main
`intro` =
| front | back | style |
|-------|------|-------|
| kicker | Demo kicker | kicker |
| title | Hello | intro_title |
| lede | "Try code and [link](/x)." | lede |
| claim | A | claim |
| claim | B | claim |
| step | First step | step |
**page = > web.page title="Intro bind"**
**page = > page.compose_intro intro=intro**
**html = > page.render**
**a = > split value=`html` sep="class=\"kicker\""**
**na = > len value=`a`**
**b = > split value=`html` sep="class=\"intro_title\""**
**nb = > len value=`b`**
**c = > split value=`html` sep="href=\"/x\""**
**nc = > len value=`c`**
**d = > split value=`html` sep="class=\"claim\""**
**nd = > len value=`d`**
**e = > split value=`html` sep="class=\"steps\""**
**ne = > len value=`e`**
1. `na` > 1
1. `nb` > 1
1. `nc` > 1
1. `nd` > 1
1. `ne` > 1
> print text=compose-intro-ok
2. *
> print text=compose-intro-steps-missing
> sys.exit code=1
2. *
> print text=compose-intro-claim-missing
> sys.exit code=1
2. *
> print text=compose-intro-link-missing
> sys.exit code=1
2. *
> print text=compose-intro-title-missing
> sys.exit code=1
2. *
> print text=compose-intro-kicker-missing
> sys.exit code=1