Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bg6jx9vHNHzB91qyV64GQ7
22 lines
1.0 KiB
Bash
Executable File
22 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Builds the external briefs as styled HTML and prints them to docs/external/pdf/ with headless Chrome.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
CHROME="${CHROME:-/Applications/Google Chrome.app/Contents/MacOS/Google Chrome}"
|
|
tmp=$(mktemp -d)
|
|
mkdir -p ../pdf
|
|
|
|
build() { # <md> <out.pdf> <lang> <title> <eyebrow>
|
|
local md=$1 out=$2 lang=$3 title=$4 eyebrow=$5
|
|
PAGE_LANG="$lang" PAGE_TITLE="$title" PAGE_EYEBROW="$eyebrow" node page.mjs "$md" "$tmp/body.html" >/dev/null
|
|
{ echo "<!doctype html><html lang=\"$lang\"><head><meta charset=\"utf-8\"></head><body style=\"margin:0\">"
|
|
cat "$tmp/body.html"; echo "</body></html>"; } > "$tmp/page.html"
|
|
"$CHROME" --headless=new --disable-gpu --no-pdf-header-footer --virtual-time-budget=8000 \
|
|
--print-to-pdf="../pdf/$out" "file://$tmp/page.html" >/dev/null 2>&1
|
|
echo "wrote pdf/$out"
|
|
}
|
|
|
|
build ../architecture-brief.en.md architecture-brief.en.pdf en "VPP AI Platform Brief" ""
|
|
build ../architecture-brief.zh.md architecture-brief.zh.pdf zh "虚拟电厂 AI 平台架构" ""
|
|
rm -rf "$tmp"
|