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
@@ -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`*
|
||||
Reference in new issue
Block a user