- Bracket ink is part of the fit: \st@facebody drops -inkw/-inke extreme coordinates and \stface/\ststack register them with the enclosing group/col/row fit, so a group outline can no longer be crossed by a member's bracket arms - \stlink inside \stgroup or \stcol is now a package error: sub-flow members never terminate a pending connector, so the arrow was dropped silently while the label still rendered - \stgroup requires role= (explicit role=neutral for mixed groups) and must bind at least two members or one \stcol partition; a lone stack or face inside a group is a dirty-build warning - lint: default budget is one \stcallout per figure; the allow-multiple-callouts directive relaxes it to one per band - build.sh: clean-build hint no longer names hue budget (lint owns it) - tests/group-callout.tex reworked: multi-member group with a bracketed member as a regression probe, single callout; new negative fixtures group-link, group-norole, group-single, callout-budget - api.md, checklist.md, style.md, layout.md, SKILL.md updated to match
80 lines
2.9 KiB
Bash
Executable File
80 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Lint, compile, and export every delivery artifact for a supertensor figure.
|
|
#
|
|
# ./scripts/build.sh figure.tex [outdir]
|
|
#
|
|
# Produces in outdir (default: alongside the source, in build/):
|
|
# figure.pdf vector master
|
|
# figure.svg vector, for slides/web
|
|
# figure.png white background, 300 dpi <- inspect this one
|
|
# figure-alpha.png transparent background
|
|
# figure-thumb.png 360 px wide <- inspect this for the color/hue audit
|
|
#
|
|
# The build FAILS on silent-corruption signals, not only on TeX errors:
|
|
# missing CJK glyphs and overfull boxes both produce figures that compile
|
|
# happily and read wrong.
|
|
set -euo pipefail
|
|
|
|
SRC="${1:?usage: build.sh figure.tex [outdir]}"
|
|
[[ -f "$SRC" ]] || { echo "no such file: $SRC" >&2; exit 2; }
|
|
SRCDIR="$(cd "$(dirname "$SRC")" && pwd)"
|
|
BASE="$(basename "$SRC" .tex)"
|
|
OUT="${2:-$SRCDIR/build}"
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
mkdir -p "$OUT"
|
|
|
|
if [[ "${ST_SKIP_LINT:-0}" != "1" ]]; then
|
|
echo "==> lint $BASE"
|
|
python3 "$ROOT/scripts/lint.py" "$SRC"
|
|
fi
|
|
|
|
echo "==> xelatex $BASE"
|
|
# supertensor.sty lives in assets/; keep it off the user's texmf tree.
|
|
TEXINPUTS="$ROOT/assets:$SRCDIR:" \
|
|
xelatex -halt-on-error -interaction=nonstopmode \
|
|
-output-directory="$OUT" "$SRC" >/dev/null 2>&1 \
|
|
|| { echo "!! xelatex failed; last errors:" >&2
|
|
grep -n -A4 -m3 '^!' "$OUT/$BASE.log" >&2 || tail -30 "$OUT/$BASE.log" >&2
|
|
exit 1; }
|
|
|
|
LOG="$OUT/$BASE.log"
|
|
status=0
|
|
|
|
if grep -q "Missing character" "$LOG"; then
|
|
echo "!! missing glyphs (CJK font not applied?):" >&2
|
|
grep -m5 "Missing character" "$LOG" >&2
|
|
status=1
|
|
fi
|
|
if grep -qE "^(Overfull|Underfull) \\\\[hv]box" "$LOG"; then
|
|
echo "!! overfull/underfull boxes -- text is escaping its reserved lane:" >&2
|
|
grep -m5 -E "^(Overfull|Underfull) \\\\[hv]box" "$LOG" >&2
|
|
status=1
|
|
fi
|
|
if grep -q "Package supertensor Warning" "$LOG"; then
|
|
echo "!! supertensor warnings:" >&2
|
|
grep -m5 -A2 "Package supertensor Warning" "$LOG" >&2
|
|
status=1
|
|
fi
|
|
|
|
if command -v pdftocairo >/dev/null 2>&1; then
|
|
echo "==> exporting svg / png"
|
|
pdftocairo -svg "$OUT/$BASE.pdf" "$OUT/$BASE.svg"
|
|
pdftocairo -png -r 300 -singlefile "$OUT/$BASE.pdf" "$OUT/$BASE"
|
|
pdftocairo -png -r 300 -singlefile -transp "$OUT/$BASE.pdf" "$OUT/$BASE-alpha"
|
|
pdftocairo -png -scale-to-x 360 -scale-to-y -1 -singlefile \
|
|
"$OUT/$BASE.pdf" "$OUT/$BASE-thumb"
|
|
else
|
|
echo "!! pdftocairo missing: PDF only, no SVG/PNG" >&2
|
|
status=1
|
|
fi
|
|
|
|
echo "==> artifacts in $OUT"
|
|
ls -1 "$OUT/$BASE"*.{pdf,svg,png} 2>/dev/null | sed 's/^/ /'
|
|
if [[ $status -ne 0 ]]; then
|
|
echo "==> BUILD DIRTY: fix the warnings above before delivering." >&2
|
|
else
|
|
echo "==> clean. Now do the visual audit (references/checklist.md) --"
|
|
echo " a clean build says nothing about collisions or thumbnail legibility."
|
|
fi
|
|
exit $status
|