Add the ledger schema, class router, lint codes, ingest/build pipeline, and three work-tree examples: align derivation, superfig delegation, and supertensor delegation.
58 lines
1.8 KiB
Bash
Executable File
58 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Notes toolchain preflight. 0 = full, 1 = degraded, 2 = no LaTeX engine.
|
|
set -uo pipefail
|
|
|
|
QUIET=0
|
|
[[ "${1:-}" == "--quiet" ]] && QUIET=1
|
|
say() { [[ $QUIET -eq 1 ]] || echo -e "$*"; }
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
ok=0; warn=0; fail=0
|
|
check() {
|
|
local name="$1"; shift
|
|
if "$@" >/dev/null 2>&1; then say " ok $name"; ok=$((ok+1)); return 0
|
|
else say " MISS $name"; return 1; fi
|
|
}
|
|
|
|
say "superpaper preflight"
|
|
say "--- engine ---"
|
|
check "xelatex" command -v xelatex || fail=$((fail+1))
|
|
check "article.cls" kpsewhich article.cls || fail=$((fail+1))
|
|
|
|
say "--- template / CJK ---"
|
|
cjk=0
|
|
for pkg in ctex.sty FandolSong-Regular.otf amsmath.sty amssymb.sty \
|
|
tcolorbox.sty graphicx.sty hyperref.sty geometry.sty \
|
|
listings.sty booktabs.sty subcaption.sty float.sty tikz.sty etoolbox.sty; do
|
|
check "$pkg" kpsewhich "$pkg" || { warn=$((warn+1)); cjk=1; }
|
|
done
|
|
|
|
say "--- python ---"
|
|
PY="$ROOT/scripts/python"
|
|
check "python3" command -v python3 || warn=$((warn+1))
|
|
check "PyYAML" "$PY" -c "import yaml" || warn=$((warn+1))
|
|
check "jsonschema" "$PY" -c "import jsonschema" || warn=$((warn+1))
|
|
|
|
say "--- ingest ---"
|
|
check "pdftotext" command -v pdftotext || warn=$((warn+1))
|
|
check "pdftoppm" command -v pdftoppm || warn=$((warn+1))
|
|
|
|
say "--- optional ---"
|
|
check "magick" command -v magick || true
|
|
check "pdftocairo" command -v pdftocairo || true
|
|
|
|
if [[ $fail -gt 0 ]]; then
|
|
say ""
|
|
say "RESULT: no LaTeX. Deliver ledger + Markdown; no PDF."
|
|
exit 2
|
|
fi
|
|
if [[ $warn -gt 0 ]]; then
|
|
say ""
|
|
say "RESULT: degraded."
|
|
[[ $cjk -eq 1 ]] && say " - missing CJK/template package -> English notes or later Missing character."
|
|
exit 1
|
|
fi
|
|
say ""
|
|
say "RESULT: full notes path (XeLaTeX + CJK + lint)."
|
|
exit 0
|