mirror of
https://github.com/openmlsys/openmlsys-zh.git
synced 2026-04-01 01:41:17 +08:00
Move the English root site to mdBook, keep the Chinese site as a sub-book, and update CI/deploy to publish .mdbook outputs to docs/ and docs/cn/. Also add regression coverage for placeholder skipping, publish-tree assembly, and shared resource setup.
24 lines
748 B
Bash
24 lines
748 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PYTHON_BIN="$(command -v python3 || command -v python || true)"
|
|
|
|
if [[ -z "${PYTHON_BIN}" ]]; then
|
|
echo "Python is required to prepare the mdBook staging tree." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v mdbook >/dev/null 2>&1; then
|
|
echo "mdbook is not installed. Install it first, for example with: cargo install mdbook" >&2
|
|
exit 1
|
|
fi
|
|
|
|
"${PYTHON_BIN}" "${ROOT}/tools/ensure_book_resources.py" --chapter-dir "${ROOT}/en_chapters"
|
|
"${PYTHON_BIN}" "${ROOT}/tools/prepare_mdbook.py" \
|
|
--source "${ROOT}/en_chapters" \
|
|
--summary-output "${ROOT}/en_chapters/SUMMARY.md" \
|
|
--placeholder-prefix "[TODO: src = zh_chapters/"
|
|
|
|
mdbook build "${ROOT}"
|