Files
Vijay Janapa Reddi 7abd633fb2 refactor(binder): consolidate legacy validate_epub.py into smoke scope
The legacy `book/tools/scripts/utilities/validate_epub.py` duplicated
most of what epubcheck covers (mimetype, container.xml, OPF structure,
XHTML well-formedness, unclosed tags, unescaped ampersands) and had a
pre-existing broken exit code that made it unusable in the default
`./binder check epub` run.

Two of its checks were genuinely unique — CSS custom properties and
external resource references. Those patterns produce real user-
reported breakage on older readers (ClearView / Tolino firmware pre-
2023) that epubcheck does not flag because they are valid EPUB 3
spec. Those unique checks now live in _epub_checks.py as
`run_smoke_checks_on()`, exposed via the new scope:

    ./binder check epub --scope smoke

Smoke runs in <1s, does not require Java, and fails on detection
(error severity) because the patterns caused real load failures.

Default `./binder check epub` now runs three scopes in order:

    hygiene   (source, pre-build)
    smoke     (built EPUB, reader compat, no Java)
    epubcheck (built EPUB, W3C validation, needs Java)

Together they form a three-layer defense: source, built-EPUB without
Java, built-EPUB with Java. A regression has to escape all three to
reach a reader.

Removed
-------
book/tools/scripts/utilities/validate_epub.py — duplicate of epubcheck
plus two unique checks now owned by _epub_checks.py.

Validation
----------
  ./binder check epub             → 0 issues, 3 scopes run, ~7s
  ./binder check epub --scope smoke → 0 issues, ~200ms
2026-04-20 16:13:47 -04:00
..

Utility Scripts

General-purpose utility scripts for validation and checking.

Scripts

  • check_sources.py - Comprehensive source file validation
  • check_ascii.py - Check for non-ASCII characters
  • check_images.py - Validate image files and references
  • fix_titles.py - Fix title formatting
  • analyze_footnotes.sh - Analyze footnotes
  • count_footnotes.sh - Count footnotes

Quick Usage

# Validate source files
python check_sources.py

# Check for encoding issues
python check_ascii.py

# Validate images
python check_images.py