bindery-cli 0.61.1__tar.gz → 0.62.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/PKG-INFO +1 -1
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/patchnotes.md +108 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/pyproject.toml +1 -1
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/roadmap.md +2 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/spec.md +5 -3
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/__init__.py +1 -1
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/cli.py +72 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/epub.py +353 -2
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/transforms.py +76 -10
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_cli.py +20 -7
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_epub.py +521 -11
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_flags_real_core.py +104 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_flags_wiring.py +5 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_transforms.py +139 -2
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/uv.lock +1 -1
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/.github/FUNDING.yml +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/.github/workflows/ci.yml +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/.github/workflows/publish.yml +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/.gitignore +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/AGENTS.md +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/LICENSE +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/OBSERVE-RESEARCH.md +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/README.md +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/docs/screenshots/library-sweep.png +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/logo.svg +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/plugin/__init__.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/project.done +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/run_tests.sh +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/scripts/FastSweep.java +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/scripts/build_plugin.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/scripts/fast_sweep.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/__main__.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/audit.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/library.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/observe.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/pagination.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/reserialize.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/validate.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/src/bindery/watermark.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_audit.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_comment_hyphens.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_contamination.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_cover_tocdrift.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_help.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_library.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_matcher_hardening.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_observe.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_pagination.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_plugin.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_reserialize.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_space_renames.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_spine_guard.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_validate.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_version.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_watermark.py +0 -0
- {bindery_cli-0.61.1 → bindery_cli-0.62.1}/tests/test_xml_hardening.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bindery-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.62.1
|
|
4
4
|
Summary: Audit EPUB body text and repair broken EPUBs with deterministic, epubcheck-gated fixes; atomic in-place replacement in a Calibre library.
|
|
5
5
|
Project-URL: Homepage, https://github.com/VirInvictus/bindery-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/VirInvictus/bindery-cli
|
|
@@ -1,5 +1,113 @@
|
|
|
1
1
|
# bindery-cli Patch Notes
|
|
2
2
|
|
|
3
|
+
## v0.62.1 (2026-11-04)
|
|
4
|
+
|
|
5
|
+
### --fix-double-colon-tags: the pseudo-tag escape, and the last fatal's repair
|
|
6
|
+
|
|
7
|
+
An XML name can carry at most one colon (the QName production is
|
|
8
|
+
`(NCName ':')? NCName`), so a pseudo-tag whose name contains `::` is
|
|
9
|
+
never markup -- every occurrence is unescaped author text, and the
|
|
10
|
+
parser dies on it with a fatal RSC-016. The Book of Debugging's C++
|
|
11
|
+
code samples carried exactly that: `std::vector<std::shared_ptr>` with
|
|
12
|
+
the template's closing bracket escaped as `>` but the pseudo-tag
|
|
13
|
+
itself raw, at `EPUB/xhtml/part3.xhtml:399`. It was the library's one
|
|
14
|
+
remaining fatal after the 2026-11-03 wave.
|
|
15
|
+
|
|
16
|
+
The new opt-in flag escapes both ends of the construct, restoring
|
|
17
|
+
exactly the text the author wrote. Real markup is unreachable by
|
|
18
|
+
construction: the double colon lives in the name grammar itself, so no
|
|
19
|
+
legal tag can match, and prose comparisons (`a < b`) never form the
|
|
20
|
+
shape. Nested templates escape inner-first until stable, and the
|
|
21
|
+
trailing `>`s of a fully-escaped nesting stay raw -- legal text that
|
|
22
|
+
renders as `>`. Live on the facility specimen: `1f/15e/0w -> 0f/14e/0w`,
|
|
23
|
+
the gate accepts, and the book opens again. The unmasked residue
|
|
24
|
+
(the OPF-030/048 uid-empty family, the XHTML 1.1 strictness findings
|
|
25
|
+
the fatal was masking, and the `<int>`/`<dbghelp.h>` header-name
|
|
26
|
+
pseudo-tags, which are legal QNames and ride the content-model lane
|
|
27
|
+
rather than this one) is the manual list the observatory tracks.
|
|
28
|
+
|
|
29
|
+
Also closes a spec.md drift the release audit noted: the four v0.62.0
|
|
30
|
+
flags join the structural-repairs inventory (now thirty) and this flag
|
|
31
|
+
joins the safe opt-ins (now five).
|
|
32
|
+
|
|
33
|
+
Suite: 887 tests.
|
|
34
|
+
|
|
35
|
+
## v0.62.0 (2026-11-03)
|
|
36
|
+
|
|
37
|
+
### The observatory batch: three predicate repairs and four new flags
|
|
38
|
+
|
|
39
|
+
The 2026-11-03 whole-library observatory run answered the default pass's
|
|
40
|
+
`0/0/0` (nothing applies, nothing rejects) with two discoveries: twelve
|
|
41
|
+
census codes had never been triaged, and the full `--all` arsenal's 322
|
|
42
|
+
rejections were 283 bundles poisoned by two transforms whose firing
|
|
43
|
+
predicates outran what epubcheck actually polices. This release carries the
|
|
44
|
+
batch that came out of it, every piece verified against epubcheck 5.3 on
|
|
45
|
+
real specimens or minimal matrices before the code moved.
|
|
46
|
+
|
|
47
|
+
**The three predicate repairs** (the playOrder precedent repeating):
|
|
48
|
+
|
|
49
|
+
- `fix_ncx_playorder`'s contract demanded values 1..K; the oracle polices
|
|
50
|
+
sharing, distinctness, and gaps and never the base (Age of Innocence
|
|
51
|
+
validates clean at 0..43; singleton-2, pair-2-3, and offset-5-8 verified).
|
|
52
|
+
The clause is base-free contiguous now, silencing the 107 no-op
|
|
53
|
+
renumberings the observatory measured while keeping every real fix.
|
|
54
|
+
- `fix_pagelist_class` inserts the collision-checked id alongside the
|
|
55
|
+
class: class-only insertion flipped epubcheck into demanding the id on
|
|
56
|
+
the element that had just gained the class (Feel Free: bare pageList
|
|
57
|
+
validates clean, `class="pages"` alone draws RSC-005 'missing required
|
|
58
|
+
attribute "id"', id+class validates fully clean) -- the 215-rejection
|
|
59
|
+
poison. The books that used to regress now measure flat; the ones that
|
|
60
|
+
used to accept still do.
|
|
61
|
+
- `fix_missing_title` fills the self-closed `<title/>`: the paired-fill
|
|
62
|
+
branch was unreachable dead code behind the no-op check, so every
|
|
63
|
+
self-closed shape fell through to injection beside the standing tag
|
|
64
|
+
(the 70-rejection poison; 84 sampled reject docs, all exactly
|
|
65
|
+
`<title/>`, each gaining RSC-005 'element "title" not allowed here').
|
|
66
|
+
|
|
67
|
+
**The four new flags** (the never-triaged census lanes):
|
|
68
|
+
|
|
69
|
+
- `--fix-package-version` (OPF-001, 26 books): rewrites the literal
|
|
70
|
+
`version="1.0"` on the package element to `"2.0"` -- an EPUB version
|
|
71
|
+
epubcheck cannot parse. Refuses everything else: the OEB-1.0-namespace
|
|
72
|
+
package with no version attribute is the designed refusal, and any other
|
|
73
|
+
spelling would be a guess about the producer's intent. Audition
|
|
74
|
+
validates fully clean after the bump.
|
|
75
|
+
- `--fix-doctype` (HTM-004, 135 books): replaces a content document's
|
|
76
|
+
DOCTYPE when it carries a public identifier its package profile forbids
|
|
77
|
+
-- EPUB 3 requires any DOCTYPE to be `<!DOCTYPE html>` (an XHTML 1.x
|
|
78
|
+
public doctype is a spec violation), and EPUB 2's OPS content docs are
|
|
79
|
+
XHTML 1.1 (the Hound-of-the-Baskervilles shape: found 1.0 Strict,
|
|
80
|
+
expected 1.1). Both census shapes verified on facility copies. The
|
|
81
|
+
first build also inserted a DOCTYPE when absent; the whole-library
|
|
82
|
+
firing census measured that flat on ~2,400 of 2,545 firing books -- an
|
|
83
|
+
absent DOCTYPE is legal in both profiles and the oracle tolerates it --
|
|
84
|
+
so insertion was removed before release: the flag fires only where the
|
|
85
|
+
declaration exists and is wrong. A whitespace-variant of the expected
|
|
86
|
+
form is a no-op, and a DOCTYPE carrying an internal subset is never
|
|
87
|
+
touched (the subset declares entities).
|
|
88
|
+
- `--prune-invalid-guide-refs` (OPF-032, 125 books): removes guide
|
|
89
|
+
`<reference>` elements whose target is declared but is not an OPS
|
|
90
|
+
content document -- the Random House `msr` guide block pointing
|
|
91
|
+
cover/thumbimage references at JPEGs is the dominant fingerprint. The
|
|
92
|
+
guide is furniture, so removal is content-neutral; a reference to an
|
|
93
|
+
undeclared file stays OPF-031 (declare-missing's lane), as do external
|
|
94
|
+
schemes and paired elements. Widdershins validates fully clean after
|
|
95
|
+
the prune.
|
|
96
|
+
- `--fix-item-properties` (OPF-014, 74 books): a whole-book census reads
|
|
97
|
+
what each content document contains and merges the tokens into the
|
|
98
|
+
owning manifest item's `properties` attribute, sorted and deduplicated.
|
|
99
|
+
`scripted` from a `<script>` element, an on* handler attribute, or a
|
|
100
|
+
`<form>` -- epubcheck 5.3 demands scripted for form documents, proven
|
|
101
|
+
by tag-off bisection on the Rustonomicon's scraped GitHub page; `svg`
|
|
102
|
+
from an `<svg>` element; `remote-resources` from an absolute-scheme src
|
|
103
|
+
attribute, a remote `<link href>`, or a remote CSS url(). EPUB 3
|
|
104
|
+
packages only: the matrix proved declaring `properties` on an EPUB2
|
|
105
|
+
item draws the illegal-attribute finding while its OPF-014 demand
|
|
106
|
+
stands, so the EPUB2 carriers refuse and stay measured. The census's
|
|
107
|
+
own lane specimen (Rustonomicon) cleared its OPF-014 live.
|
|
108
|
+
|
|
109
|
+
Suite: 878 tests.
|
|
110
|
+
|
|
3
111
|
## v0.61.1 (2026-11-03)
|
|
4
112
|
|
|
5
113
|
### The hex-ref href crash, and the sweep that survives it
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bindery-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.62.1"
|
|
8
8
|
description = "Audit EPUB body text and repair broken EPUBs with deterministic, epubcheck-gated fixes; atomic in-place replacement in a Calibre library."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
classifiers = [
|
|
@@ -55,6 +55,8 @@ The plugin vendors the core and never gates (the epubcheck latency ruling).
|
|
|
55
55
|
| 0.59 | The dangling-NCX prune (issue #23): `--prune-dangling-ncx-targets` removes navPoint/pageTarget elements whose `<content src>` names a document the archive never contained (RSC-007 the manifest prune cannot reach: no item exists for a file the OPF never declared), node-exact over a balanced stack scanner (dead subtree drops as one span, dead parent spliced above live children, scheme/bare-fragment/comment-hidden/contentless refused, unbalanced walk aborts), with the contract-gated playOrder pass re-run in the same branch -- the hand-surgery-plus-second-run rescue is one gate (fixture 0f/1e/0w -> 0f/0e/0w: one navPoint pruned, 389 playOrder values re-sequenced) | v0.59.0 |
|
|
56
56
|
| 0.60 | The oracle budget scales on decimal MB and archive entry count (issue #24): the Summa Theologica (10,440,245 bytes = 9.96 binary MiB, 3,831 entries, 3,808 spine docs, 16,456 playOrder findings) is entry-count-bound, not bytes-bound -- measured 384s source and 445s candidate against the flat 300s its bytes computed (the binary 10 MiB divisor ate the size chunk; the book the docs call 10.4 MB never earned one) -- so every sweep double-timed-out and misfiled it as `(epubcheck timeout)`; the size term counts decimal MB now, the entry term adds +60s per started 500 entries above 1,000 (same 1800s cap), the book computes 720s, and a non-zip path falls back to size-only. epubcheck does police the playOrder contract (2 of the source's 6 RSC-005 error entries): default-pass candidate measures 0f/6e -> 0f/4e (accept), scoped `--all` candidate 0f/0e/0w | v0.60.0 |
|
|
57
57
|
| 0.61.1 | The hex-ref href crash and the sweep that survives it: `_NUMERIC_REF_RE` captured the hex ref's `x` into the digits group and `int('x2013', 16)` killed the first whole-library `--all` dry run (2026-11-03 observe lane; 36 hex-ref hrefs across 5 books, every one an external URL the decode reaches before the scheme check discards it; dormant since v0.58.0 because the resolver is opt-in-path-only); the fix strips the prefix before the int, and the sweep's repair loop gains the crash guard -- an unexpected per-book exception is that book's `error` verdict (`crash (Type): ...; not applied`), counted in the existing errors tally, instead of a run-killing traceback (the single-file verb keeps its traceback) | v0.61.1 |
|
|
58
|
+
| 0.62 | The observatory batch (the 2026-11-03 lane's answers): three predicate repairs -- the playOrder contract goes base-free (epubcheck polices sharing/distinctness/gaps, never the base; 107 no-op renumberings silenced), `fix_pagelist_class` inserts the collision-checked id beside the class (class-only made epubcheck demand the id it enabled; the 215-rejection poison), `fix_missing_title` fills the self-closed `<title/>` (the paired-fill branch was dead code; the 70-rejection poison) -- and four new flags for the never-triaged census codes: `--fix-package-version` (OPF-001; literal 1.0 only), `--fix-doctype` (HTM-004; present-but-forbidden declarations only, after the firing census killed insertion), `--prune-invalid-guide-refs` (OPF-032; declared-but-not-a-content-doc targets), `--fix-item-properties` (OPF-014; EPUB3-only, scripted/svg/remote-resources from a whole-book census) | v0.62.0 |
|
|
59
|
+
| 0.62.1 | `--fix-double-colon-tags`: the pseudo-tag escape for the last library fatal -- an XML name carries at most one colon, so a `::`-named pseudo-tag is never markup (fatal RSC-016; the Book of Debugging's C++ samples), and escaping both ends restores the author's text; nested templates escape inner-first, real markup is unreachable by construction; also closes the spec.md drift (the four v0.62.0 flags had not joined the inventory) | v0.62.1 |
|
|
58
60
|
|
|
59
61
|
## Open work
|
|
60
62
|
|
|
@@ -13,7 +13,7 @@ restyle, re-compress, or restructure content, and it does not attempt to fix arb
|
|
|
13
13
|
schema (RSC-005) violations, which are usually harmless to readers and not safely
|
|
14
14
|
mechanizable.
|
|
15
15
|
|
|
16
|
-
The deliberate exceptions to "semantics-preserving" come in opt-in groups. The
|
|
16
|
+
The deliberate exceptions to "semantics-preserving" come in opt-in groups. The thirty
|
|
17
17
|
**structural repairs** (`--fix-empty-body`, `--fix-missing-title`, `--fix-id-colons`,
|
|
18
18
|
`--fix-page-map`, `--strip-epub3-attrs`, `--downgrade-epub3-tags`,
|
|
19
19
|
`--unwrap-block-in-inline`, `--strip-invalid-value`, `--unwrap-illegal-tags`,
|
|
@@ -23,13 +23,15 @@ The deliberate exceptions to "semantics-preserving" come in opt-in groups. The t
|
|
|
23
23
|
`--fix-svg-dup-ids`, `--fix-duplicate-ids`, `--fix-cdata-terminator`,
|
|
24
24
|
`--fix-misnested-inline`,
|
|
25
25
|
`--fix-stray-close`, `--fix-unterminated-attr`, `--fix-unbound-prefix`,
|
|
26
|
-
`--fix-unique-identifier
|
|
26
|
+
`--fix-unique-identifier`, `--fix-package-version`, `--fix-doctype`,
|
|
27
|
+
`--prune-invalid-guide-refs`, `--fix-item-properties`) alter
|
|
27
28
|
markup structure or fabricate minimal content; the four
|
|
28
29
|
**lossy modes** (`--strip-pagination`, `--strip-broken-tags`, `--strip-watermarks`,
|
|
29
30
|
`--strip-stub-docs`) remove
|
|
30
31
|
content a converter injected rather than content the author wrote. A fourth group of
|
|
31
32
|
**safe opt-ins** (`--fix-ids`, `--add-img-alt`, `--strip-bad-attrs`,
|
|
32
|
-
`--escape-unknown-entities`) repairs without altering
|
|
33
|
+
`--escape-unknown-entities`, `--fix-double-colon-tags`) repairs without altering
|
|
34
|
+
visible markup, and
|
|
33
35
|
`--reserialize` re-parses still-malformed documents whole. The default pass runs
|
|
34
36
|
ONLY the five well-formedness transforms above, the NCX pipeline, and the mimetype
|
|
35
37
|
fix: nothing else. (v0.14–v0.16 briefly
|
|
@@ -11,7 +11,7 @@ Calibre plugin built from this core.
|
|
|
11
11
|
Single source of truth for the version. pyproject.toml must match VERSION below.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
VERSION = "0.
|
|
14
|
+
VERSION = "0.62.1"
|
|
15
15
|
__version__ = VERSION
|
|
16
16
|
|
|
17
17
|
from .epub import RepairReport, repair_epub # noqa: E402
|
|
@@ -109,6 +109,11 @@ def _flags_from_args(args: argparse.Namespace) -> RepairFlags:
|
|
|
109
109
|
unterminated_attr=args.fix_unterminated_attr or all_,
|
|
110
110
|
unbound_prefix=args.fix_unbound_prefix or all_,
|
|
111
111
|
unique_identifier=args.fix_unique_identifier or all_,
|
|
112
|
+
package_version=args.fix_package_version or all_,
|
|
113
|
+
doctype=args.fix_doctype or all_,
|
|
114
|
+
prune_guide_refs=args.prune_invalid_guide_refs or all_,
|
|
115
|
+
item_properties=args.fix_item_properties or all_,
|
|
116
|
+
double_colon_tags=args.fix_double_colon_tags or all_,
|
|
112
117
|
)
|
|
113
118
|
|
|
114
119
|
|
|
@@ -1684,6 +1689,20 @@ _REPAIR_FLAG_TABLE: dict[str, list[tuple[str, str, str]]] = {
|
|
|
1684
1689
|
"DOCTYPE carries an internal subset (which can declare custom "
|
|
1685
1690
|
"entities) are skipped wholesale.",
|
|
1686
1691
|
),
|
|
1692
|
+
(
|
|
1693
|
+
"fix_double_colon_tags",
|
|
1694
|
+
"escape unescaped pseudo-tags whose name carries :: (a fatal QName break)",
|
|
1695
|
+
"escape the < and > around pseudo-tags whose name contains a double "
|
|
1696
|
+
"colon -- an XML name can carry at most one colon (the QName "
|
|
1697
|
+
"production), so such a construct is never markup and the parser "
|
|
1698
|
+
"dies on it with a fatal RSC-016 (C++ code samples like "
|
|
1699
|
+
"`std::vector<std::shared_ptr>` whose converter escaped the "
|
|
1700
|
+
"trailing bracket but not the tag; the Book of Debugging's last "
|
|
1701
|
+
"library fatal). Escaping both ends restores exactly the text the "
|
|
1702
|
+
"author wrote. Real markup is unreachable by construction: the "
|
|
1703
|
+
"double colon lives in the name grammar itself. Nested templates "
|
|
1704
|
+
"escape inner-first until stable.",
|
|
1705
|
+
),
|
|
1687
1706
|
],
|
|
1688
1707
|
"structural repairs: markup and nesting": [
|
|
1689
1708
|
(
|
|
@@ -1977,6 +1996,59 @@ _REPAIR_FLAG_TABLE: dict[str, list[tuple[str, str, str]]] = {
|
|
|
1977
1996
|
"document untouched. Content documents are not touched (their "
|
|
1978
1997
|
"unbound prefixes have the --strip-bad-attrs drop).",
|
|
1979
1998
|
),
|
|
1999
|
+
(
|
|
2000
|
+
"fix_package_version",
|
|
2001
|
+
'rewrite package version="1.0" to "2.0" (OPF-001)',
|
|
2002
|
+
"rewrite a <package> element whose version attribute is the "
|
|
2003
|
+
"literal 1.0 -- an EPUB version epubcheck cannot parse (OPF-001 "
|
|
2004
|
+
"'error when parsing the EPUB version') -- to 2.0, the conformance "
|
|
2005
|
+
"the 2026-11-03 census's 25 carriers were all written to. Refuses "
|
|
2006
|
+
"everything else: a missing attribute (an OEB-1.0-namespace "
|
|
2007
|
+
"package needs a migration, not an attribute bump) or any other "
|
|
2008
|
+
"spelling. The gate decides whether the profile revalidation is "
|
|
2009
|
+
"a real decrease.",
|
|
2010
|
+
),
|
|
2011
|
+
(
|
|
2012
|
+
"fix_doctype",
|
|
2013
|
+
"replace a forbidden DOCTYPE with the profile's expected form (HTM-004)",
|
|
2014
|
+
"replace each content document's DOCTYPE when it carries a public "
|
|
2015
|
+
"identifier its package profile forbids: EPUB 3 requires any "
|
|
2016
|
+
"DOCTYPE to be <!DOCTYPE html> (an XHTML 1.x public doctype is a "
|
|
2017
|
+
"spec violation), and EPUB 2's OPS content docs are XHTML 1.1 (an "
|
|
2018
|
+
"XHTML 1.0 public doctype is the census's second flagged shape). "
|
|
2019
|
+
"A semantically identical declaration with different spacing is "
|
|
2020
|
+
"untouched, an ABSENT DOCTYPE is legal in both profiles and left "
|
|
2021
|
+
"alone (the first whole-library firing census measured insertion "
|
|
2022
|
+
"flat on ~2,400 of 2,545 firing books -- it never converges, "
|
|
2023
|
+
"since an equal book never applies), and a DOCTYPE carrying an "
|
|
2024
|
+
"internal subset is never touched (the subset declares entities; "
|
|
2025
|
+
"swapping it would change what the parser resolves).",
|
|
2026
|
+
),
|
|
2027
|
+
(
|
|
2028
|
+
"prune_invalid_guide_refs",
|
|
2029
|
+
"remove guide references whose target is not a content doc (OPF-032)",
|
|
2030
|
+
"remove guide <reference> elements whose href resolves to a "
|
|
2031
|
+
"manifest item that exists but is not an OPS content document "
|
|
2032
|
+
"(the 2026-11-03 census's 125-book lane: the Random House msr "
|
|
2033
|
+
"guide block pointing cover/thumbimage references at JPEGs). The "
|
|
2034
|
+
"guide is furniture, so removal is content-neutral. A reference "
|
|
2035
|
+
"to an UNDECLARED file is OPF-031 (--declare-missing-items' "
|
|
2036
|
+
"lane) and is left alone, as are external schemes and paired "
|
|
2037
|
+
"elements.",
|
|
2038
|
+
),
|
|
2039
|
+
(
|
|
2040
|
+
"fix_item_properties",
|
|
2041
|
+
"declare scripted/remote-resources on EPUB3 manifest items (OPF-014)",
|
|
2042
|
+
"scan every content document for what epubcheck wants declared "
|
|
2043
|
+
"(OPF-014 'The property X should be declared in the OPF'): a "
|
|
2044
|
+
"<script> element earns `scripted`, an absolute-scheme src, "
|
|
2045
|
+
"remote <link href>, or remote CSS url() earns "
|
|
2046
|
+
"`remote-resources` -- and merge the tokens into the owning "
|
|
2047
|
+
"manifest item's properties attribute, sorted and deduplicated. "
|
|
2048
|
+
"EPUB 3 packages only (properties is EPUB3 vocabulary; below 3 "
|
|
2049
|
+
"the attribute is itself a finding). Declares reality; changes "
|
|
2050
|
+
"no content.",
|
|
2051
|
+
),
|
|
1980
2052
|
],
|
|
1981
2053
|
"lossy strips (these delete converter-injected content; accepted on a no-worse bar)": [
|
|
1982
2054
|
(
|