From 7317a653c78af1117c1ecf67f50bd527b804c518 Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 28 Aug 2026 12:27:57 +0800 Subject: [PATCH] fix(ci): run public pages via bash script with per-file logging Move the Build & export loop into scripts/run-public-pages.sh (explicit bash, skip files without # main) so CI failures show which demo broke. Also quote remaining time/json italic string args. Co-authored-by: Cursor --- .github/workflows/pages.yml | 12 +++--------- public/stdlib/json.mq.md | 2 +- public/stdlib/time.mq.md | 4 ++-- public/stdlib/时间.mq.md | 4 ++-- scripts/run-public-pages.sh | 16 ++++++++++++++++ 5 files changed, 24 insertions(+), 14 deletions(-) create mode 100755 scripts/run-public-pages.sh diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 84259ec..4b69587 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,6 +11,7 @@ on: - "Cargo.lock" - ".github/workflows/pages.yml" - "scripts/build-public.*" + - "scripts/run-public-pages.sh" workflow_dispatch: permissions: @@ -26,15 +27,8 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Build & export site - run: | - cargo build --release - # Skip import helpers and any demo without `# main` (locale-safe; no UTF-8 names in find). - set -e - while IFS= read -r -d '' f; do - grep -q '^# main' "$f" || continue - ./target/release/marqdo run "$f" - done < <(find public -name '*.mq.md' -print0) - ./target/release/marqdo view output public -o public + shell: bash + run: bash scripts/run-public-pages.sh - name: Verify site shape run: | diff --git a/public/stdlib/json.mq.md b/public/stdlib/json.mq.md index fd3e572..35d3faf 100644 --- a/public/stdlib/json.mq.md +++ b/public/stdlib/json.mq.md @@ -8,7 +8,7 @@ import json:lib/json.mq.md Import lib/json.mq.md from both English and Chinese docs (no translated twin). Functions: parse(text), stringify(value), get(value, key), keys(value), quote(text) — JSON string literal with quotes (for building request bodies). Objects become the map runtime type. -*`obj` = > json.parse text={} * +*`obj` = > json.parse text="{}"* *`ty` = > type `obj` * diff --git a/public/stdlib/time.mq.md b/public/stdlib/time.mq.md index b8333cd..b923f5d 100644 --- a/public/stdlib/time.mq.md +++ b/public/stdlib/time.mq.md @@ -8,11 +8,11 @@ import time:lib/time.mq.md Import lib/time.mq.md. Functions: now_unix, now_ms, format(unix, pattern), parse(text, pattern), sleep_ms(ms). Patterns use strftime. -*`s` = > time.format unix=0 pattern=%Y-%m-%d * +*`s` = > time.format unix=0 pattern="%Y-%m-%d"* > print text=`s` -*`u` = > time.parse text=1970-01-01 00:00:00 pattern=%Y-%m-%d %H:%M:%S * +*`u` = > time.parse text="1970-01-01 00:00:00" pattern="%Y-%m-%d %H:%M:%S"* > print text=`u` diff --git a/public/stdlib/时间.mq.md b/public/stdlib/时间.mq.md index 89a97df..ee7e6c7 100644 --- a/public/stdlib/时间.mq.md +++ b/public/stdlib/时间.mq.md @@ -8,11 +8,11 @@ description: Unix 时间、格式化、解析、睡眠 导入 lib/时间.mq.md。函数:此刻秒、此刻毫秒、格式化(秒, 格式)、解析时间(内容, 格式)、睡眠毫秒(毫秒)。格式为 strftime。 -*`s` = > 时间.格式化 秒=0 格式=%Y-%m-%d * +*`s` = > 时间.格式化 秒=0 格式="%Y-%m-%d"* > 打印 内容=`s` -*`u` = > 时间.解析时间 内容=1970-01-01 00:00:00 格式=%Y-%m-%d %H:%M:%S * +*`u` = > 时间.解析时间 内容="1970-01-01 00:00:00" 格式="%Y-%m-%d %H:%M:%S"* > 打印 内容=`u` diff --git a/scripts/run-public-pages.sh b/scripts/run-public-pages.sh new file mode 100755 index 0000000..210fdba --- /dev/null +++ b/scripts/run-public-pages.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Run every public/*.mq.md that defines `# main`, then export the site. +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT" +cargo build --release +BIN=./target/release/marqdo +while IFS= read -r -d '' f; do + if grep -q '^# main' "$f"; then + echo "+ marqdo run $f" + "$BIN" run "$f" + else + echo "- skip (no # main): $f" + fi +done < <(find public -name '*.mq.md' -print0) +"$BIN" view output public -o public