AtlatestRepositorysigil-doc
1
#!/usr/bin/env bash2
set -euo pipefail3
repo_dir="$(cd "$(dirname "$0")/.." && pwd)"4
cd "$repo_dir"5
mkdir -p build6
sigil="${SIGIL_D1_COMPILER:-$repo_dir/../task-sigil-language-readers/build/dev/bin/sigil}"7
redirects="${SIGIL_D1_REDIRECTS:-$repo_dir/dev-redirects.sgl}"8
sigil_sxml_root="${SIGIL_SXML_ROOT:-$repo_dir/../sigil-sxml}"9
cache_dir=$(mktemp -d "$repo_dir/build/d4a-cache.XXXXXX")10
export XDG_CACHE_HOME="$cache_dir"11
export SIGIL_REDIRECTS="$redirects"13
"$sigil" -L "$sigil_sxml_root/src" -L src -L test test \14
test/test-publication-html.sgl test/test-model.sgl test/test-reader.sgl test/test-examples.sgl --report \15
| tee "$cache_dir/publication.log"16
rg -q '37 passed' "$cache_dir/publication.log"17
echo D4A_GATE_01_D0_D2_D3_PUBLICATION_37_3719
# Hidden example checks run real subjects, so they need the executable.20
SIGIL_BIN="$sigil" "$sigil" -L "$sigil_sxml_root/src" -L src -L test test \21
test/test-example-check.sgl --report \22
| tee "$cache_dir/example-check.log"23
rg -q '10 passed' "$cache_dir/example-check.log"24
echo D4A_GATE_01B_EXAMPLE_CHECKS_10_1026
"$sigil" -L "$sigil_sxml_root/src" -L src -L test eval -f test/d4a-trusted-presentation.sgl \27
| tee "$cache_dir/trusted.log"28
rg -q D4A_TRUSTED_PRESENTATION_GREEN "$cache_dir/trusted.log"29
echo D4A_GATE_02_TRUSTED_RESULT31
rg -q '@chapter\["Change the Question" authors:' test/fixtures/practical-sigil-change-question.sgd32
rg -q '@ref \["first-script"\]' test/fixtures/practical-sigil-change-question.sgd33
echo D4A_GATE_03_SECOND_CHAPTER_AUTHORING_CONTRACT35
# The semantic adapter must not grow into a site generator. Press owns these.36
# Subject-existence pins: to `if rg`, a missing file (exit 2) reads as clean37
# (exit 1), so a rename would disarm this boundary sweep silently.38
test -f src/sigil/doc/render/html.sgl39
test -f src/sigil/doc/publication.sgl40
if rg -n -i '<html|<head|stylesheet|site-nav|sitemap|robots\.txt|write-file|copy-file|output-directory' \41
src/sigil/doc/render/html.sgl src/sigil/doc/publication.sgl; then42
echo 'D4A renderer leaked Press/site-generation responsibility' >&243
exit 144
fi45
echo D4A_GATE_04_PRESS_BOUNDARY46
echo D4A_GATE_GREEN