Add Chinese web-site example and 网页.mq.md smoke.

Mirrors the English sample on port 18082 using only Chinese class APIs for page, db, form, and app.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-12 09:20:34 +08:00
1 parent c181b74a88
commit a0c56fa352
10 files changed
+287

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
# examples/web-site-zh
中文作者面示例:只导入 `ext/web/网页.mq.md`(不用英文 `web.mq.md`)。
```bash
cargo build -p marqdo_plugin_web
cargo run -- examples/web-site-zh/index.mq.md
```
打开 http://127.0.0.1:18082/ — `/about`、`/new`、`/admin`。
@@ -0,0 +1,9 @@
## foot
`foot` =
| 属性 | 值 | 样式 |
|------|-----|------|
| Marqdo | https://github.com | |
**`foot`**
+12
View File
@@ -0,0 +1,12 @@
## nav
`nav` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 首页 | / | |
| 关于 | /about | |
| 写文章 | /new | |
| 后台 | /admin | |
**`nav`**
@@ -0,0 +1,10 @@
## side
`side` =
| 属性 | 值 | 样式 |
|------|-----|------|
| 笔记 | / | |
| 文档 | https://github.com | |
**`side`**
+22
View File
@@ -0,0 +1,22 @@
## schema
`fields` =
| 字段 | 类型 | 可空 |
|------|------|------|
| id | integer | false |
| title | text | false |
| body | text | true |
**`fields`**
## seed
`rows` =
| id | title | body |
|----|-------|------|
| 1 | 你好 Marqdo | 第一篇来自 GFM 表格。 |
| 2 | 代码即文档 | 页面表就是程序。 |
**`rows`**
+19
View File
@@ -0,0 +1,19 @@
---
title: db/index
description: 打开 sqlite、建表、幂等种子。
> ext/web/网页.mq.md
> articles.mq.md as articles
---
## open
*`store` = > 网页.数据库 地址="sqlite:data/site-zh.db" *
*`fields` = > articles.schema *
> `store`.初始化 名=articles 字段=`fields`
*`rows` = > `store`.查询 表=articles 上限=1 *
1. `rows`
**`store`**
2. *
*`seed` = > articles.seed *
> `store`.插入 表=articles 行=`seed`
**`store`**
+64
View File
@@ -0,0 +1,64 @@
---
title: 中文站点示例
description: Home + /about + /new(表单嵌入)+ 后台;只用 ext/web/网页.mq.md。
> ext/web/网页.mq.md
> styles/shell.mq.md
> components/nav.mq.md
> components/side.mq.md
> components/foot.mq.md
> db/articles.mq.md
> db/index.mq.md as db
---
# main
`home` =
| 组件 | 样式 |
|------|------|
| nav.`nav` | shell.`topnav` |
| side.`side` | shell.`side_panel` |
| foot.`foot` | |
`index` =
| 属性 | 值 | 样式 |
|------|-----|------|
| `title` | articles.`articles`.title | shell.`card_title` |
| `body` | articles.`articles`.body | shell.`card_body` |
`article_fields` =
| 字段 | 标签 | 类型 | 必填 | 默认 |
|------|------|------|------|------|
| title | 标题 | text | true | |
| body | 正文 | textarea | false | |
`article_rules` =
| 字段 | 规则 | 消息 |
|------|------|------|
| title | required | 标题不能为空 |
| title | max:120 | 标题太长 |
| body | max:8000 | 正文太长 |
*`store` = > db.open *
*`page` = > 网页.页面 标题="Marqdo 中文站" 引言="<h1>中文站</h1><p>表格 + 类方法。</p>" *
*`page` = > `page`.组件装配 组件=`home` *
*`page` = > `page`.主体装配 主体=`index` *
*`about` = > 网页.页面 标题="关于" 引言="<h1>关于</h1><p>导入网页.mq.md 即用中文 API。</p>" *
*`about` = > `about`.组件装配 组件=`home` *
*`article_form` = > 网页.表单 表=articles 动作=插入 *
*`article_form` = > `article_form`.字段 字段=`article_fields` *
*`article_form` = > `article_form`.规则 规则=`article_rules` *
*`new` = > 网页.页面 标题="写文章" 引言="<h1>写文章</h1><p>表单嵌在主区。</p>" *
*`new` = > `new`.组件装配 组件=`home` *
*`new` = > `new`.表单装配 id=article 表单=`article_form` *
*`app` = > 网页.应用 页面=`page` 数据库=`store` 后台=True 主机=127.0.0.1 端口=18082 *
*`app` = > `app`.路由 路径=/about 页面=`about` *
*`app` = > `app`.路由 路径=/new 页面=`new` *
> `app`.监听
+42
View File
@@ -0,0 +1,42 @@
## topnav
`topnav` =
| 属性 | 值 |
|------|-----|
| background | #ffffff |
| border-bottom | 1px solid #e7e5e4 |
**`topnav`**
## side_panel
`side_panel` =
| 属性 | 值 |
|------|-----|
| background | #f5f5f4 |
**`side_panel`**
## card_title
`card_title` =
| 属性 | 值 |
|------|-----|
| font-size | 1.15rem |
| margin | 0 0 0.35rem |
**`card_title`**
## card_body
`card_body` =
| 属性 | 值 |
|------|-----|
| color | #57534e |
| margin | 0 |
**`card_body`**