Add source linter, negative test fixtures, and fallback guidance

- scripts/lint.py: reject raw rectangles, absolute coordinates, hue-budget
  and callout/group/formula-order violations at the source level
- tests/invalid/ + tests/lint-invalid/: negative fixtures proving the
  package and linter reject bad input; test.sh now runs both directions
- references/fallback.md: degraded path when no LaTeX is available
- tests/group-callout.tex: exercise \stgroup and \stcallout
- agents/openai.yaml: agent config
- Docs and .sty updated to match
This commit is contained in:
dela
2026-08-05 16:41:22 +08:00
parent 7b59c81d02
commit 866173a831
34 changed files with 786 additions and 54 deletions
+11 -7
View File
@@ -12,7 +12,7 @@ QUIET=0
[[ "${1:-}" == "--quiet" ]] && QUIET=1
say() { [[ $QUIET -eq 1 ]] || echo -e "$*"; }
ok=0; warn=0; fail=0
ok=0; warn=0; fail=0; cjk_warn=0; export_warn=0
check() { # name, command
local name="$1"; shift
if "$@" >/dev/null 2>&1; then say " ok $name"; ok=$((ok+1)); return 0
@@ -27,11 +27,11 @@ check "tikz.sty" kpsewhich tikz.sty || fail=$((fail+1))
check "xstring.sty" kpsewhich xstring.sty || fail=$((fail+1))
say "--- chinese figures ---"
check "ctex.sty" kpsewhich ctex.sty || warn=$((warn+1))
check "fandol font" kpsewhich FandolSong-Regular.otf || warn=$((warn+1))
check "ctex.sty" kpsewhich ctex.sty || { warn=$((warn+1)); cjk_warn=1; }
check "fandol font" kpsewhich FandolSong-Regular.otf || { warn=$((warn+1)); cjk_warn=1; }
say "--- raster / vector export ---"
check "pdftocairo" command -v pdftocairo || warn=$((warn+1))
check "pdftocairo" command -v pdftocairo || { warn=$((warn+1)); export_warn=1; }
check "latexmk (optional)" command -v latexmk || true
if [[ $fail -gt 0 ]]; then
@@ -44,9 +44,13 @@ fi
if [[ $warn -gt 0 ]]; then
say ""
say "RESULT: degraded."
say " - missing ctex/fandol -> English-label figures only; do not substitute"
say " an OS-specific CJK font without telling the user it costs portability."
say " - missing pdftocairo -> deliver PDF only, and say PNG/SVG were skipped."
if [[ $cjk_warn -eq 1 ]]; then
say " - missing ctex/fandol -> English-label figures only; do not substitute"
say " an OS-specific CJK font without telling the user it costs portability."
fi
if [[ $export_warn -eq 1 ]]; then
say " - missing pdftocairo -> deliver PDF only, and say PNG/SVG were skipped."
fi
exit 1
fi
say ""