Files
tepbc-ross-retyped/build.sh
T
bdeshiandClaude Opus 5 05c41040f7 Diacritic corrections, link styling, and a build lock
Eight diacritic corrections at seven sites, each verified against the page
image at 900 dpi:

  p0049  Nastaʿlīq -> Nasta`līq   the mark is a quote, not a ʿayn (Sammay)
  p0072  Cálidás   -> Cálidās
  p0256  Rajākṛṣṇa -> Rājākṛṣṇa
  p0260  Īsvaracandra -> Īśvaracandra  (x2)
  p0430  Iśvaracandra -> Īśvaracandra
  p0430  Gītā -> Gīta  (x2)
  p0430  Munṣī -> Munśī

Found by two nets over the transcription: a rare-character inventory
(U+02BF appeared exactly once in 431 pages — the tell) and a check for
names that appear with more than one accenting, 84 occurrences of which
~32 are now checked. Neither net catches a name mis-transcribed the SAME
way everywhere, so this is a partial sweep, not a clean bill.

The French accents are all handwritten additions in the scan — pen-drawn
cedillas and acutes — applied inconsistently by the author and reproduced
per instance. All of that cluster checks out.

Clickable regions now carry a 0.4pt hairline rule in RGB(95,125,165) on
the Contents/List-of-Plates page numbers and on resolved cross-references;
endnote superscripts and whole-line entries stay unmarked. polish.py emits
\xref for the former and \hyperlink for the latter so the two differ.

Also: plate 1's List-of-Plates entry uses \plx, which build_maps() did not
scan, so plate 1 was the one plate of 178 whose "pl. 1" references never
linked.

build.sh takes an atomic mkdir lock: two builds sharing work/ corrupt
main.aux and produce an error that names the wrong file entirely.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 00:50:04 +06:00

34 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
# Assemble: preamble, title (p0001), colophon, remaining pages in PDF-page order,
# endnotes; compile with XeLaTeX (3 passes: marks/backrefs).
set -e
cd "$(dirname "$0")"
OUT=ross-1988-retypeset.pdf
# Two builds must never share work/: they share main.aux, and the second reads
# the first's half-written copy and dies at \begin{document} with "Undefined
# control sequence" or "File ended while scanning use of \enotez@note" — which
# reads like an unbalanced brace in a page file and is nothing of the kind.
# mkdir is atomic, so it is the lock. The way a second build actually gets
# started is mundane: someone runs `make` again while an earlier build is still
# going. Check `docker ps` before starting one — a build takes several minutes
# and gives no output until it finishes, so a running one is easy to forget.
if ! mkdir work/.buildlock 2>/dev/null; then
echo "build.sh: another build holds work/.buildlock — refusing to start." >&2
echo " check: docker ps (if nothing is running: rmdir work/.buildlock)" >&2
exit 1
fi
trap 'rmdir work/.buildlock 2>/dev/null' EXIT INT TERM
# Three full passes run below regardless, so a stale aux buys nothing.
rm -f work/main.aux work/main.toc work/main.out
python3 tools/polish.py >/dev/null # typographic pass: src/pages -> work/pages
{ cat src/preamble.tex
printf '%s\n' '\begin{document}\immediate\openout\unsurefile=unsure.log\immediate\openout\erratafile=errata.log\immediate\openout\qslipfile=qslips.log'
printf '\\input{%s}\n' work/pages/p0001.tex src/colophon.tex
for f in work/pages/p*.tex; do [ "$f" = work/pages/p0001.tex ] || printf '\\input{%s}\n' "$f"; done
printf '%s\n' '\notesection' '\printerrata' '\immediate\closeout\unsurefile\immediate\closeout\erratafile\immediate\closeout\qslipfile\end{document}'
} > src/main.tex
for i in 1 2; do xelatex -interaction=nonstopmode -halt-on-error -output-directory=work src/main.tex >work/pass$i.log 2>&1 || { grep -E "^!" -A3 work/pass$i.log; exit 1; }; done
xelatex -interaction=nonstopmode -halt-on-error -output-directory=work src/main.tex | grep -E "Overfull|Warning: .*(undefined|multiply)" | sort | uniq -c || true
cp work/main.pdf "$OUT"; cp work/unsure.log . 2>/dev/null || true; cp work/errata.log . 2>/dev/null || true; cp work/qslips.log . 2>/dev/null || true
echo "built $OUT: $(pdfinfo "$OUT" | grep Pages)"