mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 03:27:10 +00:00
docs: pandoc-based site and v0.1.0 groundwork (#5)
* chore(prose): remove em-dashes from config files * chore(prose): remove em-dashes from android sdk config * docs(spec-api): remove em-dash from README * fix(doctor): reword sidecar-jar error without em-dash * test(sidecar): reword assertion message without em-dash * docs: add CLAUDE.md with project conventions * build: add docs target for pandoc site * docs(site): add pandoc template and stylesheet * docs(site): add pandoc build script * docs(site): add landing pages * docs(manual): add getting-started * docs(manual): add writing-specs * docs(manual): add runs * docs(manual): add cli reference * docs(dev): add design principles * docs(dev): add architecture * ci: deploy docs site to github pages * docs: rewrite README as entry point to docs site
This commit is contained in:
25 files changed
+920
-56
No files matched your search
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the uatu docs site using pandoc.
|
||||
# Outputs static HTML to build/site/ ready for GitHub Pages.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC="$REPO_ROOT/docs"
|
||||
OUT="$REPO_ROOT/build/site"
|
||||
TEMPLATE="$SRC/_template/page.html"
|
||||
ASSETS="$SRC/_assets"
|
||||
|
||||
if ! command -v pandoc >/dev/null 2>&1; then
|
||||
echo "pandoc not found on PATH. Install from https://pandoc.org/ or 'brew install pandoc'." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$OUT"
|
||||
mkdir -p "$OUT/_assets"
|
||||
cp -R "$ASSETS"/. "$OUT/_assets/"
|
||||
|
||||
build_one() {
|
||||
local src="$1"
|
||||
local rel="${src#$SRC/}"
|
||||
local out="$OUT/${rel%.md}.html"
|
||||
local dir; dir=$(dirname "$rel")
|
||||
|
||||
local root=""
|
||||
if [ "$dir" != "." ]; then
|
||||
local depth; depth=$(awk -F/ '{print NF}' <<< "$dir")
|
||||
for ((i = 0; i < depth; i++)); do root="../$root"; done
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$out")"
|
||||
pandoc "$src" \
|
||||
--from=gfm \
|
||||
--to=html5 \
|
||||
--standalone \
|
||||
--highlight-style=tango \
|
||||
--template="$TEMPLATE" \
|
||||
-o "$out"
|
||||
|
||||
# macOS sed and GNU sed both accept `-i.bak + rm`; avoids `-i ''` portability issues.
|
||||
sed -i.bak "s|__ROOT__|$root|g" "$out" && rm "$out.bak"
|
||||
}
|
||||
|
||||
count=0
|
||||
while IFS= read -r -d '' f; do
|
||||
build_one "$f"
|
||||
count=$((count + 1))
|
||||
done < <(find "$SRC" -type f -name '*.md' -not -path "$SRC/_*" -print0)
|
||||
|
||||
echo "built $count pages to $OUT"
|
||||
Reference in new issue
Block a user