Files
marqdo/examples/web-site/index.mq.md
T
cflmyandCursor bd5555afaa Unify bare-identifier semantics in *…* / **…** (Python namespace)
Inside italic/bold code segments every bare word is a variable — including
call arguments and method-call receivers — so text literals must be quoted
and receivers no longer need backticks. A bare dotted callee `a.b` resolves
as a method call when `a` is a local variable, otherwise as a library path
(Python-style unified namespace), in both the tree-walk and bytecode backends.

Migrate ~70 tests plus ext/web, ext/quantum, ext/ai and the example projects
to the new idiom; update SKILL.md and the design docs; fix the web/quantum
example data model (db/index.mq.md). Unit and gold suites pass; only the 3
network-live tests fail offline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 11:20:46 +08:00

74 lines
2.2 KiB
Markdown

---
title: web-site
description: Home + /about + /new (form in page slot) + admin.
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 articles:db/articles.mq.md
import db:db/index.mq.md
---
# main
`home` =
| 组件 | 样式 |
|------|------|
| nav.`nav` | shell.`topnav` |
| side.`side` | shell.`side_panel` |
| foot.`foot` | |
Main content is not a reusable component, so it is authored here.
`index` =
| 属性 | 值 | 样式 |
|------|-----|------|
| title | articles.`articles`.title | shell.`card_title` |
| body | articles.`articles`.body | shell.`card_body` |
Article create form (design §5.5): field table + rules table.
`article_fields` =
| 字段 | 标签 | 类型 | 必填 | 默认 |
|------|------|------|------|------|
| title | Title | text | true | |
| body | Body | textarea | false | |
`article_rules` =
| 字段 | 规则 | 消息 |
|------|------|------|
| title | required | Title is required |
| title | max:120 | Title is too long |
| body | max:8000 | Body is too long |
*store = > db.open*
*page = > web.page title="Marqdo Web Site" intro="<h1>Web Site</h1><p>Tables + class methods.</p>"*
*page = > page.compose_components components=home*
*page = > page.compose_main main=index*
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 = > 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 = > 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*
*app = > app.route path="/about" page=about*
*app = > app.route path="/new" page=new*
*app = > app.static dir="public" mount="/static"*
> `app`.listen