Add ext/web with table-driven pages and polished admin CRUD.

Ship the web L1/plugin stack (bind tables, variable-named db.init, live render) and tighten the admin UI with sidebar, toolbar, forms, and activity log.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-11 11:42:17 +08:00
1 parent ab8ea8438f
commit 8041a2274c
26 files changed
+5689 -242

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
# ext/web
Official dynamic website extension. Design: [`doc/design/ext-web.md`](../../doc/design/ext-web.md).
```bash
cargo build -p marqdo_plugin_web
marqdo ext add web
```
```markdown
---
> ext/web/web.mq.md
---
# main
> web.ensure_plugin
*`page` = > web.page title=Hi *
*`app` = > web.app page=`page` *
> `app`.listen
```
Scaffold: `> web.scaffold dest=./myapp`
+10
View File
@@ -0,0 +1,10 @@
MARQDO_WEB_HOST=127.0.0.1
MARQDO_WEB_PORT=8080
DATABASE_URL=sqlite:./data/app.db
# MARQDO_WEB_ADMIN_USER=admin
# MARQDO_WEB_ADMIN_PASSWORD=change-me
# REDIS_URL=redis://127.0.0.1:6379/0
# MARQDO_S3_ENDPOINT=
# MARQDO_S3_BUCKET=
# MARQDO_S3_ACCESS_KEY=
# MARQDO_S3_SECRET_KEY=
+51
View File
@@ -0,0 +1,51 @@
---
title: ext/web starter app
description: Variable name = table name; page methods bind regions.
> ext/web/web.mq.md
---
# main
> web.load_env path=.env
> web.ensure_plugin
`nav` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| 首页 | / | |
| 管理 | /admin | |
`side` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| 全部文章 | / | |
| 管理后台 | /admin | |
`articles` =
| 字段 | 类型 | 可空 |
|------|------|------|
| id | integer | false |
| title | text | false |
| body | text | true |
`主体` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| title | title | card-title |
| body | body | card-body |
*`db` = > web.db *
*`articles` = > `db`.init name=articles fields=`articles` *
*`page` = > web.page title=Starter *
*`page` = > `page`.nav table=`nav` *
*`page` = > `page`.sidebar table=`side` *
*`page` = > `page`.main table=`articles` bind=`主体` layout=cards intro="<h1>Starter</h1>" *
*`app` = > web.app page=`page` db=`db` admin=True *
> `app`.static dir=./static
> `app`.listen
@@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
body TEXT,
created_at TEXT DEFAULT (datetime('now'))
);
+509
View File
@@ -0,0 +1,509 @@
/* Marqdo Web default theme — semantic / classless shell.
Content kinds: prose, cards, table. No purple/cream-terracotta AI defaults. */
:root {
--ink: #1c1917;
--ink-muted: #57534e;
--paper: #fafaf9;
--panel: #ffffff;
--line: #e7e5e4;
--accent: #0f766e;
--accent-hover: #0d9488;
--side-w: 14rem;
--radius: 6px;
--font-display: "Source Serif 4", "Noto Serif SC", Georgia, serif;
--font-ui: "IBM Plex Sans", "Noto Sans SC", "Segoe UI", sans-serif;
--font-mono: "IBM Plex Mono", ui-monospace, monospace;
--space: 1.25rem;
--max-prose: 42rem;
}
* {
box-sizing: border-box;
}
html {
font-size: 16px;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
grid-template-rows: auto 1fr auto;
grid-template-columns: 1fr;
background: var(--paper);
color: var(--ink);
font-family: var(--font-ui);
line-height: 1.55;
}
body.has-sidebar {
grid-template-columns: var(--side-w) 1fr;
grid-template-areas:
"top top"
"side main"
"foot foot";
}
body.no-sidebar {
grid-template-areas:
"top"
"main"
"foot";
}
/* —— Shell —— */
header.topnav {
grid-area: top;
background: var(--panel);
border-bottom: 1px solid var(--line);
padding: 0.85rem var(--space);
position: sticky;
top: 0;
z-index: 10;
}
aside.side {
grid-area: side;
background: #f5f5f4;
border-right: 1px solid var(--line);
padding: var(--space) 1rem;
min-height: 0;
}
main.main {
grid-area: main;
padding: calc(var(--space) * 1.25) var(--space) calc(var(--space) * 2);
min-width: 0;
}
footer.foot {
grid-area: foot;
border-top: 1px solid var(--line);
padding: 0.85rem var(--space);
color: var(--ink-muted);
font-size: 0.9rem;
background: var(--panel);
}
/* —— Nav links —— */
ul.nav,
ul.side-nav,
ul.foot-nav {
list-style: none;
margin: 0;
padding: 0;
display: flex;
gap: 0.35rem 1.15rem;
flex-wrap: wrap;
align-items: center;
}
ul.side-nav {
flex-direction: column;
align-items: stretch;
gap: 0.2rem;
}
aside.side .side-label {
display: block;
font-size: 0.72rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--ink-muted);
margin: 0 0 0.65rem;
font-family: var(--font-ui);
}
ul.nav a,
ul.side-nav a,
ul.foot-nav a {
color: var(--ink);
text-decoration: none;
font-weight: 500;
border-radius: var(--radius);
padding: 0.35rem 0.45rem;
}
ul.side-nav a {
display: block;
padding: 0.45rem 0.6rem;
}
ul.nav a:hover,
ul.side-nav a:hover,
ul.foot-nav a:hover {
color: var(--accent);
background: rgba(15, 118, 110, 0.08);
}
ul.side-nav a[aria-current="page"],
ul.nav a[aria-current="page"] {
color: var(--accent);
background: rgba(15, 118, 110, 0.12);
}
/* —— Prose (intro / raw main HTML) —— */
.main-intro,
.content.prose {
max-width: var(--max-prose);
font-family: var(--font-display);
font-size: 1.125rem;
}
.main-intro h1,
.content.prose h1 {
font-size: 2rem;
line-height: 1.2;
margin: 0 0 0.75rem;
letter-spacing: -0.02em;
}
.main-intro p,
.content.prose p {
margin: 0 0 1rem;
color: var(--ink-muted);
}
/* Bound field hooks from `|绑定css样式|` */
.card-title {
font-family: var(--font-display);
}
.card-body {
color: var(--ink-muted);
}
.content.cards {
display: grid;
gap: 1rem;
margin-top: 1.25rem;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.content.cards article {
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 1rem 1.1rem;
box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
}
.content.cards article h2 {
font-family: var(--font-display);
font-size: 1.2rem;
margin: 0 0 0.45rem;
line-height: 1.3;
}
.content.cards article p {
margin: 0;
color: var(--ink-muted);
font-size: 0.95rem;
}
.content.cards article .meta {
margin-top: 0.65rem;
font-size: 0.8rem;
color: var(--ink-muted);
font-family: var(--font-mono);
}
/* —— Table layout —— */
.content.table-wrap {
margin-top: 1.25rem;
overflow-x: auto;
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--panel);
}
.content.table-wrap table {
width: 100%;
border-collapse: collapse;
font-size: 0.95rem;
}
.content.table-wrap th,
.content.table-wrap td {
padding: 0.55rem 0.75rem;
text-align: left;
border-bottom: 1px solid var(--line);
}
.content.table-wrap th {
background: #f5f5f4;
font-weight: 600;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--ink-muted);
}
.content.table-wrap tr:last-child td {
border-bottom: 0;
}
/* —— Simple list —— */
.content.list {
margin: 1.25rem 0 0;
padding: 0;
list-style: none;
max-width: var(--max-prose);
}
.content.list li {
padding: 0.65rem 0;
border-bottom: 1px solid var(--line);
font-family: var(--font-display);
}
/* —— Admin panel —— */
.admin-page {
max-width: 56rem;
}
.admin-bar {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1.25rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--line);
}
.admin-crumbs {
margin: 0 0 0.25rem;
font-size: 0.8rem;
color: var(--ink-muted);
}
.admin-crumbs a {
color: var(--ink-muted);
text-decoration: none;
}
.admin-crumbs a:hover {
color: var(--accent);
}
.admin-bar h1 {
margin: 0;
font-family: var(--font-display);
font-size: 1.65rem;
letter-spacing: -0.02em;
}
.admin-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.admin-lead {
margin: 0 0 1rem;
color: var(--ink-muted);
}
.admin-empty {
color: var(--ink-muted);
padding: 1.5rem 0;
}
.admin-cards {
display: grid;
gap: 1rem;
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}
.admin-card {
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 1rem 1.1rem;
}
.admin-card h2 {
margin: 0 0 0.35rem;
font-size: 1.15rem;
font-family: var(--font-display);
}
.admin-meta {
margin: 0 0 0.85rem;
font-size: 0.85rem;
color: var(--ink-muted);
font-family: var(--font-mono);
}
.admin-card-actions {
display: flex;
gap: 0.45rem;
}
.btn,
button.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.4rem 0.85rem;
border-radius: var(--radius);
border: 1px solid var(--accent);
background: var(--accent);
color: #fff;
font: inherit;
font-size: 0.9rem;
text-decoration: none;
cursor: pointer;
}
.btn:hover,
button.btn:hover {
background: var(--accent-hover);
border-color: var(--accent-hover);
color: #fff;
}
.btn-ghost {
background: transparent;
color: var(--ink);
border-color: var(--line);
}
.btn-ghost:hover {
background: #f5f5f4;
color: var(--ink);
border-color: var(--line);
}
.btn-danger {
background: #fff;
color: #b91c1c;
border-color: #fecaca;
}
.btn-danger:hover {
background: #fef2f2;
color: #991b1b;
border-color: #fecaca;
}
.btn-small {
padding: 0.25rem 0.55rem;
font-size: 0.8rem;
}
.col-actions {
white-space: nowrap;
width: 1%;
}
.inline-form {
display: inline;
margin: 0;
}
.admin-table th.col-actions {
text-align: right;
}
.admin-table td.col-actions {
text-align: right;
}
.admin-form {
max-width: 28rem;
}
.admin-form-fields {
display: grid;
gap: 0.9rem;
}
.admin-field {
display: grid;
gap: 0.35rem;
}
.admin-field span {
font-size: 0.85rem;
font-weight: 600;
color: var(--ink-muted);
}
.admin-field input,
.admin-field textarea {
width: 100%;
padding: 0.5rem 0.65rem;
border: 1px solid var(--line);
border-radius: var(--radius);
font: inherit;
background: var(--panel);
color: var(--ink);
}
.admin-field input:focus,
.admin-field textarea:focus {
outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
border-color: var(--accent);
}
.admin-form-footer {
display: flex;
gap: 0.5rem;
margin-top: 1.25rem;
}
.log-action {
font-family: var(--font-mono);
font-size: 0.85rem;
}
.log-create {
color: #0f766e;
}
.log-update {
color: #a16207;
}
.log-delete {
color: #b91c1c;
}
aside.side .side-label {
margin-bottom: 0.5rem;
}
a {
color: var(--accent);
}
a:hover {
color: var(--accent-hover);
}
@media (max-width: 720px) {
body.has-sidebar {
grid-template-columns: 1fr;
grid-template-areas:
"top"
"side"
"main"
"foot";
}
aside.side {
border-right: 0;
border-bottom: 1px solid var(--line);
}
ul.side-nav {
flex-direction: row;
flex-wrap: wrap;
}
}
+375
View File
@@ -0,0 +1,375 @@
---
title: ext/web
description: >-
Dynamic website toolkit. Variable name = table name; page regions bound by methods.
> lib/sys.mq.md
> lib/json.mq.md
> lib/plugin.mq.md
> lib/fs.mq.md
---
## load_env
+ `path`=None
**> sys.load_dotenv path=`path`**
## ensure_plugin
*`p` = > plugin.native_path name=web *
1. `p`
> plugin.load path=`p`
2. *
> print text=web-plugin-missing: cargo build -p marqdo_plugin_web or marqdo ext add web
> sys.exit code=1
---
## as_links
+ `table`
**> web_as_links table=`table`**
## as_fields
+ `table`
**> web_as_fields table=`table`**
## as_bind
+ `table`
**> web_as_bind table=`table`**
## as_rows
+ `table`
**> web_as_rows table=`table`**
## table_name
+ `table`
*`t` = > type `table` *
1. `t` == map
*`n` = > json.get value=`table` key=name *
1. `n`
**`n`**
2. *
**`table`**
2. *
**`table`**
---
# page
+ `theme`=starter
+ `title`=Marqdo Web
+ `intro`="<p>Welcome</p>"
+ `layout`=cards
+ `db_url`=None
*`self` = > json.parse text={"_type":"page","theme":"starter","title":"Marqdo Web","intro":"<p>Welcome</p>","layout":"cards","slots":{},"nav":[],"sidebar":[],"footer":[]} *
*`self` = > json.set map=`self` key=theme value=`theme` *
*`self` = > json.set map=`self` key=title value=`title` *
*`self` = > json.set map=`self` key=intro value=`intro` *
*`self` = > json.set map=`self` key=layout value=`layout` *
1. `db_url`
*`self` = > json.set map=`self` key=db_url value=`db_url` *
2. *
*`_` = 1*
**`self`**
## nav
+ `table`
*`b` = > as_bind table=`table` *
*`self` = > json.set map=`self` key=nav value=`b` *
**`self`**
## sidebar
+ `table`
*`b` = > as_bind table=`table` *
*`self` = > json.set map=`self` key=sidebar value=`b` *
**`self`**
## footer
+ `table`
*`b` = > as_bind table=`table` *
*`self` = > json.set map=`self` key=footer value=`b` *
**`self`**
## main
+ `table`
+ `bind`
+ `layout`=cards
+ `intro`=""
*`tn` = > table_name table=`table` *
*`b` = > as_bind table=`bind` *
*`self` = > json.set map=`self` key=table value=`tn` *
*`self` = > json.set map=`self` key=main value=`b` *
*`self` = > json.set map=`self` key=layout value=`layout` *
1. `intro`
*`self` = > json.set map=`self` key=intro value=`intro` *
2. *
*`_` = 1*
**`self`**
## follow
+ `name`
+ `live`
*`slots` = > json.get value=`self` key=slots *
1. `slots`
*`_` = 1*
2. *
*`slots` = > json.parse text={} *
*`slots` = > json.set map=`slots` key=`name` value=`live` *
*`self` = > json.set map=`self` key=slots value=`slots` *
1. `name` == main
*`self` = > json.set map=`self` key=main value=`live` *
2. `name` == 主体
*`self` = > json.set map=`self` key=main value=`live` *
3. *
*`_` = 1*
**`self`**
## resolve_live
+ `value`
*`t` = > type `value` *
1. `t` == map
*`kind` = > json.get value=`value` key=_type *
1. `kind` == live
*`url` = > json.get value=`value` key=url *
*`table` = > json.get value=`value` key=table *
*`limit` = > json.get value=`value` key=limit *
1. `limit`
*`_` = 1*
2. *
*`limit` = 200*
*`r` = > web_db_all url=`url` table=`table` limit=`limit` *
**> json.get value=`r` key=rows**
2. *
**`value`**
2. *
**`value`**
## render
*`title` = > json.get value=`self` key=title *
*`nav` = > json.get value=`self` key=nav *
*`sidebar` = > json.get value=`self` key=sidebar *
*`footer` = > json.get value=`self` key=footer *
*`intro` = > json.get value=`self` key=intro *
*`layout` = > json.get value=`self` key=layout *
*`db_url` = > json.get value=`self` key=db_url *
*`table` = > json.get value=`self` key=table *
*`main` = > json.get value=`self` key=main *
*`main` = > `self`.resolve_live value=`main` *
**> web_render title=`title` nav=`nav` sidebar=`sidebar` footer=`footer` main=`main` intro=`intro` layout=`layout` db_url=`db_url` table=`table`**
---
# db
+ `url`=None
*`u` = `url` *
1. `u`
*`_` = 1*
2. *
*`u` = > sys.env_get name=DATABASE_URL *
1. `u`
*`_` = 1*
2. *
*`u` = sqlite:./data/app.db *
*`self` = > json.parse text={"_type":"db","tables":[]} *
*`self` = > json.set map=`self` key=url value=`u` *
**`self`**
## init
+ `name`
+ `fields`
+ `primary`=id
*`url` = > json.get value=`self` key=url *
*`fs` = > as_fields table=`fields` *
*`_` = > web_db_define url=`url` table=`name` fields=`fs` primary=`primary` *
*`tables` = > json.get value=`self` key=tables *
*`tables` = > json.append list=`tables` item=`name` *
*`self` = > json.set map=`self` key=tables value=`tables` *
*`h` = > json.parse text={"_type":"db_table"} *
*`h` = > json.set map=`h` key=name value=`name` *
*`h` = > json.set map=`h` key=url value=`url` *
**`h`**
## define
+ `table`
+ `fields`
+ `primary`=id
*`tn` = > table_name table=`table` *
**> `self`.init name=`tn` fields=`fields` primary=`primary`**
## migrate
+ `dir`=migrations
*`url` = > json.get value=`self` key=url *
**> web_db_migrate url=`url` dir=`dir`**
## all
+ `table`
+ `limit`=200
*`url` = > json.get value=`self` key=url *
*`tn` = > table_name table=`table` *
*`r` = > web_db_all url=`url` table=`tn` limit=`limit` *
**> json.get value=`r` key=rows**
## follow
+ `table`
+ `limit`=200
*`url` = > json.get value=`self` key=url *
*`tn` = > table_name table=`table` *
*`live` = > json.parse text={"_type":"live","kind":"table"} *
*`live` = > json.set map=`live` key=url value=`url` *
*`live` = > json.set map=`live` key=table value=`tn` *
*`live` = > json.set map=`live` key=limit value=`limit` *
**`live`**
## insert
+ `table`
+ `rows`
*`url` = > json.get value=`self` key=url *
*`tn` = > table_name table=`table` *
*`rs` = > as_rows table=`rows` *
**> web_db_insert url=`url` table=`tn` rows=`rs`**
## query
+ `sql`
+ `args`=None
*`url` = > json.get value=`self` key=url *
**> web_db_query url=`url` sql=`sql` args=`args`**
---
# store
*`ep` = > sys.env_get name=MARQDO_S3_ENDPOINT *
*`self` = > json.parse text={"_type":"store","ok":false} *
1. `ep`
*`self` = > json.set map=`self` key=ok value=True *
*`self` = > json.set map=`self` key=endpoint value=`ep` *
2. *
*`_` = 1*
**`self`**
---
# cache
*`u` = > sys.env_get name=REDIS_URL *
1. `u`
*`_` = 1*
2. *
*`u` = > sys.env_get name=MARQDO_REDIS_URL *
*`self` = > json.parse text={"_type":"cache","ok":false} *
1. `u`
*`self` = > json.set map=`self` key=ok value=True *
*`self` = > json.set map=`self` key=url value=`u` *
2. *
*`_` = 1*
**`self`**
---
# app
+ `page`=None
+ `db`=None
+ `admin`=True
+ `host`=None
+ `port`=None
*`self` = > json.parse text={"_type":"app","static_dir":null,"admin":true} *
*`self` = > json.set map=`self` key=page value=`page` *
*`self` = > json.set map=`self` key=db value=`db` *
*`self` = > json.set map=`self` key=admin value=`admin` *
*`h` = `host` *
1. `h`
*`_` = 1*
2. *
*`h` = > sys.env_get name=MARQDO_WEB_HOST *
1. `h`
*`_` = 1*
2. *
*`h` = 127.0.0.1 *
*`p` = `port` *
1. `p`
*`_` = 1*
2. *
*`p` = > sys.env_get name=MARQDO_WEB_PORT *
1. `p`
*`_` = 1*
2. *
*`p` = 8080 *
*`self` = > json.set map=`self` key=host value=`h` *
*`self` = > json.set map=`self` key=port value=`p` *
**`self`**
## static
+ `dir`
*`self` = > json.set map=`self` key=static_dir value=`dir` *
**`self`**
## listen
+ `duration_ms`=None
*`page` = > json.get value=`self` key=page *
*`db` = > json.get value=`self` key=db *
*`db_url` = None*
*`tables` = > json.parse text=[] *
1. `db`
*`db_url` = > json.get value=`db` key=url *
*`tables` = > json.get value=`db` key=tables *
*`page` = > json.set map=`page` key=db_url value=`db_url` *
2. *
*`_` = 1*
*`host` = > json.get value=`self` key=host *
*`port` = > json.get value=`self` key=port *
*`sd` = > json.get value=`self` key=static_dir *
*`admin` = > json.get value=`self` key=admin *
**> web_listen host=`host` port=`port` page=`page` static_dir=`sd` db_url=`db_url` admin=`admin` admin_tables=`tables` duration_ms=`duration_ms`**
---
## scaffold
+ `dest`
+ `theme`=starter
*`sep` = > json.parse text={"css":"/static/theme.css","env":"/.env.example","mig":"/migrations/001_init.sql","idx":"/index.mq.md"} *
*`css_s` = > json.get value=`sep` key=css *
*`env_s` = > json.get value=`sep` key=env *
*`mig_s` = > json.get value=`sep` key=mig *
*`idx_s` = > json.get value=`sep` key=idx *
*`css_out` = `dest` + `css_s` *
*`env_out` = `dest` + `env_s` *
*`mig_out` = `dest` + `mig_s` *
*`idx_out` = `dest` + `idx_s` *
*`theme_src` = "ext/web/templates/starter/static/theme.css" *
*`css` = > fs.read_text path=`theme_src` *
> fs.write_text path=`css_out` text=`css`
*`env` = "MARQDO_WEB_HOST=127.0.0.1\nMARQDO_WEB_PORT=8080\nDATABASE_URL=sqlite:./data/app.db\n" *
> fs.write_text path=`env_out` text=`env`
*`mig` = "CREATE TABLE IF NOT EXISTS articles (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title TEXT NOT NULL,\n body TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n);\n" *
> fs.write_text path=`mig_out` text=`mig`
*`app` = > json.parse text="---\n> ext/web/web.mq.md\n---\n\n# main\n\n> web.load_env path=.env\n> web.ensure_plugin\n\n`nav` =\n\n| 前端变量 | 后端数据库 | 绑定css样式 |\n|----------|------------|-------------|\n| 首页 | / | |\n| 管理 | /admin | |\n\n`side` =\n\n| 前端变量 | 后端数据库 | 绑定css样式 |\n|----------|------------|-------------|\n| 全部文章 | / | |\n| 管理后台 | /admin | |\n\n`articles` =\n\n| 字段 | 类型 | 可空 |\n|------|------|------|\n| id | integer | false |\n| title | text | false |\n| body | text | true |\n\n`主体` =\n\n| 前端变量 | 后端数据库 | 绑定css样式 |\n|----------|------------|-------------|\n| title | title | card-title |\n| body | body | card-body |\n\n*`db` = > web.db *\n*`articles` = > `db`.init name=articles fields=`articles` *\n\n*`page` = > web.page title=Starter *\n*`page` = > `page`.nav table=`nav` *\n*`page` = > `page`.sidebar table=`side` *\n*`page` = > `page`.main table=`articles` bind=`主体` layout=cards intro=\"<h1>Starter</h1>\" *\n\n*`app` = > web.app page=`page` db=`db` admin=True *\n> `app`.static dir=./static\n> `app`.listen\n" *
> fs.write_text path=`idx_out` text=`app`
**`dest`**
+73
View File
@@ -0,0 +1,73 @@
---
title: ext/web 网页
description: 动态网站 — 变量名即表名;页面方法挂载导航与主体(中文面)。
> ext/web/web.mq.md as en
> lib/sys.mq.md
---
## 加载环境
+ `路径`=None
**> en.load_env path=`路径`**
## 确保插件
**> en.ensure_plugin**
## 脚手架
+ `目标`
+ `主题`=starter
**> en.scaffold dest=`目标` theme=`主题`**
## 链从表
+ `表`
**> en.as_links table=`表`**
## 字段从表
+ `表`
**> en.as_fields table=`表`**
## 绑定从表
+ `表`
**> en.as_bind table=`表`**
## 行从表
+ `表`
**> en.as_rows table=`表`**
# 页面
+ `主题`=starter
+ `标题`=Marqdo Web
+ `引言`="<p>欢迎</p>"
+ `主体样式`=cards
先创建页面,再用方法挂导航 / 侧栏 / 底栏 / 主体。
**> en.page theme=`主题` title=`标题` intro=`引言` layout=`主体样式`**
# 数据库
+ `地址`=None
**> en.db url=`地址`**
# 对象存储
**> en.store**
# 缓存
**> en.cache**
# 应用
+ `页面`=None
+ `数据库`=None
+ `后台`=True
+ `主机`=None
+ `端口`=None
**> en.app page=`页面` db=`数据库` admin=`后台` host=`主机` port=`端口`**