feat(markup): finish v0.3 stock migration and green gold
Migrate remaining .mq.md (tests/ext/public/examples), stop elevating local assigns to params, inject form_target in Go libweb, and skip live LLM gold without a real key. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bfb10d172b
commit
b5c07385e9
324 files changed
+4572
-4339
No files matched your search
@@ -13,7 +13,7 @@ import sys:lib/sys.mq.md
|
||||
|
||||
OKF flywheel offline: promote → plan same goal → `cache=hit` (no live LLM required for the hit path).
|
||||
|
||||
*p = > plugin.native_path name="agent"*
|
||||
**p = > plugin.native_path name="agent"**
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
2. *
|
||||
@@ -21,14 +21,14 @@ OKF flywheel offline: promote → plan same goal → `cache=hit` (no live LLM re
|
||||
> sys.exit code=1
|
||||
|
||||
> sys.env_set name="OPENAI_API_KEY" value="offline-okf-dummy"
|
||||
*model = > llm.llm*
|
||||
*tools = > json.parse text=[]*
|
||||
*助手 = > agent.agent model=`model` tools=`tools` standing="offline okf flywheel"*
|
||||
**model = > llm.llm**
|
||||
**tools = > json.parse text=[]**
|
||||
**助手 = > agent.agent model=`model` tools=`tools` standing="offline okf flywheel"**
|
||||
|
||||
*kb = ".marqdo/agent-kb-example-flywheel"*
|
||||
*wb = ".marqdo/agent-runs/example-pong-solid.mq.md"*
|
||||
*goal = "Reply with exactly the word pong and nothing else."*
|
||||
*body = "---\ntitle: okf pong\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n"*
|
||||
**kb = ".marqdo/agent-kb-example-flywheel"**
|
||||
**wb = ".marqdo/agent-runs/example-pong-solid.mq.md"**
|
||||
**goal = "Reply with exactly the word pong and nothing else."**
|
||||
**body = "---\ntitle: okf pong\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n"**
|
||||
|
||||
1. > fs.exists path=`kb`
|
||||
> fs.remove path=`kb`
|
||||
@@ -37,20 +37,20 @@ OKF flywheel offline: promote → plan same goal → `cache=hit` (no live LLM re
|
||||
|
||||
> fs.write_text path=`wb` text=`body`
|
||||
|
||||
*prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`*
|
||||
*okp = > json.get value=`prom` key="promoted"*
|
||||
**prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`**
|
||||
**okp = > json.get value=`prom` key="promoted"**
|
||||
1. `okp`
|
||||
> print text=promoted
|
||||
2. *
|
||||
> print text=promote-fail
|
||||
> sys.exit code=1
|
||||
|
||||
*out = > `助手`.plan goal=`goal` max_rounds=2 writeback=False kb_dir=`kb` explore_n=0 promote=False*
|
||||
*cache = > json.get value=`out` key="cache"*
|
||||
**out = > `助手`.plan goal=`goal` max_rounds=2 writeback=False kb_dir=`kb` explore_n=0 promote=False**
|
||||
**cache = > json.get value=`out` key="cache"**
|
||||
> print text=`cache`
|
||||
*match = > json.get value=`out` key="match"*
|
||||
**match = > json.get value=`out` key="match"**
|
||||
> print text=`match`
|
||||
*val = > json.get value=`out` key="result"*
|
||||
**val = > json.get value=`out` key="result"**
|
||||
> print text=`val`
|
||||
|
||||
1. `cache` == "hit"
|
||||
|
||||
@@ -15,12 +15,12 @@ import time:lib/time.mq.md
|
||||
|
||||
Return today's date string (tool visible in source to the model).
|
||||
|
||||
*u = > time.now_unix*
|
||||
**> time.format unix=`u` pattern="%Y-%m-%d"**
|
||||
**u = > time.now_unix**
|
||||
*> time.format unix=`u` pattern="%Y-%m-%d"*
|
||||
|
||||
# main
|
||||
|
||||
*p = > plugin.native_path name="agent"*
|
||||
**p = > plugin.native_path name="agent"**
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
2. *
|
||||
@@ -35,53 +35,53 @@ Return today's date string (tool visible in source to the model).
|
||||
|------|
|
||||
| 获取时间 |
|
||||
|
||||
*model = > llm.llm*
|
||||
*助手 = > agent.agent model=`model` tools=`工具表` standing="You are a Marqdo agent. Prefer CALL:获取时间 when the task needs today's date."*
|
||||
**model = > llm.llm**
|
||||
**助手 = > agent.agent model=`model` tools=`工具表` standing="You are a Marqdo agent. Prefer CALL:获取时间 when the task needs today's date."**
|
||||
|
||||
Assert constitution markers in the assembled prompt (call site before how-to-act):
|
||||
|
||||
*ctx = > agent.build_step_context agent=`助手` task="What is today's date? Use the tool in this runbook."*
|
||||
**ctx = > agent.build_step_context agent=`助手` task="What is today's date? Use the tool in this runbook."**
|
||||
|
||||
*parts = > split value=`ctx` sep="--- call site ---"*
|
||||
*n = > len value=`parts`*
|
||||
**parts = > split value=`ctx` sep="--- call site ---"**
|
||||
**n = > len value=`parts`**
|
||||
1. `n` > 1
|
||||
> print text=call-site-ok
|
||||
2. *
|
||||
> print text=call-site-missing
|
||||
> sys.exit code=1
|
||||
|
||||
*parts2 = > split value=`ctx` sep="--- source (.mq.md) ---"*
|
||||
*n2 = > len value=`parts2`*
|
||||
**parts2 = > split value=`ctx` sep="--- source (.mq.md) ---"**
|
||||
**n2 = > len value=`parts2`**
|
||||
1. `n2` > 1
|
||||
> print text=source-ok
|
||||
2. *
|
||||
> print text=source-missing
|
||||
> sys.exit code=1
|
||||
|
||||
*parts3 = > split value=`ctx` sep="获取时间"*
|
||||
*n3 = > len value=`parts3`*
|
||||
**parts3 = > split value=`ctx` sep="获取时间"**
|
||||
**n3 = > len value=`parts3`**
|
||||
1. `n3` > 1
|
||||
> print text=tool-in-source-ok
|
||||
2. *
|
||||
> print text=tool-in-source-missing
|
||||
> sys.exit code=1
|
||||
|
||||
*site = > agent_call_site*
|
||||
*fn = > json.get value=`site` key="function"*
|
||||
**site = > agent_call_site**
|
||||
**fn = > json.get value=`site` key="function"**
|
||||
> print text=`fn`
|
||||
|
||||
Optional live step — set env AGENT_LIVE=1 and put keys in repo-root `.env`:
|
||||
|
||||
*live = > sys.env_get name="AGENT_LIVE"*
|
||||
*key = > sys.env_get name="OPENAI_API_KEY"*
|
||||
**live = > sys.env_get name="AGENT_LIVE"**
|
||||
**key = > sys.env_get name="OPENAI_API_KEY"**
|
||||
1. `live` == "1"
|
||||
1. `key`
|
||||
*out = > `助手`.step task="请调用获取时间工具,然后只回复日期字符串。" writeback=False*
|
||||
*status = > json.get value=`out` key="status"*
|
||||
**out = > `助手`.step task="请调用获取时间工具,然后只回复日期字符串。" writeback=False**
|
||||
**status = > json.get value=`out` key="status"**
|
||||
> print text=`status`
|
||||
*tool = > json.get value=`out` key="tool"*
|
||||
**tool = > json.get value=`out` key="tool"**
|
||||
> print text=`tool`
|
||||
*result = > json.get value=`out` key="result"*
|
||||
**result = > json.get value=`out` key="result"**
|
||||
> print text=`result`
|
||||
2. *
|
||||
> print text=live-skipped-no-key
|
||||
|
||||
@@ -35,7 +35,7 @@ description: 暗恋见君壳层 — head 资源表、导航 HTML、页脚 HTML
|
||||
| script | "/static/js/feed_board.js" | 真 |
|
||||
| script | "/static/js/index.js" | 真 |
|
||||
|
||||
**`头`**
|
||||
*`头`*
|
||||
|
||||
## 导航HTML
|
||||
|
||||
|
||||
@@ -10,55 +10,55 @@ import text:lib/text.mq.md
|
||||
|
||||
给定帖子行记录列表,输出 `ul.home-posts-list` 标记(首页与列表页共用)。
|
||||
|
||||
*段 = None*
|
||||
**段 = None**
|
||||
- [帖](行)
|
||||
*板 = 帖[^board]*
|
||||
*题 = 帖[^title]*
|
||||
*链 = 帖[^slug]*
|
||||
*作 = 帖[^author]*
|
||||
*评 = 帖[^comments_count]*
|
||||
*时 = 帖[^created_at]*
|
||||
**板 = 帖[^board]**
|
||||
**题 = 帖[^title]**
|
||||
**链 = 帖[^slug]**
|
||||
**作 = 帖[^author]**
|
||||
**评 = 帖[^comments_count]**
|
||||
**时 = 帖[^created_at]**
|
||||
1. not 作
|
||||
*作 = "匿名"*
|
||||
**作 = "匿名"**
|
||||
2. *
|
||||
1. not 评
|
||||
*评 = 0*
|
||||
**评 = 0**
|
||||
2. *
|
||||
1. not 时
|
||||
*时 = ""*
|
||||
**时 = ""**
|
||||
2. *
|
||||
*一项 = "<li><article class=\"home-post-card feed-post-card\"><a href=\"/post/" + 链 + "\" class=\"home-post-card-link feed-post-card-link\"><span class=\"home-post-board feed-post-board\">" + 板 + "</span><div class=\"home-post-body feed-post-body\"><h3 class=\"home-post-title feed-post-title\">" + 题 + "</h3><div class=\"home-post-meta feed-post-meta\"><span class=\"home-post-meta-item feed-post-meta-item\"><span class=\"anlian-icon anlian-icon--user\" aria-hidden=\"true\"></span> " + 作 + "</span><span class=\"home-post-meta-item feed-post-meta-item\"><span class=\"anlian-icon anlian-icon--comment\" aria-hidden=\"true\"></span> " + 评 + "</span><time>" + 时 + "</time></div></div><span class=\"home-post-arrow feed-post-arrow\" aria-hidden=\"true\"><span class=\"anlian-icon anlian-icon--chevron-right\"></span></span></a></article></li>"*
|
||||
*段 = > table.append list=段 item=一项*
|
||||
**一项 = "<li><article class=\"home-post-card feed-post-card\"><a href=\"/post/" + 链 + "\" class=\"home-post-card-link feed-post-card-link\"><span class=\"home-post-board feed-post-board\">" + 板 + "</span><div class=\"home-post-body feed-post-body\"><h3 class=\"home-post-title feed-post-title\">" + 题 + "</h3><div class=\"home-post-meta feed-post-meta\"><span class=\"home-post-meta-item feed-post-meta-item\"><span class=\"anlian-icon anlian-icon--user\" aria-hidden=\"true\"></span> " + 作 + "</span><span class=\"home-post-meta-item feed-post-meta-item\"><span class=\"anlian-icon anlian-icon--comment\" aria-hidden=\"true\"></span> " + 评 + "</span><time>" + 时 + "</time></div></div><span class=\"home-post-arrow feed-post-arrow\" aria-hidden=\"true\"><span class=\"anlian-icon anlian-icon--chevron-right\"></span></span></a></article></li>"**
|
||||
**段 = > table.append list=段 item=一项**
|
||||
1. 段
|
||||
*内 = > text.str_join xs=段 sep=""*
|
||||
**"<ul class=\"home-posts-list feed-posts-list\">" + 内 + "</ul>"**
|
||||
**内 = > text.str_join xs=段 sep=""**
|
||||
*"<ul class=\"home-posts-list feed-posts-list\">" + 内 + "</ul>"*
|
||||
2. *
|
||||
**"<ul class=\"home-posts-list feed-posts-list\"><li class=\"home-posts-empty feed-empty\">暂无帖子,<a href=\"/post/public\">去发帖</a></li></ul>"**
|
||||
*"<ul class=\"home-posts-list feed-posts-list\"><li class=\"home-posts-empty feed-empty\">暂无帖子,<a href=\"/post/public\">去发帖</a></li></ul>"*
|
||||
|
||||
## 新闻时间线HTML
|
||||
+ `行`
|
||||
|
||||
给定新闻行记录列表,输出 `.news-timeline` 标记。
|
||||
|
||||
*段 = None*
|
||||
**段 = None**
|
||||
- [讯](行)
|
||||
*题 = 讯[^title]*
|
||||
*链 = 讯[^slug]*
|
||||
*板 = 讯[^board]*
|
||||
*时 = 讯[^created_at]*
|
||||
**题 = 讯[^title]**
|
||||
**链 = 讯[^slug]**
|
||||
**板 = 讯[^board]**
|
||||
**时 = 讯[^created_at]**
|
||||
1. not 板
|
||||
*板 = ""*
|
||||
**板 = ""**
|
||||
2. *
|
||||
1. not 时
|
||||
*时 = ""*
|
||||
**时 = ""**
|
||||
2. *
|
||||
*一项 = "<li class=\"news-timeline-item\"><span class=\"news-timeline-node\" aria-hidden=\"true\"></span><article class=\"news-timeline-card\"><div class=\"news-timeline-meta\"><time class=\"news-timeline-date\">" + 时 + "</time><span class=\"news-timeline-board\">" + 板 + "</span></div><h3 class=\"news-timeline-title\"><a href=\"/news/" + 链 + "\" class=\"news-timeline-link\">" + 题 + "</a></h3></article></li>"*
|
||||
*段 = > table.append list=段 item=一项*
|
||||
**一项 = "<li class=\"news-timeline-item\"><span class=\"news-timeline-node\" aria-hidden=\"true\"></span><article class=\"news-timeline-card\"><div class=\"news-timeline-meta\"><time class=\"news-timeline-date\">" + 时 + "</time><span class=\"news-timeline-board\">" + 板 + "</span></div><h3 class=\"news-timeline-title\"><a href=\"/news/" + 链 + "\" class=\"news-timeline-link\">" + 题 + "</a></h3></article></li>"**
|
||||
**段 = > table.append list=段 item=一项**
|
||||
1. 段
|
||||
*内 = > text.str_join xs=段 sep=""*
|
||||
**"<div class=\"news-timeline\"><div class=\"news-timeline-rail\" aria-hidden=\"true\"><span class=\"news-timeline-line\"></span><span class=\"news-timeline-arrow\" aria-hidden=\"true\"><span class=\"anlian-icon anlian-icon--chevron-right news-timeline-arrow-icon--right\"></span><span class=\"anlian-icon anlian-icon--chevron-down news-timeline-arrow-icon--down\"></span></span></div><ol class=\"news-timeline-items\">" + 内 + "</ol></div>"**
|
||||
**内 = > text.str_join xs=段 sep=""**
|
||||
*"<div class=\"news-timeline\"><div class=\"news-timeline-rail\" aria-hidden=\"true\"><span class=\"news-timeline-line\"></span><span class=\"news-timeline-arrow\" aria-hidden=\"true\"><span class=\"anlian-icon anlian-icon--chevron-right news-timeline-arrow-icon--right\"></span><span class=\"anlian-icon anlian-icon--chevron-down news-timeline-arrow-icon--down\"></span></span></div><ol class=\"news-timeline-items\">" + 内 + "</ol></div>"*
|
||||
2. *
|
||||
**"<div class=\"news-timeline\"><div class=\"news-timeline-rail\" aria-hidden=\"true\"><span class=\"news-timeline-line\"></span><span class=\"news-timeline-arrow\" aria-hidden=\"true\"></span></div><ol class=\"news-timeline-items\"><li class=\"news-timeline-item news-timeline-item-empty\"><article class=\"news-timeline-card\"><p class=\"news-timeline-empty\">暂无新闻</p></article></li></ol></div>"**
|
||||
*"<div class=\"news-timeline\"><div class=\"news-timeline-rail\" aria-hidden=\"true\"><span class=\"news-timeline-line\"></span><span class=\"news-timeline-arrow\" aria-hidden=\"true\"></span></div><ol class=\"news-timeline-items\"><li class=\"news-timeline-item news-timeline-item-empty\"><article class=\"news-timeline-card\"><p class=\"news-timeline-empty\">暂无新闻</p></article></li></ol></div>"*
|
||||
|
||||
## 板块栏HTML
|
||||
+ `板块`
|
||||
@@ -68,30 +68,30 @@ import text:lib/text.mq.md
|
||||
|
||||
板块 Tab 栏。`前缀` 如 `/post/ten/`;`查询键` 为 `board_id` 或 `news_board_id`;`全部类` 为 Tab 共用 class(含 js hook)。
|
||||
|
||||
*数据属 = "data-board"*
|
||||
*全标签 = "全部"*
|
||||
**数据属 = "data-board"**
|
||||
**全标签 = "全部"**
|
||||
1. 查询键 == "news_board_id"
|
||||
*数据属 = "data-news-board"*
|
||||
*全标签 = "所有板块"*
|
||||
**数据属 = "data-news-board"**
|
||||
**全标签 = "所有板块"**
|
||||
2. *
|
||||
|
||||
*段 = None*
|
||||
*全链 = 前缀 + "?" + 查询键 + "=0"*
|
||||
*全项 = "<a href=\"" + 全链 + "\" class=\"" + 全部类 + " active\" " + 数据属 + "=\"0\">" + 全标签 + "</a>"*
|
||||
*段 = > table.append list=段 item=全项*
|
||||
**段 = None**
|
||||
**全链 = 前缀 + "?" + 查询键 + "=0"**
|
||||
**全项 = "<a href=\"" + 全链 + "\" class=\"" + 全部类 + " active\" " + 数据属 + "=\"0\">" + 全标签 + "</a>"**
|
||||
**段 = > table.append list=段 item=全项**
|
||||
- [板](板块)
|
||||
*名 = 板[^name]*
|
||||
*号 = 板[^id]*
|
||||
*链 = 前缀 + "?" + 查询键 + "=" + 号*
|
||||
*项 = "<a href=\"" + 链 + "\" class=\"" + 全部类 + "\" " + 数据属 + "=\"" + 号 + "\">" + 名 + "</a>"*
|
||||
*段 = > table.append list=段 item=项*
|
||||
**名 = 板[^name]**
|
||||
**号 = 板[^id]**
|
||||
**链 = 前缀 + "?" + 查询键 + "=" + 号**
|
||||
**项 = "<a href=\"" + 链 + "\" class=\"" + 全部类 + "\" " + 数据属 + "=\"" + 号 + "\">" + 名 + "</a>"**
|
||||
**段 = > table.append list=段 item=项**
|
||||
1. 查询键 == "news_board_id"
|
||||
*更多 = "<a href=\"/news\" class=\"home-posts-tab home-posts-tab-more\">全部新闻</a>"*
|
||||
*段 = > table.append list=段 item=更多*
|
||||
**更多 = "<a href=\"/news\" class=\"home-posts-tab home-posts-tab-more\">全部新闻</a>"**
|
||||
**段 = > table.append list=段 item=更多**
|
||||
2. *
|
||||
*内 = > text.str_join xs=段 sep=""*
|
||||
*栏类 = "home-posts-board-bar"*
|
||||
**内 = > text.str_join xs=段 sep=""**
|
||||
**栏类 = "home-posts-board-bar"**
|
||||
1. 查询键 == "news_board_id"
|
||||
*栏类 = "home-posts-board-bar home-news-board-bar"*
|
||||
**栏类 = "home-posts-board-bar home-news-board-bar"**
|
||||
2. *
|
||||
**"<div class=\"" + 栏类 + "\" data-feed-board><button type=\"button\" class=\"home-posts-scroll home-posts-scroll-left\" aria-label=\"向左滚动\"><span class=\"anlian-icon anlian-icon--chevron-left\"></span></button><div class=\"home-posts-segment-outer\"><div class=\"home-posts-segment\"><div class=\"home-posts-spotlight\" aria-hidden=\"true\"></div><div class=\"home-posts-tabs-scroll\"><div class=\"home-posts-tabs\" role=\"tablist\">" + 内 + "</div></div></div></div><button type=\"button\" class=\"home-posts-scroll home-posts-scroll-right\" aria-label=\"向右滚动\"><span class=\"anlian-icon anlian-icon--chevron-right\"></span></button></div>"**
|
||||
*"<div class=\"" + 栏类 + "\" data-feed-board><button type=\"button\" class=\"home-posts-scroll home-posts-scroll-left\" aria-label=\"向左滚动\"><span class=\"anlian-icon anlian-icon--chevron-left\"></span></button><div class=\"home-posts-segment-outer\"><div class=\"home-posts-segment\"><div class=\"home-posts-spotlight\" aria-hidden=\"true\"></div><div class=\"home-posts-tabs-scroll\"><div class=\"home-posts-tabs\" role=\"tablist\">" + 内 + "</div></div></div></div><button type=\"button\" class=\"home-posts-scroll home-posts-scroll-right\" aria-label=\"向右滚动\"><span class=\"anlian-icon anlian-icon--chevron-right\"></span></button></div>"*
|
||||
@@ -12,4 +12,4 @@
|
||||
| 公聊 | /chat |
|
||||
| sitemap | /sitemap.xml |
|
||||
|
||||
**`页脚`**
|
||||
*`页脚`*
|
||||
@@ -9,13 +9,13 @@ import feed:feed.mq.md
|
||||
## 帖子十
|
||||
+ `board_id`="0"
|
||||
|
||||
*store = > db.打开*
|
||||
*行 = > store.查询 表="posts" 上限=10 排序="-created_at"*
|
||||
**> feed.帖子列表HTML 行=`行`**
|
||||
**store = > db.打开**
|
||||
**行 = > store.查询 表="posts" 上限=10 排序="-created_at"**
|
||||
*> feed.帖子列表HTML 行=`行`*
|
||||
|
||||
## 新闻五
|
||||
+ `news_board_id`="0"
|
||||
|
||||
*store = > db.打开*
|
||||
*行 = > store.查询 表="news" 上限=5 排序="-created_at"*
|
||||
**> feed.新闻时间线HTML 行=`行`**
|
||||
**store = > db.打开**
|
||||
**行 = > store.查询 表="news" 上限=5 排序="-created_at"**
|
||||
*> feed.新闻时间线HTML 行=`行`*
|
||||
@@ -12,36 +12,36 @@ import feed:feed.mq.md
|
||||
|
||||
查询 notices / boards / news_boards / news(5) / posts(10),拼装首页四段 HTML(不含导航与页脚)。调用方传入已打开的 store。
|
||||
|
||||
*公告行 = > 库.查询 表="notices" 上限=20 排序="-created_at"*
|
||||
*板块行 = > 库.查询 表="boards" 上限=50*
|
||||
*新闻板块行 = > 库.查询 表="news_boards" 上限=50*
|
||||
*新闻行 = > 库.查询 表="news" 上限=5 排序="-created_at"*
|
||||
*帖子行 = > 库.查询 表="posts" 上限=10 排序="-created_at"*
|
||||
**公告行 = > 库.查询 表="notices" 上限=20 排序="-created_at"**
|
||||
**板块行 = > 库.查询 表="boards" 上限=50**
|
||||
**新闻板块行 = > 库.查询 表="news_boards" 上限=50**
|
||||
**新闻行 = > 库.查询 表="news" 上限=5 排序="-created_at"**
|
||||
**帖子行 = > 库.查询 表="posts" 上限=10 排序="-created_at"**
|
||||
|
||||
*公告段 = None*
|
||||
**公告段 = None**
|
||||
- [告](公告行)
|
||||
*文 = 告[^content]*
|
||||
*时 = 告[^created_at]*
|
||||
*一项 = "<div class=\"notice-item\"><article class=\"notice-content\">" + 文 + "</article><p class=\"notice-create-time\">" + 时 + "</p></div>"*
|
||||
*公告段 = > table.append list=公告段 item=一项*
|
||||
**文 = 告[^content]**
|
||||
**时 = 告[^created_at]**
|
||||
**一项 = "<div class=\"notice-item\"><article class=\"notice-content\">" + 文 + "</article><p class=\"notice-create-time\">" + 时 + "</p></div>"**
|
||||
**公告段 = > table.append list=公告段 item=一项**
|
||||
1. 公告段
|
||||
*公告内 = > text.str_join xs=公告段 sep=""*
|
||||
**公告内 = > text.str_join xs=公告段 sep=""**
|
||||
2. *
|
||||
*公告内 = "<p class=\"text-muted\">暂无公告</p>"*
|
||||
**公告内 = "<p class=\"text-muted\">暂无公告</p>"**
|
||||
|
||||
*新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news/five" 查询键="news_board_id" 全部类="home-posts-tab js-home-news-tab"*
|
||||
*新闻板 = > feed.新闻时间线HTML 行=新闻行*
|
||||
*帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post/ten" 查询键="board_id" 全部类="home-posts-tab js-home-post-tab"*
|
||||
*帖子表 = > feed.帖子列表HTML 行=帖子行*
|
||||
**新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news/five" 查询键="news_board_id" 全部类="home-posts-tab js-home-news-tab"**
|
||||
**新闻板 = > feed.新闻时间线HTML 行=新闻行**
|
||||
**帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post/ten" 查询键="board_id" 全部类="home-posts-tab js-home-post-tab"**
|
||||
**帖子表 = > feed.帖子列表HTML 行=帖子行**
|
||||
|
||||
*段 = None*
|
||||
*英雄 = "<section class=\"hero\"><div class=\"section-wrap\"><header><img src=\"/static/img/logo.svg\" alt=\"logo\" width=\"30\" height=\"30\" decoding=\"async\"><a class=\"head-logo\" href=\"/\"><span>暗恋</span>见君</a></header><div class=\"hero-content\"><div class=\"left\"><h1 class=\"main-text\">期待人们能够继续相信<span style=\"color:#ffd0d0\">爱情</span></h1><h2 class=\"sub-text\">粉玻璃社区 · 匿名与实名同在</h2></div><div class=\"right\"><img src=\"/static/img/bg-hero-640.webp\" alt=\"首页展示图\" width=\"640\" height=\"482\" fetchpriority=\"high\" decoding=\"async\"></div></div><div class=\"social\"></div></div></section>"*
|
||||
*段 = > table.append list=段 item=英雄*
|
||||
*公告区 = "<section class=\"notice\"><div class=\"section-wrap\"><h2 class=\"notice-title\">公告信息</h2><div class=\"notice-content-container\"><div class=\"notice-list\">" + 公告内 + "</div></div></div></section>"*
|
||||
*段 = > table.append list=段 item=公告区*
|
||||
*新闻区 = "<section class=\"news home-news\" id=\"news\"><div class=\"section-wrap home-news-stage\"><h2 class=\"news-title\">新闻动态</h2>" + 新闻栏 + "<div class=\"news-timeline-wrap\"><div id=\"homeNewsPanel\" class=\"news-timeline-panel home-panel-swap\">" + 新闻板 + "</div></div></div></section>"*
|
||||
*段 = > table.append list=段 item=新闻区*
|
||||
*更多 = "<a href=\"/post\" class=\"home-posts-more-link\">查看更多帖子</a>"*
|
||||
*帖子区 = "<section class=\"home-posts\" id=\"post\"><div class=\"section-wrap home-posts-stage\"><h2 class=\"home-posts-title\">论坛交流</h2>" + 帖子栏 + "<div id=\"tenPostContainer\" class=\"home-posts-panel home-panel-swap\">" + 帖子表 + 更多 + "</div></div></section>"*
|
||||
*段 = > table.append list=段 item=帖子区*
|
||||
**> text.str_join xs=段 sep=""**
|
||||
**段 = None**
|
||||
**英雄 = "<section class=\"hero\"><div class=\"section-wrap\"><header><img src=\"/static/img/logo.svg\" alt=\"logo\" width=\"30\" height=\"30\" decoding=\"async\"><a class=\"head-logo\" href=\"/\"><span>暗恋</span>见君</a></header><div class=\"hero-content\"><div class=\"left\"><h1 class=\"main-text\">期待人们能够继续相信<span style=\"color:#ffd0d0\">爱情</span></h1><h2 class=\"sub-text\">粉玻璃社区 · 匿名与实名同在</h2></div><div class=\"right\"><img src=\"/static/img/bg-hero-640.webp\" alt=\"首页展示图\" width=\"640\" height=\"482\" fetchpriority=\"high\" decoding=\"async\"></div></div><div class=\"social\"></div></div></section>"**
|
||||
**段 = > table.append list=段 item=英雄**
|
||||
**公告区 = "<section class=\"notice\"><div class=\"section-wrap\"><h2 class=\"notice-title\">公告信息</h2><div class=\"notice-content-container\"><div class=\"notice-list\">" + 公告内 + "</div></div></div></section>"**
|
||||
**段 = > table.append list=段 item=公告区**
|
||||
**新闻区 = "<section class=\"news home-news\" id=\"news\"><div class=\"section-wrap home-news-stage\"><h2 class=\"news-title\">新闻动态</h2>" + 新闻栏 + "<div class=\"news-timeline-wrap\"><div id=\"homeNewsPanel\" class=\"news-timeline-panel home-panel-swap\">" + 新闻板 + "</div></div></div></section>"**
|
||||
**段 = > table.append list=段 item=新闻区**
|
||||
**更多 = "<a href=\"/post\" class=\"home-posts-more-link\">查看更多帖子</a>"**
|
||||
**帖子区 = "<section class=\"home-posts\" id=\"post\"><div class=\"section-wrap home-posts-stage\"><h2 class=\"home-posts-title\">论坛交流</h2>" + 帖子栏 + "<div id=\"tenPostContainer\" class=\"home-posts-panel home-panel-swap\">" + 帖子表 + 更多 + "</div></div></section>"**
|
||||
**段 = > table.append list=段 item=帖子区**
|
||||
*> text.str_join xs=段 sep=""*
|
||||
@@ -15,4 +15,4 @@
|
||||
| 登录 | /admin/login | | | guest |
|
||||
| 后台 | /admin | | | auth |
|
||||
|
||||
**`导航`**
|
||||
*`导航`*
|
||||
@@ -11,8 +11,8 @@ import chrome:chrome.mq.md
|
||||
|
||||
导航 + 正文 + 页脚;体类如 `page-home`。
|
||||
|
||||
*顶 = > chrome.导航HTML*
|
||||
*底 = > chrome.页脚HTML*
|
||||
*鉴权脚本 = "<script>(function(){var c=document.cookie.indexOf('marqdo_sid=')>=0;document.querySelectorAll('.nav-when-guest').forEach(function(el){el.style.display=c?'none':'';});document.querySelectorAll('.nav-when-auth').forEach(function(el){el.style.display=c?'':'none';});})();</script>"*
|
||||
*鉴权样式 = "<style>.nav-when-auth{display:none}</style>"*
|
||||
**鉴权样式 + 顶 + "<main class=\"anlian-main " + 体类 + "\">" + 正文 + "</main>" + 底 + 鉴权脚本**
|
||||
**顶 = > chrome.导航HTML**
|
||||
**底 = > chrome.页脚HTML**
|
||||
**鉴权脚本 = "<script>(function(){var c=document.cookie.indexOf('marqdo_sid=')>=0;document.querySelectorAll('.nav-when-guest').forEach(function(el){el.style.display=c?'none':'';});document.querySelectorAll('.nav-when-auth').forEach(function(el){el.style.display=c?'':'none';});})();</script>"**
|
||||
**鉴权样式 = "<style>.nav-when-auth{display:none}</style>"**
|
||||
*鉴权样式 + 顶 + "<main class=\"anlian-main " + 体类 + "\">" + 正文 + "</main>" + 底 + 鉴权脚本*
|
||||
@@ -10,16 +10,16 @@ import seed:seed.mq.md
|
||||
|
||||
打开 sqlite:data/anlian-mq.db,初始化全部表;帖子建 FTS;若 posts 为空则写入种子。返回 store。
|
||||
|
||||
*store = > 网页.数据库 地址="sqlite:data/anlian-mq.db"*
|
||||
*帖子字段 = > schema.posts*
|
||||
*新闻字段 = > schema.news*
|
||||
*板块字段 = > schema.boards*
|
||||
*新闻板块字段 = > schema.news_boards*
|
||||
*公告字段 = > schema.notices*
|
||||
*评论字段 = > schema.comments*
|
||||
*房间字段 = > schema.chat_rooms*
|
||||
*专题字段 = > schema.topics*
|
||||
*密钥字段 = > schema.api_keys*
|
||||
**store = > 网页.数据库 地址="sqlite:data/anlian-mq.db"**
|
||||
**帖子字段 = > schema.posts**
|
||||
**新闻字段 = > schema.news**
|
||||
**板块字段 = > schema.boards**
|
||||
**新闻板块字段 = > schema.news_boards**
|
||||
**公告字段 = > schema.notices**
|
||||
**评论字段 = > schema.comments**
|
||||
**房间字段 = > schema.chat_rooms**
|
||||
**专题字段 = > schema.topics**
|
||||
**密钥字段 = > schema.api_keys**
|
||||
> `store`.初始化 名=posts 字段=`帖子字段`
|
||||
> `store`.初始化 名=news 字段=`新闻字段`
|
||||
> `store`.初始化 名=boards 字段=`板块字段`
|
||||
@@ -40,18 +40,18 @@ import seed:seed.mq.md
|
||||
|
||||
> `store`.全文 表=posts 列=`全文列` 名=posts_fts
|
||||
|
||||
*已有 = > store.查询 表="posts" 上限=1*
|
||||
**已有 = > store.查询 表="posts" 上限=1**
|
||||
1. `已有`
|
||||
**store**
|
||||
*store*
|
||||
2. *
|
||||
*板块 = > seed.boards*
|
||||
*新闻板块 = > seed.news_boards*
|
||||
*帖子 = > seed.posts*
|
||||
*新闻 = > seed.news*
|
||||
*公告 = > seed.notices*
|
||||
*评论 = > seed.comments*
|
||||
*房间 = > seed.chat_rooms*
|
||||
*专题 = > seed.topics*
|
||||
**板块 = > seed.boards**
|
||||
**新闻板块 = > seed.news_boards**
|
||||
**帖子 = > seed.posts**
|
||||
**新闻 = > seed.news**
|
||||
**公告 = > seed.notices**
|
||||
**评论 = > seed.comments**
|
||||
**房间 = > seed.chat_rooms**
|
||||
**专题 = > seed.topics**
|
||||
> `store`.插入 表=boards 行=`板块`
|
||||
> `store`.插入 表=news_boards 行=`新闻板块`
|
||||
> `store`.插入 表=posts 行=`帖子`
|
||||
@@ -60,4 +60,4 @@ import seed:seed.mq.md
|
||||
> `store`.插入 表=comments 行=`评论`
|
||||
> `store`.插入 表=chat_rooms 行=`房间`
|
||||
> `store`.插入 表=topics 行=`专题`
|
||||
**store**
|
||||
*store*
|
||||
@@ -19,7 +19,7 @@
|
||||
| created_at | timestamp | true | |
|
||||
| updated_at | timestamp | true | |
|
||||
|
||||
**`posts`**
|
||||
*`posts`*
|
||||
|
||||
## news
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
| created_at | timestamp | true | |
|
||||
| updated_at | timestamp | true | |
|
||||
|
||||
**`news`**
|
||||
*`news`*
|
||||
|
||||
## boards
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
| name | text | false | |
|
||||
| slug | text | false | 是 |
|
||||
|
||||
**`boards`**
|
||||
*`boards`*
|
||||
|
||||
## news_boards
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
| name | text | false | |
|
||||
| slug | text | false | 是 |
|
||||
|
||||
**`news_boards`**
|
||||
*`news_boards`*
|
||||
|
||||
## notices
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
| content | text | false |
|
||||
| created_at | timestamp | true |
|
||||
|
||||
**`notices`**
|
||||
*`notices`*
|
||||
|
||||
## comments
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
| author | text | true |
|
||||
| created_at | timestamp | true |
|
||||
|
||||
**`comments`**
|
||||
*`comments`*
|
||||
|
||||
## chat_rooms
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
| name | text | false | |
|
||||
| summary | text | true | |
|
||||
|
||||
**`chat_rooms`**
|
||||
*`chat_rooms`*
|
||||
|
||||
## topics
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
| title | text | false | |
|
||||
| summary | text | true | |
|
||||
|
||||
**`topics`**
|
||||
*`topics`*
|
||||
|
||||
## api_keys
|
||||
|
||||
@@ -143,4 +143,4 @@ API Key 校验用哈希表(应用层 scopes)。
|
||||
| hash | text | false |
|
||||
| scopes | text | true |
|
||||
|
||||
**`api_keys`**
|
||||
*`api_keys`*
|
||||
@@ -10,7 +10,7 @@
|
||||
| 2 | 开发 | develop |
|
||||
| 3 | 聊天 | chat |
|
||||
|
||||
**`boards`**
|
||||
*`boards`*
|
||||
|
||||
## news_boards
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
| 1 | 站务 | site |
|
||||
| 2 | 技术 | tech |
|
||||
|
||||
**`news_boards`**
|
||||
*`news_boards`*
|
||||
|
||||
## posts
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
| 2 | 如何用表格写论坛 | tables-for-forums | 导航、表单、种子数据都是可读表格。 | 若某功能逼你写一长串 json.set,请先审视 ext/web 是否缺命名方法。 | 开发 | 2 | 站务 | 0 | 18 |
|
||||
| 3 | 公聊室已开放 | chat-open | WebSocket 广播房间。 | 打开 /chat,连上 /chat/ws,消息会扇出给同房间所有人。 | 聊天 | 3 | 站务 | 0 | 9 |
|
||||
|
||||
**`posts`**
|
||||
*`posts`*
|
||||
|
||||
## news
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
| 1 | 站点迁往 Marqdo | migrate-to-marqdo | 原生层换 Go libweb,作者面保持表格。 | 暗恋见君的验收目标:登录、发帖、列表详情、聊天与站长工具都能用 .mq.md 写完。 | 站务 | 1 |
|
||||
| 2 | 外接 PostgreSQL / Redis | pg-redis | 生产可用外接驱动。 | 本示例默认 sqlite:;把数据库地址换成 postgres:// 即可。 | 技术 | 2 |
|
||||
|
||||
**`news`**
|
||||
*`news`*
|
||||
|
||||
## notices
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
| 2 | 站点正用 Marqdo 表格重写验收:导航、首页四段、列表与公聊对齐原站 DOM。 | 2026-09-08 14:30:00 |
|
||||
| 3 | 发帖与评论请遵守社区规范;站务公告将在此置顶。 | 2026-09-10 09:00:00 |
|
||||
|
||||
**`notices`**
|
||||
*`notices`*
|
||||
|
||||
## comments
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
| 1 | post | welcome | 终于等到用表格写论坛的一天。 | 路人甲 | 2026-09-10 11:00:00 |
|
||||
| 2 | post | welcome | 期待人们能够继续相信爱情。 | 见君 | 2026-09-10 12:15:00 |
|
||||
|
||||
**`comments`**
|
||||
*`comments`*
|
||||
|
||||
## chat_rooms
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
| 1 | lobby | 大厅 | 全站公共聊天室。 |
|
||||
| 2 | casual | 闲聊 | 轻松闲聊,勿刷屏。 |
|
||||
|
||||
**`chat_rooms`**
|
||||
*`chat_rooms`*
|
||||
|
||||
## topics
|
||||
|
||||
@@ -103,4 +103,4 @@
|
||||
| 1 | glass-ui | 粉玻璃界面 | 首页与列表的毛玻璃视觉专题(占位)。 |
|
||||
| 2 | tables-as-code | 表格即代码 | Marqdo GFM 表装配专题(占位)。 |
|
||||
|
||||
**`topics`**
|
||||
*`topics`*
|
||||
+105
-105
@@ -87,124 +87,124 @@ import db:db/index.mq.md
|
||||
|------|------|------|------|------|
|
||||
| "public/img/favicon-32.png" | icon | "image/png" | 32x32 | "/favicon.ico" |
|
||||
|
||||
*store = > db.打开*
|
||||
*头 = > chrome.头资源*
|
||||
*顶 = > chrome.导航HTML*
|
||||
*底 = > chrome.页脚HTML*
|
||||
*鉴权补丁 = "<style>.nav-when-auth{display:none}</style><script>(function(){var c=document.cookie.indexOf('marqdo_sid=')>=0;document.querySelectorAll('.nav-when-guest').forEach(function(el){el.style.display=c?'none':'';});document.querySelectorAll('.nav-when-auth').forEach(function(el){el.style.display=c?'':'none';});})();</script>"*
|
||||
**store = > db.打开**
|
||||
**头 = > chrome.头资源**
|
||||
**顶 = > chrome.导航HTML**
|
||||
**底 = > chrome.页脚HTML**
|
||||
**鉴权补丁 = "<style>.nav-when-auth{display:none}</style><script>(function(){var c=document.cookie.indexOf('marqdo_sid=')>=0;document.querySelectorAll('.nav-when-guest').forEach(function(el){el.style.display=c?'none':'';});document.querySelectorAll('.nav-when-auth').forEach(function(el){el.style.display=c?'':'none';});})();</script>"**
|
||||
|
||||
*主页体 = > home.装配 库=`store`*
|
||||
*主页文 = > page.包装 正文=`主页体` 体类="page-home"*
|
||||
*首页 = > 网页.页面 标题="暗恋见君论坛" 引言=`主页文` 壳样式="off" 布局="bare"*
|
||||
*首页 = > 首页.头装配 表=`头`*
|
||||
**主页体 = > home.装配 库=`store`**
|
||||
**主页文 = > page.包装 正文=`主页体` 体类="page-home"**
|
||||
**首页 = > 网页.页面 标题="暗恋见君论坛" 引言=`主页文` 壳样式="off" 布局="bare"**
|
||||
**首页 = > 首页.头装配 表=`头`**
|
||||
|
||||
*板块行 = > store.查询 表="boards" 上限=50*
|
||||
*帖子行 = > store.查询 表="posts" 上限=50 排序="-created_at"*
|
||||
*帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post" 查询键="board_id" 全部类="feed-tab"*
|
||||
*帖子表 = > feed.帖子列表HTML 行=帖子行*
|
||||
*帖子列表体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1 class=\"feed-list-title\">论坛交流</h1>" + 帖子栏 + 帖子表 + "<p style=\"margin-top:1rem\"><a href=\"/post/public\">发布帖子</a></p></div></section>"*
|
||||
*帖子列表文 = > page.包装 正文=`帖子列表体` 体类="page-post-list"*
|
||||
*帖子列表 = > 网页.页面 标题="帖子 · 暗恋见君" 引言=`帖子列表文` 壳样式="off" 布局="bare"*
|
||||
*帖子列表 = > 帖子列表.头装配 表=`头`*
|
||||
**板块行 = > store.查询 表="boards" 上限=50**
|
||||
**帖子行 = > store.查询 表="posts" 上限=50 排序="-created_at"**
|
||||
**帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post" 查询键="board_id" 全部类="feed-tab"**
|
||||
**帖子表 = > feed.帖子列表HTML 行=帖子行**
|
||||
**帖子列表体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1 class=\"feed-list-title\">论坛交流</h1>" + 帖子栏 + 帖子表 + "<p style=\"margin-top:1rem\"><a href=\"/post/public\">发布帖子</a></p></div></section>"**
|
||||
**帖子列表文 = > page.包装 正文=`帖子列表体` 体类="page-post-list"**
|
||||
**帖子列表 = > 网页.页面 标题="帖子 · 暗恋见君" 引言=`帖子列表文` 壳样式="off" 布局="bare"**
|
||||
**帖子列表 = > 帖子列表.头装配 表=`头`**
|
||||
|
||||
*新闻板块行 = > store.查询 表="news_boards" 上限=50*
|
||||
*新闻行 = > store.查询 表="news" 上限=50 排序="-created_at"*
|
||||
*新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news" 查询键="news_board_id" 全部类="feed-tab"*
|
||||
*新闻表 = > feed.新闻时间线HTML 行=新闻行*
|
||||
*新闻列表体 = "<section class=\"feed-list-page home-news\"><div class=\"section-wrap\"><h1 class=\"feed-list-title\">新闻动态</h1>" + 新闻栏 + 新闻表 + "</div></section>"*
|
||||
*新闻列表文 = > page.包装 正文=`新闻列表体` 体类="page-news-list"*
|
||||
*新闻列表 = > 网页.页面 标题="新闻 · 暗恋见君" 引言=`新闻列表文` 壳样式="off" 布局="bare"*
|
||||
*新闻列表 = > 新闻列表.头装配 表=`头`*
|
||||
**新闻板块行 = > store.查询 表="news_boards" 上限=50**
|
||||
**新闻行 = > store.查询 表="news" 上限=50 排序="-created_at"**
|
||||
**新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news" 查询键="news_board_id" 全部类="feed-tab"**
|
||||
**新闻表 = > feed.新闻时间线HTML 行=新闻行**
|
||||
**新闻列表体 = "<section class=\"feed-list-page home-news\"><div class=\"section-wrap\"><h1 class=\"feed-list-title\">新闻动态</h1>" + 新闻栏 + 新闻表 + "</div></section>"**
|
||||
**新闻列表文 = > page.包装 正文=`新闻列表体` 体类="page-news-list"**
|
||||
**新闻列表 = > 网页.页面 标题="新闻 · 暗恋见君" 引言=`新闻列表文` 壳样式="off" 布局="bare"**
|
||||
**新闻列表 = > 新闻列表.头装配 表=`头`**
|
||||
|
||||
*帖子页 = > 网页.页面 标题="帖子详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"*
|
||||
*帖子页 = > 帖子页.头装配 表=`头`*
|
||||
*帖子页 = > 帖子页.壳HTML 导航=`顶` 页脚=`底` 体类="page-post-detail"*
|
||||
*帖子页 = > 帖子页.主体装配 主体=`帖子详情`*
|
||||
*帖子页 = > 帖子页.查询条件 条件=`帖子条件`*
|
||||
*帖子页 = > 帖子页.详情 详情=True*
|
||||
**帖子页 = > 网页.页面 标题="帖子详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"**
|
||||
**帖子页 = > 帖子页.头装配 表=`头`**
|
||||
**帖子页 = > 帖子页.壳HTML 导航=`顶` 页脚=`底` 体类="page-post-detail"**
|
||||
**帖子页 = > 帖子页.主体装配 主体=`帖子详情`**
|
||||
**帖子页 = > 帖子页.查询条件 条件=`帖子条件`**
|
||||
**帖子页 = > 帖子页.详情 详情=True**
|
||||
|
||||
*新闻页 = > 网页.页面 标题="新闻详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"*
|
||||
*新闻页 = > 新闻页.头装配 表=`头`*
|
||||
*新闻页 = > 新闻页.壳HTML 导航=`顶` 页脚=`底` 体类="page-news-detail"*
|
||||
*新闻页 = > 新闻页.主体装配 主体=`新闻详情`*
|
||||
*新闻页 = > 新闻页.查询条件 条件=`新闻条件`*
|
||||
*新闻页 = > 新闻页.详情 详情=True*
|
||||
**新闻页 = > 网页.页面 标题="新闻详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"**
|
||||
**新闻页 = > 新闻页.头装配 表=`头`**
|
||||
**新闻页 = > 新闻页.壳HTML 导航=`顶` 页脚=`底` 体类="page-news-detail"**
|
||||
**新闻页 = > 新闻页.主体装配 主体=`新闻详情`**
|
||||
**新闻页 = > 新闻页.查询条件 条件=`新闻条件`**
|
||||
**新闻页 = > 新闻页.详情 详情=True**
|
||||
|
||||
*发帖表 = > 网页.表单 表="posts" 动作="插入"*
|
||||
*发帖表 = > 发帖表.字段 字段=`发帖字段`*
|
||||
*发帖表 = > 发帖表.规则 规则=`发帖规则`*
|
||||
*发帖引言 = > page.包装 正文="<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>发布帖子</h1><p>需登录(admin / anlian)</p></div></section>" 体类="page-post-public"*
|
||||
*发帖页 = > 网页.页面 标题="发帖 · 暗恋见君" 引言=`发帖引言` 壳样式="off" 布局="bare"*
|
||||
*发帖页 = > 发帖页.头装配 表=`头`*
|
||||
*发帖页 = > 发帖页.表单装配 id="post" 表单=`发帖表`*
|
||||
**发帖表 = > 网页.表单 表="posts" 动作="插入"**
|
||||
**发帖表 = > 发帖表.字段 字段=`发帖字段`**
|
||||
**发帖表 = > 发帖表.规则 规则=`发帖规则`**
|
||||
**发帖引言 = > page.包装 正文="<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>发布帖子</h1><p>需登录(admin / anlian)</p></div></section>" 体类="page-post-public"**
|
||||
**发帖页 = > 网页.页面 标题="发帖 · 暗恋见君" 引言=`发帖引言` 壳样式="off" 布局="bare"**
|
||||
**发帖页 = > 发帖页.头装配 表=`头`**
|
||||
**发帖页 = > 发帖页.表单装配 id="post" 表单=`发帖表`**
|
||||
|
||||
*房间行 = > store.查询 表="chat_rooms" 上限=50*
|
||||
*房间段 = None*
|
||||
**房间行 = > store.查询 表="chat_rooms" 上限=50**
|
||||
**房间段 = None**
|
||||
- [房](房间行)
|
||||
*名 = 房[^name]*
|
||||
*链 = 房[^slug]*
|
||||
*摘 = 房[^summary]*
|
||||
*项 = "<article class=\"chat-room-card\"><h3><a href=\"/chat/" + 链 + "\">" + 名 + "</a></h3><p>" + 摘 + "</p></article>"*
|
||||
*房间段 = > table.append list=房间段 item=项*
|
||||
*房间内 = > text.str_join xs=房间段 sep=""*
|
||||
*聊天列表体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>聊天室</h1><div class=\"chat-room-grid\">" + 房间内 + "</div></div></section>"*
|
||||
*聊天列表文 = > page.包装 正文=`聊天列表体` 体类="page-chat"*
|
||||
*聊天列表 = > 网页.页面 标题="聊天 · 暗恋见君" 引言=`聊天列表文` 壳样式="off" 布局="bare"*
|
||||
*聊天列表 = > 聊天列表.头装配 表=`头`*
|
||||
**名 = 房[^name]**
|
||||
**链 = 房[^slug]**
|
||||
**摘 = 房[^summary]**
|
||||
**项 = "<article class=\"chat-room-card\"><h3><a href=\"/chat/" + 链 + "\">" + 名 + "</a></h3><p>" + 摘 + "</p></article>"**
|
||||
**房间段 = > table.append list=房间段 item=项**
|
||||
**房间内 = > text.str_join xs=房间段 sep=""**
|
||||
**聊天列表体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>聊天室</h1><div class=\"chat-room-grid\">" + 房间内 + "</div></div></section>"**
|
||||
**聊天列表文 = > page.包装 正文=`聊天列表体` 体类="page-chat"**
|
||||
**聊天列表 = > 网页.页面 标题="聊天 · 暗恋见君" 引言=`聊天列表文` 壳样式="off" 布局="bare"**
|
||||
**聊天列表 = > 聊天列表.头装配 表=`头`**
|
||||
|
||||
*大厅体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>大厅</h1><div class=\"chat-box\"><div id=\"chat-log\" class=\"chat-log\"></div><p class=\"search-bar\"><input id=\"chat-msg\" placeholder=\"说点什么…\" aria-label=\"消息\"><button id=\"chat-send\" type=\"button\">发送</button></p></div><script src=\"/static/chat.js\"></script></div></section>"*
|
||||
*大厅文 = > page.包装 正文=`大厅体` 体类="page-chat-room"*
|
||||
*大厅页 = > 网页.页面 标题="大厅 · 暗恋见君" 引言=`大厅文` 壳样式="off" 布局="bare"*
|
||||
*大厅页 = > 大厅页.头装配 表=`头`*
|
||||
**大厅体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>大厅</h1><div class=\"chat-box\"><div id=\"chat-log\" class=\"chat-log\"></div><p class=\"search-bar\"><input id=\"chat-msg\" placeholder=\"说点什么…\" aria-label=\"消息\"><button id=\"chat-send\" type=\"button\">发送</button></p></div><script src=\"/static/chat.js\"></script></div></section>"**
|
||||
**大厅文 = > page.包装 正文=`大厅体` 体类="page-chat-room"**
|
||||
**大厅页 = > 网页.页面 标题="大厅 · 暗恋见君" 引言=`大厅文` 壳样式="off" 布局="bare"**
|
||||
**大厅页 = > 大厅页.头装配 表=`头`**
|
||||
|
||||
*闲聊体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>闲聊</h1><div class=\"chat-box\"><div id=\"chat-log\" class=\"chat-log\"></div><p class=\"search-bar\"><input id=\"chat-msg\" placeholder=\"说点什么…\" aria-label=\"消息\"><button id=\"chat-send\" type=\"button\">发送</button></p></div><script src=\"/static/chat.js\"></script></div></section>"*
|
||||
*闲聊文 = > page.包装 正文=`闲聊体` 体类="page-chat-room"*
|
||||
*闲聊页 = > 网页.页面 标题="闲聊 · 暗恋见君" 引言=`闲聊文` 壳样式="off" 布局="bare"*
|
||||
*闲聊页 = > 闲聊页.头装配 表=`头`*
|
||||
**闲聊体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>闲聊</h1><div class=\"chat-box\"><div id=\"chat-log\" class=\"chat-log\"></div><p class=\"search-bar\"><input id=\"chat-msg\" placeholder=\"说点什么…\" aria-label=\"消息\"><button id=\"chat-send\" type=\"button\">发送</button></p></div><script src=\"/static/chat.js\"></script></div></section>"**
|
||||
**闲聊文 = > page.包装 正文=`闲聊体` 体类="page-chat-room"**
|
||||
**闲聊页 = > 网页.页面 标题="闲聊 · 暗恋见君" 引言=`闲聊文` 壳样式="off" 布局="bare"**
|
||||
**闲聊页 = > 闲聊页.头装配 表=`头`**
|
||||
|
||||
*专题行 = > store.查询 表="topics" 上限=50*
|
||||
*专题段 = None*
|
||||
**专题行 = > store.查询 表="topics" 上限=50**
|
||||
**专题段 = None**
|
||||
- [题](专题行)
|
||||
*题名 = 题[^title]*
|
||||
*链 = 题[^slug]*
|
||||
*摘 = 题[^summary]*
|
||||
*项 = "<article class=\"topic-card\"><h3>" + 题名 + "</h3><p>" + 摘 + "</p><p class=\"text-muted\">slug: " + 链 + "</p></article>"*
|
||||
*专题段 = > table.append list=专题段 item=项*
|
||||
*专题内 = > text.str_join xs=专题段 sep=""*
|
||||
*专题体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>专题书架</h1><div class=\"topic-shelf\">" + 专题内 + "</div></div></section>"*
|
||||
*专题文 = > page.包装 正文=`专题体` 体类="page-topics"*
|
||||
*专题页 = > 网页.页面 标题="专题 · 暗恋见君" 引言=`专题文` 壳样式="off" 布局="bare"*
|
||||
*专题页 = > 专题页.头装配 表=`头`*
|
||||
**题名 = 题[^title]**
|
||||
**链 = 题[^slug]**
|
||||
**摘 = 题[^summary]**
|
||||
**项 = "<article class=\"topic-card\"><h3>" + 题名 + "</h3><p>" + 摘 + "</p><p class=\"text-muted\">slug: " + 链 + "</p></article>"**
|
||||
**专题段 = > table.append list=专题段 item=项**
|
||||
**专题内 = > text.str_join xs=专题段 sep=""**
|
||||
**专题体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>专题书架</h1><div class=\"topic-shelf\">" + 专题内 + "</div></div></section>"**
|
||||
**专题文 = > page.包装 正文=`专题体` 体类="page-topics"**
|
||||
**专题页 = > 网页.页面 标题="专题 · 暗恋见君" 引言=`专题文` 壳样式="off" 布局="bare"**
|
||||
**专题页 = > 专题页.头装配 表=`头`**
|
||||
|
||||
*搜索体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>搜索</h1><form class=\"search-bar\" method=\"get\" action=\"/search\"><input name=\"q\" placeholder=\"关键词\" aria-label=\"关键词\"><button type=\"submit\">搜</button></form><p class=\"text-muted\">全文检索走 SQLite FTS(posts_fts);结果面板后续可按 q 扩展。</p></div></section>"*
|
||||
*搜索文 = > page.包装 正文=`搜索体` 体类="page-search"*
|
||||
*搜索页 = > 网页.页面 标题="搜索 · 暗恋见君" 引言=`搜索文` 壳样式="off" 布局="bare"*
|
||||
*搜索页 = > 搜索页.头装配 表=`头`*
|
||||
**搜索体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>搜索</h1><form class=\"search-bar\" method=\"get\" action=\"/search\"><input name=\"q\" placeholder=\"关键词\" aria-label=\"关键词\"><button type=\"submit\">搜</button></form><p class=\"text-muted\">全文检索走 SQLite FTS(posts_fts);结果面板后续可按 q 扩展。</p></div></section>"**
|
||||
**搜索文 = > page.包装 正文=`搜索体` 体类="page-search"**
|
||||
**搜索页 = > 网页.页面 标题="搜索 · 暗恋见君" 引言=`搜索文` 壳样式="off" 布局="bare"**
|
||||
**搜索页 = > 搜索页.头装配 表=`头`**
|
||||
|
||||
*指南体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>API 自动化指南</h1><p>使用 Bearer / X-Api-Key 调用自动化接口。本验收切片提供 <code>api_keys</code> 表与 <code>web_api_key_check</code> 原语;业务 scopes 写在 .mq.md。</p><pre>Authorization: Bearer <token></pre></div></section>"*
|
||||
*指南文 = > page.包装 正文=`指南体` 体类="page-guide"*
|
||||
*指南页 = > 网页.页面 标题="API 指南 · 暗恋见君" 引言=`指南文` 壳样式="off" 布局="bare"*
|
||||
*指南页 = > 指南页.头装配 表=`头`*
|
||||
**指南体 = "<section class=\"feed-list-page\"><div class=\"section-wrap\"><h1>API 自动化指南</h1><p>使用 Bearer / X-Api-Key 调用自动化接口。本验收切片提供 <code>api_keys</code> 表与 <code>web_api_key_check</code> 原语;业务 scopes 写在 .mq.md。</p><pre>Authorization: Bearer <token></pre></div></section>"**
|
||||
**指南文 = > page.包装 正文=`指南体` 体类="page-guide"**
|
||||
**指南页 = > 网页.页面 标题="API 指南 · 暗恋见君" 引言=`指南文` 壳样式="off" 布局="bare"**
|
||||
**指南页 = > 指南页.头装配 表=`头`**
|
||||
|
||||
*应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180*
|
||||
*应用 = > 应用.路由 路径="/post" 页面=`帖子列表`*
|
||||
*应用 = > 应用.路由 路径="/post/public" 页面=`发帖页`*
|
||||
*应用 = > 应用.路由 路径="/post/{slug}" 页面=`帖子页`*
|
||||
*应用 = > 应用.路由 路径="/news" 页面=`新闻列表`*
|
||||
*应用 = > 应用.路由 路径="/news/{slug}" 页面=`新闻页`*
|
||||
*应用 = > 应用.路由 路径="/chat" 页面=`聊天列表`*
|
||||
*应用 = > 应用.路由 路径="/chat/lobby" 页面=`大厅页`*
|
||||
*应用 = > 应用.路由 路径="/chat/casual" 页面=`闲聊页`*
|
||||
*应用 = > 应用.路由 路径="/topics" 页面=`专题页`*
|
||||
*应用 = > 应用.路由 路径="/search" 页面=`搜索页`*
|
||||
*应用 = > 应用.路由 路径="/guide/automation-api" 页面=`指南页`*
|
||||
*应用 = > 应用.静态 目录="public" 挂载="/static"*
|
||||
*应用 = > 应用.图标 表=`图标`*
|
||||
*应用 = > 应用.鉴权 用户表=`用户表` 会话时长=7200 登录路径="/accounts/login" 登录回跳="/post/public" 登出回跳="/"*
|
||||
*应用 = > 应用.门禁 路径="/post/public" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/accounts/login"*
|
||||
*应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"*
|
||||
*应用 = > 应用.调用 路径="/post/ten" 方法="GET" 函数="fragments.帖子十" 正文="query" 返回="html"*
|
||||
*应用 = > 应用.调用 路径="/news/five" 方法="GET" 函数="fragments.新闻五" 正文="query" 返回="html"*
|
||||
*应用 = > 应用.站点地图 路径="/sitemap.xml" 基址="http://127.0.0.1:18180" 条目=`地图项`*
|
||||
*应用 = > 应用.爬虫协议 站点地图="http://127.0.0.1:18180/sitemap.xml"*
|
||||
**应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180**
|
||||
**应用 = > 应用.路由 路径="/post" 页面=`帖子列表`**
|
||||
**应用 = > 应用.路由 路径="/post/public" 页面=`发帖页`**
|
||||
**应用 = > 应用.路由 路径="/post/{slug}" 页面=`帖子页`**
|
||||
**应用 = > 应用.路由 路径="/news" 页面=`新闻列表`**
|
||||
**应用 = > 应用.路由 路径="/news/{slug}" 页面=`新闻页`**
|
||||
**应用 = > 应用.路由 路径="/chat" 页面=`聊天列表`**
|
||||
**应用 = > 应用.路由 路径="/chat/lobby" 页面=`大厅页`**
|
||||
**应用 = > 应用.路由 路径="/chat/casual" 页面=`闲聊页`**
|
||||
**应用 = > 应用.路由 路径="/topics" 页面=`专题页`**
|
||||
**应用 = > 应用.路由 路径="/search" 页面=`搜索页`**
|
||||
**应用 = > 应用.路由 路径="/guide/automation-api" 页面=`指南页`**
|
||||
**应用 = > 应用.静态 目录="public" 挂载="/static"**
|
||||
**应用 = > 应用.图标 表=`图标`**
|
||||
**应用 = > 应用.鉴权 用户表=`用户表` 会话时长=7200 登录路径="/accounts/login" 登录回跳="/post/public" 登出回跳="/"**
|
||||
**应用 = > 应用.门禁 路径="/post/public" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/accounts/login"**
|
||||
**应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"**
|
||||
**应用 = > 应用.调用 路径="/post/ten" 方法="GET" 函数="fragments.帖子十" 正文="query" 返回="html"**
|
||||
**应用 = > 应用.调用 路径="/news/five" 方法="GET" 函数="fragments.新闻五" 正文="query" 返回="html"**
|
||||
**应用 = > 应用.站点地图 路径="/sitemap.xml" 基址="http://127.0.0.1:18180" 条目=`地图项`**
|
||||
**应用 = > 应用.爬虫协议 站点地图="http://127.0.0.1:18180/sitemap.xml"**
|
||||
> `应用`.监听
|
||||
@@ -32,37 +32,37 @@ import sys:lib/sys.mq.md
|
||||
|----|--------|------|------|
|
||||
| 1 | admin | anlian | admin |
|
||||
|
||||
*store = > db.打开*
|
||||
*壳CSS = > shell.全局*
|
||||
*首页 = > 网页.页面 标题="暗恋见君" 引言="<h1>ok</h1>"*
|
||||
*首页 = > 首页.组件装配 组件=`壳`*
|
||||
*首页 = > 首页.主体装配 主体=`帖子卡片`*
|
||||
*首页 = > 首页.样式 样式=`壳CSS`*
|
||||
**store = > db.打开**
|
||||
**壳CSS = > shell.全局**
|
||||
**首页 = > 网页.页面 标题="暗恋见君" 引言="<h1>ok</h1>"**
|
||||
**首页 = > 首页.组件装配 组件=`壳`**
|
||||
**首页 = > 首页.主体装配 主体=`帖子卡片`**
|
||||
**首页 = > 首页.样式 样式=`壳CSS`**
|
||||
|
||||
*应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180*
|
||||
*应用 = > 应用.鉴权 用户表=`用户表`*
|
||||
*应用 = > 应用.门禁 路径="/write" 角色="admin" 匹配="prefix" 拒绝="redirect"*
|
||||
*应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"*
|
||||
**应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180**
|
||||
**应用 = > 应用.鉴权 用户表=`用户表`**
|
||||
**应用 = > 应用.门禁 路径="/write" 角色="admin" 匹配="prefix" 拒绝="redirect"**
|
||||
**应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"**
|
||||
|
||||
*gates = 应用[^gates]*
|
||||
*n = > len value=`gates`*
|
||||
**gates = 应用[^gates]**
|
||||
**n = > len value=`gates`**
|
||||
1. `n` >= 2
|
||||
> print text=gates-ok
|
||||
2. *
|
||||
> print text=gates-fail
|
||||
> sys.exit code=1
|
||||
|
||||
*ws = 应用[^ws_routes]*
|
||||
*room = ws[^/chat/ws]*
|
||||
*mode = room[^mode]*
|
||||
**ws = 应用[^ws_routes]**
|
||||
**room = ws[^/chat/ws]**
|
||||
**mode = room[^mode]**
|
||||
1. `mode` == "broadcast"
|
||||
> print text=ws-ok
|
||||
2. *
|
||||
> print text=ws-fail
|
||||
> sys.exit code=1
|
||||
|
||||
*list = > store.查询 表="posts" 上限=10*
|
||||
*nr = > len value=`list`*
|
||||
**list = > store.查询 表="posts" 上限=10**
|
||||
**nr = > len value=`list`**
|
||||
1. `nr` >= 1
|
||||
> print text=seed-ok
|
||||
2. *
|
||||
|
||||
@@ -54,7 +54,7 @@ import text:lib/text.mq.md
|
||||
| .main-intro | margin | 0 auto |
|
||||
| .main-intro | padding | 1.25rem 1.5rem 0 |
|
||||
|
||||
**`基础`**
|
||||
*`基础`*
|
||||
|
||||
## 动效
|
||||
|
||||
@@ -75,7 +75,7 @@ import text:lib/text.mq.md
|
||||
| @keyframes cardRise 100% | opacity | "1" |
|
||||
| @keyframes cardRise 100% | transform | translateY(0) |
|
||||
|
||||
**`动效`**
|
||||
*`动效`*
|
||||
|
||||
## 顶栏
|
||||
|
||||
@@ -126,7 +126,7 @@ import text:lib/text.mq.md
|
||||
| ul.nav li:first-child a:hover | transform | none |
|
||||
| ul.nav li:first-child a:hover | background | transparent |
|
||||
|
||||
**`顶栏`**
|
||||
*`顶栏`*
|
||||
|
||||
## Hero
|
||||
|
||||
@@ -223,7 +223,7 @@ import text:lib/text.mq.md
|
||||
| .page-stage p | margin | "0" |
|
||||
| .page-stage p | color | var(--muted) |
|
||||
|
||||
**`Hero`**
|
||||
*`Hero`*
|
||||
|
||||
## 卡片
|
||||
|
||||
@@ -336,7 +336,7 @@ import text:lib/text.mq.md
|
||||
| .search-bar button | font-weight | "600" |
|
||||
| .search-bar button | cursor | pointer |
|
||||
|
||||
**`卡片`**
|
||||
*`卡片`*
|
||||
|
||||
## 页脚
|
||||
|
||||
@@ -366,7 +366,7 @@ import text:lib/text.mq.md
|
||||
| ul.foot-nav a | font-weight | "500" |
|
||||
| ul.foot-nav a:hover | color | var(--accent-text) |
|
||||
|
||||
**`页脚`**
|
||||
*`页脚`*
|
||||
|
||||
## 响应式
|
||||
|
||||
@@ -393,25 +393,25 @@ import text:lib/text.mq.md
|
||||
| (prefers-reduced-motion: reduce) | ul.nav li:first-child a::before | animation | none |
|
||||
| (prefers-reduced-motion: reduce) | article.card | animation | none |
|
||||
|
||||
**`响应式`**
|
||||
*`响应式`*
|
||||
|
||||
## 全局
|
||||
|
||||
*基础表 = > 基础*
|
||||
*动效表 = > 动效*
|
||||
*顶栏表 = > 顶栏*
|
||||
*Hero表 = > Hero*
|
||||
*卡片表 = > 卡片*
|
||||
*页脚表 = > 页脚*
|
||||
*响应式表 = > 响应式*
|
||||
**基础表 = > 基础**
|
||||
**动效表 = > 动效**
|
||||
**顶栏表 = > 顶栏**
|
||||
**Hero表 = > Hero**
|
||||
**卡片表 = > 卡片**
|
||||
**页脚表 = > 页脚**
|
||||
**响应式表 = > 响应式**
|
||||
|
||||
*css基础 = > 网页.样式装配 名="基础" 表=`基础表`*
|
||||
*css动效 = > 网页.样式装配 名="动效" 表=`动效表`*
|
||||
*css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`*
|
||||
*cssHero = > 网页.样式装配 名="Hero" 表=`Hero表`*
|
||||
*css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`*
|
||||
*css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`*
|
||||
*css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`*
|
||||
**css基础 = > 网页.样式装配 名="基础" 表=`基础表`**
|
||||
**css动效 = > 网页.样式装配 名="动效" 表=`动效表`**
|
||||
**css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`**
|
||||
**cssHero = > 网页.样式装配 名="Hero" 表=`Hero表`**
|
||||
**css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`**
|
||||
**css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`**
|
||||
**css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`**
|
||||
|
||||
`css段` =
|
||||
|
||||
@@ -425,5 +425,5 @@ import text:lib/text.mq.md
|
||||
| `css页脚` |
|
||||
| `css响应式` |
|
||||
|
||||
*css = > text.str_join xs=`css段` sep=""*
|
||||
**css**
|
||||
**css = > text.str_join xs=`css段` sep=""**
|
||||
*css*
|
||||
@@ -8,10 +8,10 @@ import text:lib/text.mq.md
|
||||
|
||||
# main
|
||||
|
||||
*`ticks` = 0*
|
||||
*`bag` = ""*
|
||||
*`path` = "/"*
|
||||
*`ws_id` = "echo"*
|
||||
**`ticks` = 0**
|
||||
**`bag` = ""**
|
||||
**`path` = "/"**
|
||||
**`ws_id` = "echo"**
|
||||
|
||||
`wire` =
|
||||
|
||||
@@ -52,26 +52,26 @@ import text:lib/text.mq.md
|
||||
|------|----------|---------|
|
||||
| `wire` | `nav` | `st` |
|
||||
|
||||
**boot**
|
||||
*boot*
|
||||
|
||||
## add
|
||||
+ `value`=""
|
||||
|
||||
1. `value` != ""
|
||||
1. `bag` == ""
|
||||
*`bag` = value*
|
||||
**`bag` = value**
|
||||
2. *
|
||||
*`bag` = bag + "\n" + value*
|
||||
*`parts` = > text.str_split s=bag sep="\n"*
|
||||
*`html` = ""*
|
||||
**`bag` = bag + "\n" + value**
|
||||
**`parts` = > text.str_split s=bag sep="\n"**
|
||||
**`html` = ""**
|
||||
- [item](parts)
|
||||
1. `item` != ""
|
||||
*`html` = html + "<li><span>" + item + "</span> <button type=\"button\" data-id=\"" + item + "\">删</button></li>"*
|
||||
*`ret` = > browser.set_html sel="#items" html=html*
|
||||
*`clr` = > browser.set_value sel="#draft" value=""*
|
||||
*`ret` = > browser.merge a=ret b=clr*
|
||||
*`f` = > browser.focus sel="#draft"*
|
||||
**> browser.merge a=ret b=f**
|
||||
**`html` = html + "<li><span>" + item + "</span> <button type=\"button\" data-id=\"" + item + "\">删</button></li>"**
|
||||
**`ret` = > browser.set_html sel="#items" html=html**
|
||||
**`clr` = > browser.set_value sel="#draft" value=""**
|
||||
**`ret` = > browser.merge a=ret b=clr**
|
||||
**`f` = > browser.focus sel="#draft"**
|
||||
*> browser.merge a=ret b=f*
|
||||
2. *
|
||||
****
|
||||
|
||||
@@ -79,25 +79,25 @@ import text:lib/text.mq.md
|
||||
+ `data_id`=""
|
||||
|
||||
1. `data_id` != ""
|
||||
*`parts` = > text.str_split s=bag sep="\n"*
|
||||
*`next` = ""*
|
||||
**`parts` = > text.str_split s=bag sep="\n"**
|
||||
**`next` = ""**
|
||||
- [item](parts)
|
||||
1. `item` != ""
|
||||
1. `item` != `data_id`
|
||||
1. `next` == ""
|
||||
*`next` = item*
|
||||
**`next` = item**
|
||||
2. *
|
||||
*`next` = next + "\n" + item*
|
||||
*`bag` = next*
|
||||
*`parts2` = > text.str_split s=bag sep="\n"*
|
||||
*`html` = ""*
|
||||
**`next` = next + "\n" + item**
|
||||
**`bag` = next**
|
||||
**`parts2` = > text.str_split s=bag sep="\n"**
|
||||
**`html` = ""**
|
||||
- [item](parts2)
|
||||
1. `item` != ""
|
||||
*`html` = html + "<li><span>" + item + "</span> <button type=\"button\" data-id=\"" + item + "\">删</button></li>"*
|
||||
*`ret` = > browser.set_html sel="#items" html=html*
|
||||
*`msg` = "removed " + data_id*
|
||||
*`t` = > browser.set_text sel="#log" text=msg*
|
||||
**> browser.merge a=ret b=t**
|
||||
**`html` = html + "<li><span>" + item + "</span> <button type=\"button\" data-id=\"" + item + "\">删</button></li>"**
|
||||
**`ret` = > browser.set_html sel="#items" html=html**
|
||||
**`msg` = "removed " + data_id**
|
||||
**`t` = > browser.set_text sel="#log" text=msg**
|
||||
*> browser.merge a=ret b=t*
|
||||
2. *
|
||||
****
|
||||
|
||||
@@ -110,9 +110,9 @@ import text:lib/text.mq.md
|
||||
|----|-----|-------|
|
||||
| set | mq-draft | `value` |
|
||||
|
||||
*`msg` = > browser.set_text sel="#log" text="draft saved"*
|
||||
*`s` = > browser.storage spec=st*
|
||||
**> browser.merge a=msg b=s**
|
||||
**`msg` = > browser.set_text sel="#log" text="draft saved"**
|
||||
**`s` = > browser.storage spec=st**
|
||||
*> browser.merge a=msg b=s*
|
||||
|
||||
## load_draft
|
||||
|
||||
@@ -122,7 +122,7 @@ import text:lib/text.mq.md
|
||||
|----|-----|------|
|
||||
| get | mq-draft | on_draft |
|
||||
|
||||
**> browser.storage spec=st**
|
||||
*> browser.storage spec=st*
|
||||
|
||||
## on_draft
|
||||
+ `ok`=True
|
||||
@@ -130,47 +130,47 @@ import text:lib/text.mq.md
|
||||
+ `found`=False
|
||||
|
||||
1. `found`
|
||||
*`ret` = > browser.set_value sel="#draft" value=value*
|
||||
*`msg` = > browser.set_text sel="#log" text="draft loaded"*
|
||||
**> browser.merge a=ret b=msg**
|
||||
**`ret` = > browser.set_value sel="#draft" value=value**
|
||||
**`msg` = > browser.set_text sel="#log" text="draft loaded"**
|
||||
*> browser.merge a=ret b=msg*
|
||||
2. *
|
||||
**> browser.set_text sel="#log" text="no draft"**
|
||||
*> browser.set_text sel="#log" text="no draft"*
|
||||
|
||||
## start_tick
|
||||
**> browser.interval ms=1000 then="on_tick" id="tick"**
|
||||
*> browser.interval ms=1000 then="on_tick" id="tick"*
|
||||
|
||||
## stop_tick
|
||||
**> browser.clear_interval id="tick"**
|
||||
*> browser.clear_interval id="tick"*
|
||||
|
||||
## on_tick
|
||||
+ `ok`=True
|
||||
+ `id`=""
|
||||
|
||||
*`ticks` = ticks + 1*
|
||||
*`label` = > str ticks*
|
||||
**> browser.set_text sel="#tick" text=label**
|
||||
**`ticks` = ticks + 1**
|
||||
**`label` = > str ticks**
|
||||
*> browser.set_text sel="#tick" text=label*
|
||||
|
||||
## go_home
|
||||
*`path` = "/"*
|
||||
**> show_path**
|
||||
**`path` = "/"**
|
||||
*> show_path*
|
||||
|
||||
## go_about
|
||||
*`path` = "/about"*
|
||||
**> show_path**
|
||||
**`path` = "/about"**
|
||||
*> show_path*
|
||||
|
||||
## go_net
|
||||
*`path` = "/net"*
|
||||
**> show_path**
|
||||
**`path` = "/net"**
|
||||
*> show_path*
|
||||
|
||||
## on_pop
|
||||
+ `path`=""
|
||||
|
||||
*`path` = path*
|
||||
**> show_path**
|
||||
**`path` = path**
|
||||
*> show_path*
|
||||
|
||||
## show_path
|
||||
*`hide` = > table.put in=None at="hidden" value=""*
|
||||
*`show` = > table.put in=None at="hidden" value=False*
|
||||
**`hide` = > table.put in=None at="hidden" value=""**
|
||||
**`show` = > table.put in=None at="hidden" value=False**
|
||||
1. `path` == "/about"
|
||||
`attrs` =
|
||||
|
||||
@@ -190,12 +190,12 @@ import text:lib/text.mq.md
|
||||
| #panel-home | #panel-about | #panel-net |
|
||||
|-------------|--------------|------------|
|
||||
| `show` | `hide` | `hide` |
|
||||
*`label` = "path: " + path*
|
||||
*`ret` = > browser.set_text sel="#path" text=label*
|
||||
*`a` = > browser.wrap key="set_attr" value=attrs*
|
||||
*`ret` = > browser.merge a=ret b=a*
|
||||
*`nav` = > browser.navigate url=path*
|
||||
**> browser.merge a=ret b=nav**
|
||||
**`label` = "path: " + path**
|
||||
**`ret` = > browser.set_text sel="#path" text=label**
|
||||
**`a` = > browser.wrap key="set_attr" value=attrs**
|
||||
**`ret` = > browser.merge a=ret b=a**
|
||||
**`nav` = > browser.navigate url=path**
|
||||
*> browser.merge a=ret b=nav*
|
||||
|
||||
## do_fetch_all
|
||||
|
||||
@@ -206,15 +206,15 @@ import text:lib/text.mq.md
|
||||
| 1 | "https://httpbin.org/uuid" |
|
||||
| 2 | "https://httpbin.org/uuid" |
|
||||
|
||||
*`msg` = > browser.set_text sel="#net-out" text="fetch_all…"*
|
||||
*`fa` = > browser.fetch_all requests=reqs then="on_fetch_all"*
|
||||
**> browser.merge a=msg b=fa**
|
||||
**`msg` = > browser.set_text sel="#net-out" text="fetch_all…"**
|
||||
**`fa` = > browser.fetch_all requests=reqs then="on_fetch_all"**
|
||||
*> browser.merge a=msg b=fa*
|
||||
|
||||
## on_fetch_all
|
||||
+ `ok`=True
|
||||
+ `results`=None
|
||||
|
||||
**> browser.set_text sel="#net-out" text="fetch_all done (see console / results in session)"**
|
||||
*> browser.set_text sel="#net-out" text="fetch_all done (see console / results in session)"*
|
||||
|
||||
## ws_open
|
||||
|
||||
@@ -224,32 +224,32 @@ import text:lib/text.mq.md
|
||||
|----|----|-----|-----------|--------------|------------|------------|
|
||||
| open | `ws_id` | "wss://echo.websocket.events" | on_ws_open | on_ws_msg | on_ws_err | on_ws_close |
|
||||
|
||||
**> browser.ws spec=w**
|
||||
*> browser.ws spec=w*
|
||||
|
||||
## on_ws_open
|
||||
+ `ok`=True
|
||||
+ `id`=""
|
||||
|
||||
**> browser.set_text sel="#net-out" text="ws open"**
|
||||
*> browser.set_text sel="#net-out" text="ws open"*
|
||||
|
||||
## on_ws_msg
|
||||
+ `ok`=True
|
||||
+ `data`=""
|
||||
|
||||
*`msg` = "ws ← " + data*
|
||||
**> browser.set_text sel="#net-out" text=msg**
|
||||
**`msg` = "ws ← " + data**
|
||||
*> browser.set_text sel="#net-out" text=msg*
|
||||
|
||||
## on_ws_err
|
||||
+ `ok`=False
|
||||
+ `error`=""
|
||||
|
||||
*`msg` = "ws error: " + error*
|
||||
**> browser.set_text sel="#net-out" text=msg**
|
||||
**`msg` = "ws error: " + error**
|
||||
*> browser.set_text sel="#net-out" text=msg*
|
||||
|
||||
## on_ws_close
|
||||
+ `ok`=True
|
||||
|
||||
**> browser.set_text sel="#net-out" text="ws closed"**
|
||||
*> browser.set_text sel="#net-out" text="ws closed"*
|
||||
|
||||
## ws_send
|
||||
+ `value`=""
|
||||
@@ -260,7 +260,7 @@ import text:lib/text.mq.md
|
||||
|----|----|------|
|
||||
| send | `ws_id` | `value` |
|
||||
|
||||
**> browser.ws spec=w**
|
||||
*> browser.ws spec=w*
|
||||
|
||||
## ws_close
|
||||
|
||||
@@ -270,14 +270,14 @@ import text:lib/text.mq.md
|
||||
|----|----|
|
||||
| close | `ws_id` |
|
||||
|
||||
**> browser.ws spec=w**
|
||||
*> browser.ws spec=w*
|
||||
|
||||
## copy_log
|
||||
*`msg` = > browser.set_text sel="#log" text="copied bag to clipboard"*
|
||||
*`c` = > browser.clipboard text=bag*
|
||||
**> browser.merge a=msg b=c**
|
||||
**`msg` = > browser.set_text sel="#log" text="copied bag to clipboard"**
|
||||
**`c` = > browser.clipboard text=bag**
|
||||
*> browser.merge a=msg b=c*
|
||||
|
||||
## dl_list
|
||||
*`msg` = > browser.set_text sel="#log" text="download started"*
|
||||
*`d` = > browser.download body=bag filename="items.txt"*
|
||||
**> browser.merge a=msg b=d**
|
||||
**`msg` = > browser.set_text sel="#log" text="download started"**
|
||||
**`d` = > browser.download body=bag filename="items.txt"**
|
||||
*> browser.merge a=msg b=d*
|
||||
@@ -6,7 +6,7 @@ import browser:lib/browser.mq.md
|
||||
|
||||
# main
|
||||
|
||||
*`count` = 0*
|
||||
**`count` = 0**
|
||||
|
||||
`wire` =
|
||||
|
||||
@@ -15,13 +15,13 @@ import browser:lib/browser.mq.md
|
||||
| 1 | "#bump" | click | bump |
|
||||
| 2 | "#reset" | click | reset |
|
||||
|
||||
**`wire`**
|
||||
*`wire`*
|
||||
|
||||
## bump
|
||||
*`count` = count + 1*
|
||||
*`label` = > str count*
|
||||
**> browser.set_text sel="#count" text=label**
|
||||
**`count` = count + 1**
|
||||
**`label` = > str count**
|
||||
*> browser.set_text sel="#count" text=label*
|
||||
|
||||
## reset
|
||||
*`count` = 0*
|
||||
**> browser.set_text sel="#count" text="0"**
|
||||
**`count` = 0**
|
||||
*> browser.set_text sel="#count" text="0"*
|
||||
@@ -13,12 +13,12 @@ import browser:lib/browser.mq.md
|
||||
| 1 | "#load" | click | load |
|
||||
| 2 | "#ping" | click | ping |
|
||||
|
||||
**`wire`**
|
||||
*`wire`*
|
||||
|
||||
## load
|
||||
*`msg` = > browser.set_text sel="#status" text="loading…"*
|
||||
*`req` = > browser.fetch url="https://httpbin.org/uuid" then="on_uuid"*
|
||||
**> browser.merge a=msg b=req**
|
||||
**`msg` = > browser.set_text sel="#status" text="loading…"**
|
||||
**`req` = > browser.fetch url="https://httpbin.org/uuid" then="on_uuid"**
|
||||
*> browser.merge a=msg b=req*
|
||||
|
||||
## on_uuid
|
||||
+ `ok`
|
||||
@@ -27,16 +27,16 @@ import browser:lib/browser.mq.md
|
||||
+ `error`=""
|
||||
|
||||
1. ok
|
||||
**> browser.set_text sel="#status" text=body**
|
||||
*> browser.set_text sel="#status" text=body*
|
||||
2. *
|
||||
**> browser.set_text sel="#status" text="fetch failed"**
|
||||
*> browser.set_text sel="#status" text="fetch failed"*
|
||||
|
||||
## ping
|
||||
*`msg` = > browser.set_text sel="#status" text="wait 600ms…"*
|
||||
*`t` = > browser.after ms=600 then="on_ping"*
|
||||
**> browser.merge a=msg b=t**
|
||||
**`msg` = > browser.set_text sel="#status" text="wait 600ms…"**
|
||||
**`t` = > browser.after ms=600 then="on_ping"**
|
||||
*> browser.merge a=msg b=t*
|
||||
|
||||
## on_ping
|
||||
+ `ok`=True
|
||||
|
||||
**> browser.set_text sel="#status" text="pong"**
|
||||
*> browser.set_text sel="#status" text="pong"*
|
||||
@@ -13,21 +13,21 @@ import table:lib/table.mq.md
|
||||
|---|--------|------|------|
|
||||
| 1 | "#name" | input | on_input |
|
||||
|
||||
**`wire`**
|
||||
*`wire`*
|
||||
|
||||
## on_input
|
||||
+ `value`=""
|
||||
+ `event`=""
|
||||
|
||||
1. `value` != ""
|
||||
*`label` = "你好," + value*
|
||||
*`ret` = > browser.set_text sel="#echo" text=label*
|
||||
*`cls` = > browser.set_class sel="#echo" class="hi"*
|
||||
*`ret` = > browser.merge a=ret b=cls*
|
||||
*`attrs` = > table.put in=None at="data-name" value=value*
|
||||
*`attr` = > browser.set_attr sel="#echo" attrs=attrs*
|
||||
**> browser.merge a=ret b=attr**
|
||||
**`label` = "你好," + value**
|
||||
**`ret` = > browser.set_text sel="#echo" text=label**
|
||||
**`cls` = > browser.set_class sel="#echo" class="hi"**
|
||||
**`ret` = > browser.merge a=ret b=cls**
|
||||
**`attrs` = > table.put in=None at="data-name" value=value**
|
||||
**`attr` = > browser.set_attr sel="#echo" attrs=attrs**
|
||||
*> browser.merge a=ret b=attr*
|
||||
2. *
|
||||
*`ret` = > browser.set_text sel="#echo" text="(等待输入)"*
|
||||
*`cls` = > browser.set_class sel="#echo" class=""*
|
||||
**> browser.merge a=ret b=cls**
|
||||
**`ret` = > browser.set_text sel="#echo" text="(等待输入)"**
|
||||
**`cls` = > browser.set_class sel="#echo" class=""**
|
||||
*> browser.merge a=ret b=cls*
|
||||
@@ -9,7 +9,7 @@ import table:lib/table.mq.md
|
||||
|
||||
Route F demo: author data stays in tables; effects via `browser.*`.
|
||||
|
||||
*`obs_on` = False*
|
||||
**`obs_on` = False**
|
||||
|
||||
`wire` =
|
||||
|
||||
@@ -25,15 +25,15 @@ Route F demo: author data stays in tables; effects via `browser.*`.
|
||||
| 8 | "#dropzone" | dragover | on_dragover | |
|
||||
| 9 | "#dropzone" | drop | on_drop | |
|
||||
|
||||
*`ready` = > browser.set_text sel="#log" text="ready (route F)"*
|
||||
*`boot` = > table.put in=None at="wire" value=wire*
|
||||
**> browser.merge a=boot b=ready**
|
||||
**`ready` = > browser.set_text sel="#log" text="ready (route F)"**
|
||||
**`boot` = > table.put in=None at="wire" value=wire**
|
||||
*> browser.merge a=boot b=ready*
|
||||
|
||||
## read_text
|
||||
**> browser.read_file sel="#file" then="on_file" as="text"**
|
||||
*> browser.read_file sel="#file" then="on_file" as="text"*
|
||||
|
||||
## read_dataurl
|
||||
**> browser.read_file sel="#file" then="on_file" as="data_url"**
|
||||
*> browser.read_file sel="#file" then="on_file" as="data_url"*
|
||||
|
||||
## on_file
|
||||
+ `ok`=False
|
||||
@@ -46,25 +46,25 @@ Route F demo: author data stays in tables; effects via `browser.*`.
|
||||
|
||||
1. `ok`
|
||||
1. `as` == "data_url"
|
||||
*`n` = > len value=data_url*
|
||||
*`ns` = > str `n`*
|
||||
*`preview` = name + " data_url chars=" + ns*
|
||||
*`ret` = > browser.set_text sel="#log" text=preview*
|
||||
**`n` = > len value=data_url**
|
||||
**`ns` = > str `n`**
|
||||
**`preview` = name + " data_url chars=" + ns**
|
||||
**`ret` = > browser.set_text sel="#log" text=preview**
|
||||
1. `data_url` != ""
|
||||
*`h` = "<img alt=\"preview\" src=\"" + data_url + "\" style=\"max-width:12rem;max-height:8rem\" />"*
|
||||
*`img` = > browser.set_html sel="#preview" html=h*
|
||||
**> browser.merge a=ret b=img**
|
||||
**`h` = "<img alt=\"preview\" src=\"" + data_url + "\" style=\"max-width:12rem;max-height:8rem\" />"**
|
||||
**`img` = > browser.set_html sel="#preview" html=h**
|
||||
*> browser.merge a=ret b=img*
|
||||
2. *
|
||||
**ret**
|
||||
*ret*
|
||||
2. *
|
||||
*`n` = > len value=body*
|
||||
*`ns` = > str `n`*
|
||||
*`ss` = > str `size`*
|
||||
*`preview` = name + " (" + ss + " B, chars=" + ns + ") ok"*
|
||||
**> browser.set_text sel="#log" text=preview**
|
||||
**`n` = > len value=body**
|
||||
**`ns` = > str `n`**
|
||||
**`ss` = > str `size`**
|
||||
**`preview` = name + " (" + ss + " B, chars=" + ns + ") ok"**
|
||||
*> browser.set_text sel="#log" text=preview*
|
||||
2. *
|
||||
*`preview` = "file error: " + error*
|
||||
**> browser.set_text sel="#log" text=preview**
|
||||
**`preview` = "file error: " + error**
|
||||
*> browser.set_text sel="#log" text=preview*
|
||||
|
||||
## draw_box
|
||||
|
||||
@@ -78,17 +78,17 @@ Canvas commands as a readable `@` table:
|
||||
| 2 | strokerect | 20 | 20 | 100 | 60 | | "#122018" | |
|
||||
| 3 | filltext | 40 | 55 | | | "#f5faf6" | | Marqdo |
|
||||
|
||||
*`cv` = > browser.canvas sel="#pad" commands=commands clear=True*
|
||||
*`msg` = > browser.set_text sel="#log" text="canvas drawn"*
|
||||
**> browser.merge a=cv b=msg**
|
||||
**`cv` = > browser.canvas sel="#pad" commands=commands clear=True**
|
||||
**`msg` = > browser.set_text sel="#log" text="canvas drawn"**
|
||||
*> browser.merge a=cv b=msg*
|
||||
|
||||
## play_tone
|
||||
*`tone` = > browser.audio op="play" id="demo" src="beep" freq=523 ms=220*
|
||||
*`msg` = > browser.set_text sel="#log" text="audio beep"*
|
||||
**> browser.merge a=tone b=msg**
|
||||
**`tone` = > browser.audio op="play" id="demo" src="beep" freq=523 ms=220**
|
||||
**`msg` = > browser.set_text sel="#log" text="audio beep"**
|
||||
*> browser.merge a=tone b=msg*
|
||||
|
||||
## start_watch
|
||||
*`obs_on` = True*
|
||||
**`obs_on` = True**
|
||||
|
||||
`obs` =
|
||||
|
||||
@@ -97,12 +97,12 @@ Canvas commands as a readable `@` table:
|
||||
| 1 | intersect | "#beacon" | beacon | on_intersect | 0.25 |
|
||||
| 2 | resize | "#pad" | pad | on_resize | |
|
||||
|
||||
*`o` = > browser.observe specs=obs*
|
||||
*`msg` = > browser.set_text sel="#log" text="observers on"*
|
||||
**> browser.merge a=o b=msg**
|
||||
**`o` = > browser.observe specs=obs**
|
||||
**`msg` = > browser.set_text sel="#log" text="observers on"**
|
||||
*> browser.merge a=o b=msg*
|
||||
|
||||
## stop_watch
|
||||
*`obs_on` = False*
|
||||
**`obs_on` = False**
|
||||
|
||||
`ids` =
|
||||
|
||||
@@ -111,23 +111,23 @@ Canvas commands as a readable `@` table:
|
||||
| 1 | beacon |
|
||||
| 2 | pad |
|
||||
|
||||
*`u` = > browser.unobserve specs=ids*
|
||||
*`msg` = > browser.set_text sel="#log" text="observers off"*
|
||||
**> browser.merge a=u b=msg**
|
||||
**`u` = > browser.unobserve specs=ids**
|
||||
**`msg` = > browser.set_text sel="#log" text="observers off"**
|
||||
*> browser.merge a=u b=msg*
|
||||
|
||||
## on_intersect
|
||||
+ `intersecting`=False
|
||||
+ `ratio`=0
|
||||
|
||||
1. `obs_on`
|
||||
*`state` = "hidden"*
|
||||
**`state` = "hidden"**
|
||||
1. `intersecting`
|
||||
*`state` = "visible"*
|
||||
**`state` = "visible"**
|
||||
2. *
|
||||
---
|
||||
*`r` = > str `ratio`*
|
||||
*`msg` = "beacon " + state + " ratio=" + r*
|
||||
**> browser.set_text sel="#obs" text=msg**
|
||||
**`r` = > str `ratio`**
|
||||
**`msg` = "beacon " + state + " ratio=" + r**
|
||||
*> browser.set_text sel="#obs" text=msg*
|
||||
2. *
|
||||
****
|
||||
|
||||
@@ -136,18 +136,18 @@ Canvas commands as a readable `@` table:
|
||||
+ `height`=0
|
||||
|
||||
1. `obs_on`
|
||||
*`w` = > str `width`*
|
||||
*`h` = > str `height`*
|
||||
*`msg` = "pad size " + w + "×" + h*
|
||||
**> browser.set_text sel="#obs" text=msg**
|
||||
**`w` = > str `width`**
|
||||
**`h` = > str `height`**
|
||||
**`msg` = "pad size " + w + "×" + h**
|
||||
*> browser.set_text sel="#obs" text=msg*
|
||||
2. *
|
||||
****
|
||||
|
||||
## on_drag
|
||||
+ `drag`=""
|
||||
|
||||
*`msg` = "dragging: " + drag*
|
||||
**> browser.set_text sel="#log" text=msg**
|
||||
**`msg` = "dragging: " + drag**
|
||||
*> browser.set_text sel="#log" text=msg*
|
||||
|
||||
## on_dragover
|
||||
****
|
||||
@@ -155,8 +155,8 @@ Canvas commands as a readable `@` table:
|
||||
## on_drop
|
||||
+ `drop_text`=""
|
||||
|
||||
*`msg` = "dropped: " + drop_text*
|
||||
*`h` = "<strong>" + drop_text + "</strong>"*
|
||||
*`t` = > browser.set_text sel="#log" text=msg*
|
||||
*`box` = > browser.set_html sel="#dropzone" html=h*
|
||||
**> browser.merge a=t b=box**
|
||||
**`msg` = "dropped: " + drop_text**
|
||||
**`h` = "<strong>" + drop_text + "</strong>"**
|
||||
**`t` = > browser.set_text sel="#log" text=msg**
|
||||
**`box` = > browser.set_html sel="#dropzone" html=h**
|
||||
*> browser.merge a=t b=box*
|
||||
@@ -21,14 +21,14 @@ $$
|
||||
\begin{pmatrix}1\\2\\2\end{pmatrix}
|
||||
$$
|
||||
|
||||
*`A` = > la.from_formula formula=`A`*
|
||||
*`b` = > la.from_formula formula=`b`*
|
||||
**`A` = > la.from_formula formula=`A`**
|
||||
**`b` = > la.from_formula formula=`b`**
|
||||
|
||||
*`_` = > la.draw factor=`A` kind="heatmap" theme="light" path="ls-heatmap.svg"*
|
||||
**`_` = > la.draw factor=`A` kind="heatmap" theme="light" path="ls-heatmap.svg"**
|
||||
|
||||
*`ls` = > la.lstsq a=`A` b=`b`*
|
||||
*`x` = ls[^x]*
|
||||
*`resid` = ls[^residual_fro]*
|
||||
**`ls` = > la.lstsq a=`A` b=`b`**
|
||||
**`x` = ls[^x]**
|
||||
**`resid` = ls[^residual_fro]**
|
||||
|
||||
> print text=`x`
|
||||
> print text=`resid`
|
||||
|
||||
@@ -15,11 +15,11 @@ $$
|
||||
\begin{bmatrix}4&0\\0&2\end{bmatrix}
|
||||
$$
|
||||
|
||||
*`M` = > la.from_formula formula=`M`*
|
||||
*`f` = > la.factorize matrix=`M` kind="svd"*
|
||||
*`S` = f[^S]*
|
||||
*`_` = > la.draw factor=`f` kind="svd" theme="light" path="svd-structure.svg"*
|
||||
*`hm` = > la.draw factor=`M` kind="hinton" path="svd-hinton.svg"*
|
||||
**`M` = > la.from_formula formula=`M`**
|
||||
**`f` = > la.factorize matrix=`M` kind="svd"**
|
||||
**`S` = f[^S]**
|
||||
**`_` = > la.draw factor=`f` kind="svd" theme="light" path="svd-structure.svg"**
|
||||
**`hm` = > la.draw factor=`M` kind="hinton" path="svd-hinton.svg"**
|
||||
|
||||
> print text=`S`
|
||||
> print text=svd-ok
|
||||
@@ -17,11 +17,11 @@ Declare shapes in a table, form \(P = AB\), then check \((AB)^\top = B^\top A^\t
|
||||
| 1 | A | 2 | 3 |
|
||||
| 2 | B | 3 | 2 |
|
||||
|
||||
*`env` = > la.declare table=`shapes`*
|
||||
*`A` = env[^A]*
|
||||
*`B` = env[^B]*
|
||||
*`P` = `A` * `B`*
|
||||
*`t` = > `P`.T_ascii*
|
||||
**`env` = > la.declare table=`shapes`**
|
||||
**`A` = env[^A]**
|
||||
**`B` = env[^B]**
|
||||
**`P` = `A` * `B`**
|
||||
**`t` = > `P`.T_ascii**
|
||||
> print text=`t`
|
||||
1. `t` == "B^T*A^T"
|
||||
> print text=identity-ok
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
| 关于 | /about | |
|
||||
| 后台 | /admin | |
|
||||
|
||||
**`页脚`**
|
||||
*`页脚`*
|
||||
@@ -12,4 +12,4 @@
|
||||
| 关于 | /about | |
|
||||
| 后台 | /admin | |
|
||||
|
||||
**`导航`**
|
||||
*`导航`*
|
||||
@@ -12,4 +12,4 @@
|
||||
| 发布文章 | /admin/new | |
|
||||
| 实时终端 | /#live | |
|
||||
|
||||
**`侧栏`**
|
||||
*`侧栏`*
|
||||
@@ -8,21 +8,21 @@ import seed:seed.mq.md
|
||||
|
||||
## 打开
|
||||
|
||||
*store = > 网页.数据库 地址="sqlite:data/marqdo-blog.db"*
|
||||
*字段 = > schema.posts*
|
||||
*标签字段 = > schema.tags*
|
||||
*关联字段 = > schema.post_tags*
|
||||
**store = > 网页.数据库 地址="sqlite:data/marqdo-blog.db"**
|
||||
**字段 = > schema.posts**
|
||||
**标签字段 = > schema.tags**
|
||||
**关联字段 = > schema.post_tags**
|
||||
> `store`.初始化 名=posts 字段=`字段`
|
||||
> `store`.初始化 名=tags 字段=`标签字段`
|
||||
> `store`.初始化 名=post_tags 字段=`关联字段`
|
||||
*行 = > store.查询 表="posts" 上限=1*
|
||||
**行 = > store.查询 表="posts" 上限=1**
|
||||
1. `行`
|
||||
**store**
|
||||
*store*
|
||||
2. *
|
||||
*文章 = > seed.posts*
|
||||
*标签 = > seed.tags*
|
||||
*关联 = > seed.post_tags*
|
||||
**文章 = > seed.posts**
|
||||
**标签 = > seed.tags**
|
||||
**关联 = > seed.post_tags**
|
||||
> `store`.插入 表=posts 行=`文章`
|
||||
> `store`.插入 表=tags 行=`标签`
|
||||
> `store`.插入 表=post_tags 行=`关联`
|
||||
**store**
|
||||
*store*
|
||||
@@ -15,7 +15,7 @@
|
||||
| created_at | text | true |
|
||||
| updated_at | text | true |
|
||||
|
||||
**`schema`**
|
||||
*`schema`*
|
||||
|
||||
## tags
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
| name | text | false |
|
||||
| slug | text | false |
|
||||
|
||||
**`tags`**
|
||||
*`tags`*
|
||||
|
||||
## post_tags
|
||||
|
||||
@@ -43,4 +43,4 @@
|
||||
| post_id | integer | false |
|
||||
| tag_id | integer | false |
|
||||
|
||||
**`post_tags`**
|
||||
*`post_tags`*
|
||||
@@ -13,7 +13,7 @@
|
||||
| 5 | 会话与登录鉴权 | session-auth | 后台用 session 门禁保护,只有登录用户能发布文章。 | 用 app.鉴权 配置管理员用户表,/admin 下的 CRUD 页面都需要有效会话。 | web | 2026-08-18 | 2026-08-20 |
|
||||
| 6 | 数据库与 CRUD | database-crud | 博客的文章、标签、关联全部由 SQLite 支撑。 | db.初始化 建表、db.插入 写种子、后台表单增删改。文章与标签通过 post_tags 关联。 | database | 2026-08-20 | 2026-08-21 |
|
||||
|
||||
**`posts`**
|
||||
*`posts`*
|
||||
|
||||
## tags
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
| 4 | 数据库 | database |
|
||||
| 5 | 实时 | realtime |
|
||||
|
||||
**`tags`**
|
||||
*`tags`*
|
||||
|
||||
## post_tags
|
||||
|
||||
@@ -50,4 +50,4 @@
|
||||
| 9 | 6 | 4 |
|
||||
| 10 | 6 | 1 |
|
||||
|
||||
**`post_tags`**
|
||||
*`post_tags`*
|
||||
@@ -83,49 +83,49 @@ import db:db/index.mq.md
|
||||
|----|------|----|------|------|------|
|
||||
| "/static/logo.svg" | Marqdo | brand-logo | "/" | 40 | eager |
|
||||
|
||||
*store = > db.打开*
|
||||
**store = > db.打开**
|
||||
|
||||
*首页CSS = > theme.全局*
|
||||
**首页CSS = > theme.全局**
|
||||
|
||||
*page = > 网页.页面 标题="Marqdo 博客" 引言="<h1>Marqdo 博客</h1><p>用 web 扩展库搭建的博客:表格装配页面、SQLite 数据、动态路由、实时终端。</p><h2 id=\"live\">实时终端</h2><p id=\"live-status\" class=\"live-pill\">connecting…</p><input id=\"live-msg\" placeholder=\"输入一条消息…\"><button id=\"live-send\" disabled>发送</button><div id=\"live-out\"></div><script src=\"/static/live.js\"></script>"*
|
||||
*page = > page.组件装配 组件=`首页`*
|
||||
*page = > page.主体装配 主体=`列表`*
|
||||
*page = > page.排序 排序="-created_at"*
|
||||
*page = > page.样式 样式=`首页CSS`*
|
||||
*page = > page.头装配 表=`头资源`*
|
||||
*page = > page.图片装配 表=`品牌图`*
|
||||
**page = > 网页.页面 标题="Marqdo 博客" 引言="<h1>Marqdo 博客</h1><p>用 web 扩展库搭建的博客:表格装配页面、SQLite 数据、动态路由、实时终端。</p><h2 id=\"live\">实时终端</h2><p id=\"live-status\" class=\"live-pill\">connecting…</p><input id=\"live-msg\" placeholder=\"输入一条消息…\"><button id=\"live-send\" disabled>发送</button><div id=\"live-out\"></div><script src=\"/static/live.js\"></script>"**
|
||||
**page = > page.组件装配 组件=`首页`**
|
||||
**page = > page.主体装配 主体=`列表`**
|
||||
**page = > page.排序 排序="-created_at"**
|
||||
**page = > page.样式 样式=`首页CSS`**
|
||||
**page = > page.头装配 表=`头资源`**
|
||||
**page = > page.图片装配 表=`品牌图`**
|
||||
|
||||
*about = > 网页.页面 标题="关于" 引言="<h1>关于本站</h1><p>一个用 Marqdo 的 web 扩展库(ext/web)写成的博客系统。</p><p>它演示了:GFM 表格装配导航与侧栏、SQLite 驱动的主体绑定、动态路由 /post/{slug}、标签归档、以及受 session 保护的后台 CRUD。</p>"*
|
||||
*about = > about.组件装配 组件=`首页`*
|
||||
*about = > about.样式 样式=`首页CSS`*
|
||||
**about = > 网页.页面 标题="关于" 引言="<h1>关于本站</h1><p>一个用 Marqdo 的 web 扩展库(ext/web)写成的博客系统。</p><p>它演示了:GFM 表格装配导航与侧栏、SQLite 驱动的主体绑定、动态路由 /post/{slug}、标签归档、以及受 session 保护的后台 CRUD。</p>"**
|
||||
**about = > about.组件装配 组件=`首页`**
|
||||
**about = > about.样式 样式=`首页CSS`**
|
||||
|
||||
*post = > 网页.页面 标题="文章"*
|
||||
*post = > post.组件装配 组件=`首页`*
|
||||
*post = > post.主体装配 主体=`详情绑定`*
|
||||
*post = > post.查询条件 条件=`文章条件`*
|
||||
*post = > post.详情 详情=True*
|
||||
*post = > post.样式 样式=`首页CSS`*
|
||||
**post = > 网页.页面 标题="文章"**
|
||||
**post = > post.组件装配 组件=`首页`**
|
||||
**post = > post.主体装配 主体=`详情绑定`**
|
||||
**post = > post.查询条件 条件=`文章条件`**
|
||||
**post = > post.详情 详情=True**
|
||||
**post = > post.样式 样式=`首页CSS`**
|
||||
|
||||
*tags = > 网页.页面 标题="标签归档" 引言="<h1>标签归档</h1><p>点击标签查看该主题下的文章。</p>"*
|
||||
*tags = > tags.组件装配 组件=`首页`*
|
||||
*tags = > tags.主体装配 主体=`标签列表`*
|
||||
*tags = > tags.链接前缀 前缀="/tag/"*
|
||||
*tags = > tags.样式 样式=`首页CSS`*
|
||||
**tags = > 网页.页面 标题="标签归档" 引言="<h1>标签归档</h1><p>点击标签查看该主题下的文章。</p>"**
|
||||
**tags = > tags.组件装配 组件=`首页`**
|
||||
**tags = > tags.主体装配 主体=`标签列表`**
|
||||
**tags = > tags.链接前缀 前缀="/tag/"**
|
||||
**tags = > tags.样式 样式=`首页CSS`**
|
||||
|
||||
*tagged = > 网页.页面 标题="标签"*
|
||||
*tagged = > tagged.组件装配 组件=`首页`*
|
||||
*tagged = > tagged.主体装配 主体=`列表`*
|
||||
*tagged = > tagged.查询条件 条件=`标签条件`*
|
||||
*tagged = > tagged.排序 排序="-created_at"*
|
||||
*tagged = > tagged.样式 样式=`首页CSS`*
|
||||
**tagged = > 网页.页面 标题="标签"**
|
||||
**tagged = > tagged.组件装配 组件=`首页`**
|
||||
**tagged = > tagged.主体装配 主体=`列表`**
|
||||
**tagged = > tagged.查询条件 条件=`标签条件`**
|
||||
**tagged = > tagged.排序 排序="-created_at"**
|
||||
**tagged = > tagged.样式 样式=`首页CSS`**
|
||||
|
||||
*app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18085*
|
||||
*app = > app.路由 路径="/about" 页面=about*
|
||||
*app = > app.路由 路径="/post/{slug}" 页面=post*
|
||||
*app = > app.路由 路径="/tags" 页面=tags*
|
||||
*app = > app.路由 路径="/tag/{slug}" 页面=tagged*
|
||||
*app = > app.静态 目录="public" 挂载="/static"*
|
||||
*app = > app.图标 表=`站点图标`*
|
||||
*app = > app.路由实时 路径="/live" 回显=True*
|
||||
*app = > app.鉴权 用户表=`管理员` 会话时长=3600*
|
||||
**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18085**
|
||||
**app = > app.路由 路径="/about" 页面=about**
|
||||
**app = > app.路由 路径="/post/{slug}" 页面=post**
|
||||
**app = > app.路由 路径="/tags" 页面=tags**
|
||||
**app = > app.路由 路径="/tag/{slug}" 页面=tagged**
|
||||
**app = > app.静态 目录="public" 挂载="/static"**
|
||||
**app = > app.图标 表=`站点图标`**
|
||||
**app = > app.路由实时 路径="/live" 回显=True**
|
||||
**app = > app.鉴权 用户表=`管理员` 会话时长=3600**
|
||||
> `app`.监听
|
||||
@@ -47,7 +47,7 @@ import text:lib/text.mq.md
|
||||
| body.has-sidebar | grid-template-areas | "top top" "side main" "foot foot" |
|
||||
| body.no-sidebar | grid-template-areas | "top" "main" "foot" |
|
||||
|
||||
**`基础`**
|
||||
*`基础`*
|
||||
|
||||
## 顶栏
|
||||
|
||||
@@ -96,7 +96,7 @@ import text:lib/text.mq.md
|
||||
| ul.nav li:first-child a | padding-left | .2rem |
|
||||
| ul.nav li:first-child a | padding-right | .2rem |
|
||||
|
||||
**`顶栏`**
|
||||
*`顶栏`*
|
||||
|
||||
## 侧栏
|
||||
|
||||
@@ -129,7 +129,7 @@ import text:lib/text.mq.md
|
||||
| ul.side-nav a:hover | transform | translateX(4px) |
|
||||
| ul.side-nav a:hover | box-shadow | 0 1px 3px rgba(28,25,23,.08) |
|
||||
|
||||
**`侧栏`**
|
||||
*`侧栏`*
|
||||
|
||||
## 主体
|
||||
|
||||
@@ -154,7 +154,7 @@ import text:lib/text.mq.md
|
||||
| .main-intro p | margin | 0 |
|
||||
| .main-intro p | font-size | 1.05rem |
|
||||
|
||||
**`主体`**
|
||||
*`主体`*
|
||||
|
||||
## 卡片
|
||||
|
||||
@@ -210,7 +210,7 @@ import text:lib/text.mq.md
|
||||
| .content.cards p | font-size | .95rem |
|
||||
| .content.cards p | flex | 1 |
|
||||
|
||||
**`卡片`**
|
||||
*`卡片`*
|
||||
|
||||
## 页脚
|
||||
|
||||
@@ -240,7 +240,7 @@ import text:lib/text.mq.md
|
||||
| ul.foot-nav a | text-decoration | none |
|
||||
| ul.foot-nav a:hover | color | var(--accent) |
|
||||
|
||||
**`页脚`**
|
||||
*`页脚`*
|
||||
|
||||
## 表单
|
||||
|
||||
@@ -341,7 +341,7 @@ import text:lib/text.mq.md
|
||||
| .site-form .admin-list a | text-decoration | none |
|
||||
| .site-form .admin-list a | font-size | .9rem |
|
||||
|
||||
**`表单`**
|
||||
*`表单`*
|
||||
|
||||
## 响应式
|
||||
|
||||
@@ -364,29 +364,29 @@ import text:lib/text.mq.md
|
||||
| (max-width: 860px) | .content.cards | grid-template-columns | 1fr |
|
||||
| (max-width: 520px) | ul.nav | flex-wrap | wrap |
|
||||
|
||||
**`响应式`**
|
||||
*`响应式`*
|
||||
|
||||
## 全局
|
||||
|
||||
用 样式装配 函数逐个把段落表装配成 CSS,再拼接成完整样式表。
|
||||
|
||||
*基础表 = > 基础*
|
||||
*顶栏表 = > 顶栏*
|
||||
*侧栏表 = > 侧栏*
|
||||
*主体表 = > 主体*
|
||||
*卡片表 = > 卡片*
|
||||
*页脚表 = > 页脚*
|
||||
*表单表 = > 表单*
|
||||
*响应式表 = > 响应式*
|
||||
**基础表 = > 基础**
|
||||
**顶栏表 = > 顶栏**
|
||||
**侧栏表 = > 侧栏**
|
||||
**主体表 = > 主体**
|
||||
**卡片表 = > 卡片**
|
||||
**页脚表 = > 页脚**
|
||||
**表单表 = > 表单**
|
||||
**响应式表 = > 响应式**
|
||||
|
||||
*css基础 = > 网页.样式装配 名="基础" 表=`基础表`*
|
||||
*css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`*
|
||||
*css侧栏 = > 网页.样式装配 名="侧栏" 表=`侧栏表`*
|
||||
*css主体 = > 网页.样式装配 名="主体" 表=`主体表`*
|
||||
*css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`*
|
||||
*css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`*
|
||||
*css表单 = > 网页.样式装配 名="表单" 表=`表单表`*
|
||||
*css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`*
|
||||
**css基础 = > 网页.样式装配 名="基础" 表=`基础表`**
|
||||
**css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`**
|
||||
**css侧栏 = > 网页.样式装配 名="侧栏" 表=`侧栏表`**
|
||||
**css主体 = > 网页.样式装配 名="主体" 表=`主体表`**
|
||||
**css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`**
|
||||
**css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`**
|
||||
**css表单 = > 网页.样式装配 名="表单" 表=`表单表`**
|
||||
**css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`**
|
||||
|
||||
`css段` =
|
||||
|
||||
@@ -401,5 +401,5 @@ import text:lib/text.mq.md
|
||||
| `css表单` |
|
||||
| `css响应式` |
|
||||
|
||||
*css = > text.str_join xs=`css段` sep=""*
|
||||
**css**
|
||||
**css = > text.str_join xs=`css段` sep=""**
|
||||
*css*
|
||||
@@ -19,9 +19,9 @@ H on qubit 0, then CNOT(0→1). Ideal measurement: |00⟩ and |11⟩ each with p
|
||||
| 1 | H | 0 |
|
||||
| 2 | CX | 0,1 |
|
||||
|
||||
*qc = > quantum.circuit qubits=2 steps=`steps`*
|
||||
*p = > qc.probabilities*
|
||||
*_ = > qc.draw path="bell.svg"*
|
||||
*_ = > qc.draw kind="probs" path="bell-probs.svg"*
|
||||
**qc = > quantum.circuit qubits=2 steps=`steps`**
|
||||
**p = > qc.probabilities**
|
||||
**_ = > qc.draw path="bell.svg"**
|
||||
**_ = > qc.draw kind="probs" path="bell-probs.svg"**
|
||||
|
||||
> print text=`p`
|
||||
@@ -18,25 +18,25 @@ Build |Φ⁺⟩ with H then CX. Full-state purity stays 1; tracing out one qubit
|
||||
| 1 | H | 0 |
|
||||
| 2 | CX | 0,1 |
|
||||
|
||||
*qc = > quantum.circuit qubits=2 steps=`steps`*
|
||||
*p = > `qc`.probabilities*
|
||||
**qc = > quantum.circuit qubits=2 steps=`steps`**
|
||||
**p = > `qc`.probabilities**
|
||||
|
||||
*rho = > `qc`.density*
|
||||
*pur = > `rho`.purity*
|
||||
*red = > `rho`.partial_trace keep=0*
|
||||
*rpur = > `red`.purity*
|
||||
**rho = > `qc`.density**
|
||||
**pur = > `rho`.purity**
|
||||
**red = > `rho`.partial_trace keep=0**
|
||||
**rpur = > `red`.purity**
|
||||
|
||||
*zz = "ZZ"*
|
||||
*ezz = > `qc`.expect obs=`zz`*
|
||||
**zz = "ZZ"**
|
||||
**ezz = > `qc`.expect obs=`zz`**
|
||||
|
||||
*sch = > `qc`.schmidt cut=1*
|
||||
*ent = sch[^entropy]*
|
||||
**sch = > `qc`.schmidt cut=1**
|
||||
**ent = sch[^entropy]**
|
||||
|
||||
*_ = > `qc`.draw path="entangle-circuit.svg" theme="dark"*
|
||||
*_ = > `qc`.draw kind="hinton" path="entangle-hinton.svg"*
|
||||
*_ = > `qc`.draw kind="qsphere" path="entangle-qsphere.svg"*
|
||||
*_ = > `qc`.draw kind="multibloch" path="entangle-multibloch.svg"*
|
||||
*_ = > `rho`.draw kind="city" path="entangle-city.svg"*
|
||||
**_ = > `qc`.draw path="entangle-circuit.svg" theme="dark"**
|
||||
**_ = > `qc`.draw kind="hinton" path="entangle-hinton.svg"**
|
||||
**_ = > `qc`.draw kind="qsphere" path="entangle-qsphere.svg"**
|
||||
**_ = > `qc`.draw kind="multibloch" path="entangle-multibloch.svg"**
|
||||
**_ = > `rho`.draw kind="city" path="entangle-city.svg"**
|
||||
|
||||
> print text=`p`
|
||||
> print text=`pur`
|
||||
|
||||
@@ -18,11 +18,11 @@ H on qubit 0, CX(0→1), CX(0→2). Ideal: |000⟩ and |111⟩ each with probabi
|
||||
| 2 | CX | 0,1 |
|
||||
| 3 | CX | 0,2 |
|
||||
|
||||
*qc = > quantum.circuit qubits=3 steps=`steps`*
|
||||
*p = > qc.probabilities*
|
||||
*_ = > qc.draw path="ghz.svg"*
|
||||
*_ = > qc.draw kind="probs" path="ghz-probs.svg"*
|
||||
*H = > quantum.gate name="H"*
|
||||
*_ = > H.draw kind="matrix" path="ghz-h-matrix.svg"*
|
||||
**qc = > quantum.circuit qubits=3 steps=`steps`**
|
||||
**p = > qc.probabilities**
|
||||
**_ = > qc.draw path="ghz.svg"**
|
||||
**_ = > qc.draw kind="probs" path="ghz-probs.svg"**
|
||||
**H = > quantum.gate name="H"**
|
||||
**_ = > H.draw kind="matrix" path="ghz-h-matrix.svg"**
|
||||
|
||||
> print text=`p`
|
||||
@@ -9,11 +9,11 @@ import web:ext/web/web.mq.md
|
||||
Server page with a counter UI. Client logic lives in `static/client.mq.md`
|
||||
(loaded by official bridge via `client_embed`).
|
||||
|
||||
*`embed` = > web.client_embed bridge="/static/marqdo-bridge.js" wasm="/static/marqdo_wasm.wasm" source="/static/client.mq.md" boot=True*
|
||||
**`embed` = > web.client_embed bridge="/static/marqdo-bridge.js" wasm="/static/marqdo_wasm.wasm" source="/static/client.mq.md" boot=True**
|
||||
|
||||
*`intro` = "<h1>Marqdo client site</h1><p>SSR + WASM session. No author JS.</p><div id=\"count\">0</div><p><button id=\"bump\" type=\"button\" disabled>Bump</button> <button id=\"reset\" type=\"button\" disabled>Reset</button></p><pre id=\"log\">booting…</pre>" + embed*
|
||||
**`intro` = "<h1>Marqdo client site</h1><p>SSR + WASM session. No author JS.</p><div id=\"count\">0</div><p><button id=\"bump\" type=\"button\" disabled>Bump</button> <button id=\"reset\" type=\"button\" disabled>Reset</button></p><pre id=\"log\">booting…</pre>" + embed**
|
||||
|
||||
*page = > web.page title="Marqdo client site" intro=intro*
|
||||
*app = > web.app page=page host="127.0.0.1" port=18090*
|
||||
*app = > app.static dir="static" mount="/static"*
|
||||
**page = > web.page title="Marqdo client site" intro=intro**
|
||||
**app = > web.app page=page host="127.0.0.1" port=18090**
|
||||
**app = > app.static dir="static" mount="/static"**
|
||||
> `app`.listen
|
||||
@@ -7,7 +7,7 @@ import table:lib/table.mq.md
|
||||
|
||||
# main
|
||||
|
||||
*`count` = 0*
|
||||
**`count` = 0**
|
||||
|
||||
`wire` =
|
||||
|
||||
@@ -16,15 +16,15 @@ import table:lib/table.mq.md
|
||||
| 1 | "#bump" | click | bump |
|
||||
| 2 | "#reset" | click | reset |
|
||||
|
||||
*`ready` = > browser.set_text sel="#log" text="client.mq.md ready"*
|
||||
*`boot` = > table.put in=None at="wire" value=wire*
|
||||
**> browser.merge a=boot b=ready**
|
||||
**`ready` = > browser.set_text sel="#log" text="client.mq.md ready"**
|
||||
**`boot` = > table.put in=None at="wire" value=wire**
|
||||
*> browser.merge a=boot b=ready*
|
||||
|
||||
## bump
|
||||
*`count` = count + 1*
|
||||
*`label` = > str count*
|
||||
**> browser.set_text sel="#count" text=label**
|
||||
**`count` = count + 1**
|
||||
**`label` = > str count**
|
||||
*> browser.set_text sel="#count" text=label*
|
||||
|
||||
## reset
|
||||
*`count` = 0*
|
||||
**> browser.set_text sel="#count" text="0"**
|
||||
**`count` = 0**
|
||||
*> browser.set_text sel="#count" text="0"*
|
||||
@@ -7,4 +7,4 @@
|
||||
| Marqdo 网络扩展示例 | https://github.com | |
|
||||
| 文档 | /tools | |
|
||||
|
||||
**`页脚`**
|
||||
*`页脚`*
|
||||
@@ -12,4 +12,4 @@
|
||||
| 工具 | /tools | |
|
||||
| 后台 | /admin | |
|
||||
|
||||
**`导航`**
|
||||
*`导航`*
|
||||
@@ -12,4 +12,4 @@
|
||||
| 表单 | /new | |
|
||||
| lib/net | /tools | |
|
||||
|
||||
**`侧栏`**
|
||||
*`侧栏`*
|
||||
@@ -8,7 +8,7 @@
|
||||
| title | text | false |
|
||||
| body | text | true |
|
||||
|
||||
**`字段`**
|
||||
*`字段`*
|
||||
|
||||
## 种子
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
| 2 | 登录门禁后台 | /admin 页面需要 session 会话。 |
|
||||
| 3 | WebSocket 实时 | /live 端点会把你的消息实时回显。 |
|
||||
|
||||
**`行`**
|
||||
*`行`*
|
||||
@@ -7,13 +7,13 @@ import articles:articles.mq.md
|
||||
|
||||
## 打开
|
||||
|
||||
*store = > 网页.数据库 地址="sqlite:data/site-net-zh.db"*
|
||||
*字段 = > articles.结构*
|
||||
**store = > 网页.数据库 地址="sqlite:data/site-net-zh.db"**
|
||||
**字段 = > articles.结构**
|
||||
> `store`.初始化 名=articles 字段=`字段`
|
||||
*行 = > store.查询 表="articles" 上限=1*
|
||||
**行 = > store.查询 表="articles" 上限=1**
|
||||
1. `行`
|
||||
**store**
|
||||
*store*
|
||||
2. *
|
||||
*种子 = > articles.种子*
|
||||
**种子 = > articles.种子**
|
||||
> `store`.插入 表=articles 行=`种子`
|
||||
**store**
|
||||
*store*
|
||||
@@ -44,29 +44,29 @@ import db:db/index.mq.md
|
||||
| title | max:120 | 标题太长 |
|
||||
| body | max:8000 | 正文太长 |
|
||||
|
||||
*store = > db.打开*
|
||||
*page = > 网页.页面 标题="网络扩展站" 引言="<h1>网络扩展站</h1><p>SQLite 文章列表、WebSocket 实时小部件、登录门禁后台、以及标准库 lib/net 的解析工具。</p><h2 id=\"live\">实时 WebSocket</h2><p id=\"live-status\">connecting…</p><input id=\"live-msg\" placeholder=\"输入一条消息…\"><button id=\"live-send\" disabled>发送</button><div id=\"live-out\"></div><script src=\"/static/live.js\"></script>"*
|
||||
*page = > page.组件装配 组件=`首页`*
|
||||
*page = > page.主体装配 主体=`列表`*
|
||||
**store = > db.打开**
|
||||
**page = > 网页.页面 标题="网络扩展站" 引言="<h1>网络扩展站</h1><p>SQLite 文章列表、WebSocket 实时小部件、登录门禁后台、以及标准库 lib/net 的解析工具。</p><h2 id=\"live\">实时 WebSocket</h2><p id=\"live-status\">connecting…</p><input id=\"live-msg\" placeholder=\"输入一条消息…\"><button id=\"live-send\" disabled>发送</button><div id=\"live-out\"></div><script src=\"/static/live.js\"></script>"**
|
||||
**page = > page.组件装配 组件=`首页`**
|
||||
**page = > page.主体装配 主体=`列表`**
|
||||
|
||||
*about = > 网页.页面 标题="关于" 引言="<h1>关于</h1><p>演示网络扩展后的 web 库:会话、登录鉴权、WebSocket、multipart/cookie 解析。</p>"*
|
||||
*about = > about.组件装配 组件=`首页`*
|
||||
**about = > 网页.页面 标题="关于" 引言="<h1>关于</h1><p>演示网络扩展后的 web 库:会话、登录鉴权、WebSocket、multipart/cookie 解析。</p>"**
|
||||
**about = > about.组件装配 组件=`首页`**
|
||||
|
||||
<!-- 工具页:用 lib/net 解析展示 -->
|
||||
|
||||
*解析请求 = > net.解析Cookie 内容="session=abc123; theme=dark"*
|
||||
*请求块 = 解析请求[^1]*
|
||||
**解析请求 = > net.解析Cookie 内容="session=abc123; theme=dark"**
|
||||
**请求块 = 解析请求[^1]**
|
||||
|
||||
*解析响应 = > net.解析Cookie 内容="id=42; Path=/; HttpOnly; SameSite=Lax" 是响应头=True*
|
||||
*响应块 = 解析响应[^1]*
|
||||
**解析响应 = > net.解析Cookie 内容="id=42; Path=/; HttpOnly; SameSite=Lax" 是响应头=True**
|
||||
**响应块 = 解析响应[^1]**
|
||||
|
||||
`边界` = ----b
|
||||
|
||||
`正文` = "--`边界`\nContent-Disposition: form-data; name=\"title\"\n\n你好\n--`边界`\nContent-Disposition: form-data; name=\"封面\"; filename=\"pic.png\"\nContent-Type: image/png\n\n<字节>\n--`边界`--\n"
|
||||
|
||||
*多部分 = > net.解析多部分 正文=`正文` 边界=`边界`*
|
||||
*字段块 = 多部分[^1]*
|
||||
*文件块 = 多部分[^2]*
|
||||
**多部分 = > net.解析多部分 正文=`正文` 边界=`边界`**
|
||||
**字段块 = 多部分[^1]**
|
||||
**文件块 = 多部分[^2]**
|
||||
|
||||
`工具段` =
|
||||
|
||||
@@ -83,17 +83,17 @@ import db:db/index.mq.md
|
||||
| `文件块`[^name] · `文件块`[^filename] · `文件块`[^content_type] |
|
||||
| </p></article></section> |
|
||||
|
||||
*工具引言 = > text.str_join xs=`工具段` sep=""*
|
||||
*tools = > 网页.页面 标题="工具" 引言=`工具引言`*
|
||||
*tools = > tools.组件装配 组件=`首页`*
|
||||
**工具引言 = > text.str_join xs=`工具段` sep=""**
|
||||
**tools = > 网页.页面 标题="工具" 引言=`工具引言`**
|
||||
**tools = > tools.组件装配 组件=`首页`**
|
||||
|
||||
*article_form = > 网页.表单 表="articles" 动作="插入"*
|
||||
*article_form = > article_form.字段 字段=`文章字段`*
|
||||
*article_form = > article_form.规则 规则=`文章规则`*
|
||||
**article_form = > 网页.表单 表="articles" 动作="插入"**
|
||||
**article_form = > article_form.字段 字段=`文章字段`**
|
||||
**article_form = > article_form.规则 规则=`文章规则`**
|
||||
|
||||
*new = > 网页.页面 标题="发布" 引言="<h1>发布</h1><p>表单插入到 articles 表。</p>"*
|
||||
*new = > new.组件装配 组件=`首页`*
|
||||
*new = > new.表单装配 id="article" 表单=article_form*
|
||||
**new = > 网页.页面 标题="发布" 引言="<h1>发布</h1><p>表单插入到 articles 表。</p>"**
|
||||
**new = > new.组件装配 组件=`首页`**
|
||||
**new = > new.表单装配 id="article" 表单=article_form**
|
||||
|
||||
`管理员` =
|
||||
|
||||
@@ -101,11 +101,11 @@ import db:db/index.mq.md
|
||||
|----|--------|------|
|
||||
| 1 | admin | secret |
|
||||
|
||||
*app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18084*
|
||||
*app = > app.路由 路径="/about" 页面=about*
|
||||
*app = > app.路由 路径="/new" 页面=new*
|
||||
*app = > app.路由 路径="/tools" 页面=tools*
|
||||
*app = > app.静态 目录="public" 挂载="/static"*
|
||||
*app = > app.路由实时 路径="/live" 回显=True*
|
||||
*app = > app.鉴权 用户表=`管理员` 会话时长=3600*
|
||||
**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18084**
|
||||
**app = > app.路由 路径="/about" 页面=about**
|
||||
**app = > app.路由 路径="/new" 页面=new**
|
||||
**app = > app.路由 路径="/tools" 页面=tools**
|
||||
**app = > app.静态 目录="public" 挂载="/static"**
|
||||
**app = > app.路由实时 路径="/live" 回显=True**
|
||||
**app = > app.鉴权 用户表=`管理员` 会话时长=3600**
|
||||
> `app`.监听
|
||||
@@ -7,7 +7,7 @@
|
||||
| background | #ffffff |
|
||||
| border-bottom | 1px solid #e7e5e4 |
|
||||
|
||||
**`顶栏`**
|
||||
*`顶栏`*
|
||||
|
||||
## 侧栏面板
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|------|-----|
|
||||
| background | #f5f5f4 |
|
||||
|
||||
**`侧栏面板`**
|
||||
*`侧栏面板`*
|
||||
|
||||
## 卡片标题
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
| font-size | 1.15rem |
|
||||
| margin | 0 0 0.35rem |
|
||||
|
||||
**`卡片标题`**
|
||||
*`卡片标题`*
|
||||
|
||||
## 卡片正文
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
| color | #57534e |
|
||||
| margin | 0 |
|
||||
|
||||
**`卡片正文`**
|
||||
*`卡片正文`*
|
||||
@@ -7,4 +7,4 @@
|
||||
| Marqdo web-net example | https://github.com | |
|
||||
| Docs | /tools | |
|
||||
|
||||
**`foot`**
|
||||
*`foot`*
|
||||
@@ -12,4 +12,4 @@ Site top navigation. The Admin tab points at the login-gated admin page.
|
||||
| Tools | /tools | |
|
||||
| Admin | /admin | |
|
||||
|
||||
**`nav`**
|
||||
*`nav`*
|
||||
@@ -12,4 +12,4 @@ Sidebar index of what this example demonstrates.
|
||||
| Forms | /new | |
|
||||
| net lib | /tools | |
|
||||
|
||||
**`side`**
|
||||
*`side`*
|
||||
@@ -8,7 +8,7 @@
|
||||
| title | text | false |
|
||||
| body | text | true |
|
||||
|
||||
**`fields`**
|
||||
*`fields`*
|
||||
|
||||
## seed
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
| 2 | Login-gated admin | The /admin page requires a session cookie. |
|
||||
| 3 | WebSocket live | The /live endpoint echoes your message in real time. |
|
||||
|
||||
**`rows`**
|
||||
*`rows`*
|
||||
@@ -7,13 +7,13 @@ import articles:articles.mq.md
|
||||
|
||||
## open
|
||||
|
||||
*store = > web.db url="sqlite:data/site-net.db"*
|
||||
*fields = > articles.schema*
|
||||
**store = > web.db url="sqlite:data/site-net.db"**
|
||||
**fields = > articles.schema**
|
||||
> `store`.init name=articles fields=`fields`
|
||||
*rows = > store.select table="articles" limit=1*
|
||||
**rows = > store.select table="articles" limit=1**
|
||||
1. `rows`
|
||||
**store**
|
||||
*store*
|
||||
2. *
|
||||
*seed = > articles.seed*
|
||||
**seed = > articles.seed**
|
||||
> `store`.insert table=articles rows=`seed`
|
||||
**store**
|
||||
*store*
|
||||
@@ -31,27 +31,27 @@ import db:db/index.mq.md
|
||||
|
||||
Home intro also embeds the live WebSocket widget (HTML is served raw).
|
||||
|
||||
*store = > db.open*
|
||||
*page = > web.page title="Marqdo Net Site" intro="<h1>Net Site</h1><p>Articles from SQLite, a live WebSocket widget, login-gated admin, and net-library parsing tools.</p><h2 id=\"live\">Live WebSocket</h2><p id=\"live-status\">connecting…</p><input id=\"live-msg\" placeholder=\"type a message…\"><button id=\"live-send\" disabled>send</button><div id=\"live-out\"></div><script src=\"/static/live.js\"></script>"*
|
||||
*page = > page.compose_components components=home*
|
||||
*page = > page.compose_main main=index*
|
||||
**store = > db.open**
|
||||
**page = > web.page title="Marqdo Net Site" intro="<h1>Net Site</h1><p>Articles from SQLite, a live WebSocket widget, login-gated admin, and net-library parsing tools.</p><h2 id=\"live\">Live WebSocket</h2><p id=\"live-status\">connecting…</p><input id=\"live-msg\" placeholder=\"type a message…\"><button id=\"live-send\" disabled>send</button><div id=\"live-out\"></div><script src=\"/static/live.js\"></script>"**
|
||||
**page = > page.compose_components components=home**
|
||||
**page = > page.compose_main main=index**
|
||||
|
||||
About page: same shell.
|
||||
|
||||
*about = > web.page title="About" intro="<h1>About</h1><p>Demonstrates the network-extended web library: sessions, auth, WebSocket, multipart/cookie parsing.</p>"*
|
||||
*about = > about.compose_components components=home*
|
||||
**about = > web.page title="About" intro="<h1>About</h1><p>Demonstrates the network-extended web library: sessions, auth, WebSocket, multipart/cookie parsing.</p>"**
|
||||
**about = > about.compose_components components=home**
|
||||
|
||||
<!-- Tools page (lib/net parsing) -->
|
||||
|
||||
Parse a `Cookie` request header with the standard library.
|
||||
|
||||
*parsed_req = > net.cookie_parse text="session=abc123; theme=dark"*
|
||||
*req_cookie = parsed_req[^1]*
|
||||
**parsed_req = > net.cookie_parse text="session=abc123; theme=dark"**
|
||||
**req_cookie = parsed_req[^1]**
|
||||
|
||||
Parse a `Set-Cookie` response header.
|
||||
|
||||
*parsed_resp = > net.cookie_parse text="id=42; Path=/; HttpOnly; SameSite=Lax" is_response=True*
|
||||
*resp_cookie = parsed_resp[^1]*
|
||||
**parsed_resp = > net.cookie_parse text="id=42; Path=/; HttpOnly; SameSite=Lax" is_response=True**
|
||||
**resp_cookie = parsed_resp[^1]**
|
||||
|
||||
Parse a `multipart/form-data` body.
|
||||
|
||||
@@ -59,9 +59,9 @@ Parse a `multipart/form-data` body.
|
||||
|
||||
`_body` = "--`_b`\nContent-Disposition: form-data; name=\"title\"\n\nHello\n--`_b`\nContent-Disposition: form-data; name=\"cover\"; filename=\"pic.png\"\nContent-Type: image/png\n\n<bytes>\n--`_b`--\n"
|
||||
|
||||
*mp = > net.multipart_parse body=`_body` boundary=`_b`*
|
||||
*mp_title = mp[^1]*
|
||||
*mp_cover = mp[^2]*
|
||||
**mp = > net.multipart_parse body=`_body` boundary=`_b`**
|
||||
**mp_title = mp[^1]**
|
||||
**mp_cover = mp[^2]**
|
||||
|
||||
Build the tools page as one HTML intro (intro is served raw).
|
||||
|
||||
@@ -80,9 +80,9 @@ Build the tools page as one HTML intro (intro is served raw).
|
||||
| `mp_cover`[^name] · `mp_cover`[^filename] · `mp_cover`[^content_type] |
|
||||
| </p></article></section> |
|
||||
|
||||
*tools_intro = > text.str_join xs=`tools_parts` sep=""*
|
||||
*tools = > web.page title="Tools" intro=`tools_intro`*
|
||||
*tools = > tools.compose_components components=home*
|
||||
**tools_intro = > text.str_join xs=`tools_parts` sep=""**
|
||||
**tools = > web.page title="Tools" intro=`tools_intro`**
|
||||
**tools = > tools.compose_components components=home**
|
||||
|
||||
Article create form: field table + rules table.
|
||||
|
||||
@@ -101,15 +101,15 @@ Article create form: field table + rules table.
|
||||
| title | max:120 | Title is too long |
|
||||
| body | max:8000 | Body is too long |
|
||||
|
||||
*article_form = > web.form table="articles" action="insert"*
|
||||
*article_form = > article_form.fields fields=article_fields*
|
||||
*article_form = > article_form.rules rules=article_rules*
|
||||
**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 page: form embedded in the main slot.
|
||||
|
||||
*new = > web.page title="Publish" intro="<h1>Publish</h1><p>Form inserts into articles.</p>"*
|
||||
*new = > new.compose_components components=home*
|
||||
*new = > new.compose_form id="article" form=article_form*
|
||||
**new = > web.page title="Publish" intro="<h1>Publish</h1><p>Form inserts into articles.</p>"**
|
||||
**new = > new.compose_components components=home**
|
||||
**new = > new.compose_form id="article" form=article_form**
|
||||
|
||||
Admin users table (english + chinese column headers both work).
|
||||
|
||||
@@ -119,11 +119,11 @@ Admin users table (english + chinese column headers both work).
|
||||
|----|----------|----------|
|
||||
| 1 | admin | secret |
|
||||
|
||||
*app = > web.app page=page db=store admin=True host="127.0.0.1" port=18083*
|
||||
*app = > app.route path="/about" page=about*
|
||||
*app = > app.route path="/new" page=new*
|
||||
*app = > app.route path="/tools" page=tools*
|
||||
*app = > app.static dir="public" mount="/static"*
|
||||
*app = > app.route_ws path="/live" echo=True*
|
||||
*app = > app.auth users=`admins` session_ttl=3600*
|
||||
**app = > web.app page=page db=store admin=True host="127.0.0.1" port=18083**
|
||||
**app = > app.route path="/about" page=about**
|
||||
**app = > app.route path="/new" page=new**
|
||||
**app = > app.route path="/tools" page=tools**
|
||||
**app = > app.static dir="public" mount="/static"**
|
||||
**app = > app.route_ws path="/live" echo=True**
|
||||
**app = > app.auth users=`admins` session_ttl=3600**
|
||||
> `app`.listen
|
||||
@@ -7,7 +7,7 @@
|
||||
| background | #ffffff |
|
||||
| border-bottom | 1px solid #e7e5e4 |
|
||||
|
||||
**`topnav`**
|
||||
*`topnav`*
|
||||
|
||||
## side_panel
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|------|-----|
|
||||
| background | #f5f5f4 |
|
||||
|
||||
**`side_panel`**
|
||||
*`side_panel`*
|
||||
|
||||
## card_title
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
| font-size | 1.15rem |
|
||||
| margin | 0 0 0.35rem |
|
||||
|
||||
**`card_title`**
|
||||
*`card_title`*
|
||||
|
||||
## card_body
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
| color | #57534e |
|
||||
| margin | 0 |
|
||||
|
||||
**`card_body`**
|
||||
*`card_body`*
|
||||
@@ -6,4 +6,4 @@
|
||||
|------|-----|------|
|
||||
| Marqdo | https://github.com | |
|
||||
|
||||
**`foot`**
|
||||
*`foot`*
|
||||
@@ -9,4 +9,4 @@
|
||||
| 写文章 | /new | |
|
||||
| 后台 | /admin | |
|
||||
|
||||
**`nav`**
|
||||
*`nav`*
|
||||
@@ -7,4 +7,4 @@
|
||||
| 笔记 | / | |
|
||||
| 文档 | https://github.com | |
|
||||
|
||||
**`side`**
|
||||
*`side`*
|
||||
@@ -8,7 +8,7 @@
|
||||
| title | text | false |
|
||||
| body | text | true |
|
||||
|
||||
**`fields`**
|
||||
*`fields`*
|
||||
|
||||
## seed
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
| 1 | 你好 Marqdo | 第一篇来自 GFM 表格。 |
|
||||
| 2 | 代码即文档 | 页面表就是程序。 |
|
||||
|
||||
**`rows`**
|
||||
*`rows`*
|
||||
@@ -7,13 +7,13 @@ import articles:articles.mq.md
|
||||
|
||||
## open
|
||||
|
||||
*store = > 网页.数据库 地址="sqlite:data/site-zh.db"*
|
||||
*fields = > articles.schema*
|
||||
**store = > 网页.数据库 地址="sqlite:data/site-zh.db"**
|
||||
**fields = > articles.schema**
|
||||
> `store`.初始化 名=articles 字段=`fields`
|
||||
*rows = > store.查询 表="articles" 上限=1*
|
||||
**rows = > store.查询 表="articles" 上限=1**
|
||||
1. `rows`
|
||||
**store**
|
||||
*store*
|
||||
2. *
|
||||
*seed = > articles.seed*
|
||||
**seed = > articles.seed**
|
||||
> `store`.插入 表=articles 行=`seed`
|
||||
**store**
|
||||
*store*
|
||||
@@ -42,24 +42,24 @@ import db:db/index.mq.md
|
||||
| title | max:120 | 标题太长 |
|
||||
| body | max:8000 | 正文太长 |
|
||||
|
||||
*store = > db.open*
|
||||
*page = > 网页.页面 标题="Marqdo 中文站" 引言="<h1>中文站</h1><p>表格 + 类方法。</p>"*
|
||||
*page = > page.组件装配 组件=home*
|
||||
*page = > page.主体装配 主体=index*
|
||||
**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*
|
||||
**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*
|
||||
**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*
|
||||
**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 = > app.静态 目录="public" 挂载="/static"*
|
||||
**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18082**
|
||||
**app = > app.路由 路径="/about" 页面=about**
|
||||
**app = > app.路由 路径="/new" 页面=new**
|
||||
**app = > app.静态 目录="public" 挂载="/static"**
|
||||
> `app`.监听
|
||||
@@ -7,7 +7,7 @@
|
||||
| background | #ffffff |
|
||||
| border-bottom | 1px solid #e7e5e4 |
|
||||
|
||||
**`topnav`**
|
||||
*`topnav`*
|
||||
|
||||
## side_panel
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|------|-----|
|
||||
| background | #f5f5f4 |
|
||||
|
||||
**`side_panel`**
|
||||
*`side_panel`*
|
||||
|
||||
## card_title
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
| font-size | 1.15rem |
|
||||
| margin | 0 0 0.35rem |
|
||||
|
||||
**`card_title`**
|
||||
*`card_title`*
|
||||
|
||||
## card_body
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
| color | #57534e |
|
||||
| margin | 0 |
|
||||
|
||||
**`card_body`**
|
||||
*`card_body`*
|
||||
@@ -6,4 +6,4 @@
|
||||
|------|-----|------|
|
||||
| Marqdo | https://github.com | |
|
||||
|
||||
**`foot`**
|
||||
*`foot`*
|
||||
@@ -11,4 +11,4 @@ Static top links for the shell.
|
||||
| New | /new | |
|
||||
| Admin | /admin | |
|
||||
|
||||
**`nav`**
|
||||
*`nav`*
|
||||
@@ -7,4 +7,4 @@
|
||||
| Notes | / | |
|
||||
| Docs | https://github.com | |
|
||||
|
||||
**`side`**
|
||||
*`side`*
|
||||
@@ -8,7 +8,7 @@
|
||||
| title | text | false |
|
||||
| body | text | true |
|
||||
|
||||
**`fields`**
|
||||
*`fields`*
|
||||
|
||||
## seed
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
| 1 | Hello Marqdo | First article from a GFM table. |
|
||||
| 2 | Code as docs | The page table is the program. |
|
||||
|
||||
**`rows`**
|
||||
*`rows`*
|
||||
@@ -8,13 +8,13 @@ import fs:lib/fs.mq.md
|
||||
|
||||
## open
|
||||
|
||||
*store = > web.db url="sqlite:data/site.db"*
|
||||
*fields = > articles.schema*
|
||||
**store = > web.db url="sqlite:data/site.db"**
|
||||
**fields = > articles.schema**
|
||||
> `store`.init name=articles fields=`fields`
|
||||
*rows = > store.select table="articles" limit=1*
|
||||
**rows = > store.select table="articles" limit=1**
|
||||
1. `rows`
|
||||
**store**
|
||||
*store*
|
||||
2. *
|
||||
*seed = > articles.seed*
|
||||
**seed = > articles.seed**
|
||||
> `store`.insert table=articles rows=`seed`
|
||||
**store**
|
||||
*store*
|
||||
@@ -46,28 +46,28 @@ Article create form (design §5.5): field table + rules table.
|
||||
| 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*
|
||||
**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*
|
||||
**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*
|
||||
**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*
|
||||
**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 = > 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
|
||||
@@ -7,7 +7,7 @@
|
||||
| background | #ffffff |
|
||||
| border-bottom | 1px solid #e7e5e4 |
|
||||
|
||||
**`topnav`**
|
||||
*`topnav`*
|
||||
|
||||
## side_panel
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|------|-----|
|
||||
| background | #f5f5f4 |
|
||||
|
||||
**`side_panel`**
|
||||
*`side_panel`*
|
||||
|
||||
## card_title
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
| font-size | 1.15rem |
|
||||
| margin | 0 0 0.35rem |
|
||||
|
||||
**`card_title`**
|
||||
*`card_title`*
|
||||
|
||||
## card_body
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
| color | #57534e |
|
||||
| margin | 0 |
|
||||
|
||||
**`card_body`**
|
||||
*`card_body`*
|
||||
Reference in new issue
Block a user