Skip to content

Fix EPUB reading order when navigation documents are outside the spine - #420

Merged
cary-rowen merged 2 commits into
blindpandas:developfrom
cary-rowen:fix/epub-spine-order-419
Aug 8, 2026
Merged

Fix EPUB reading order when navigation documents are outside the spine#420
cary-rowen merged 2 commits into
blindpandas:developfrom
cary-rowen:fix/epub-spine-order-419

Conversation

@cary-rowen

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #419

Summary of the issue:

Some EPUB 3 books are read in manifest order instead of spine order when the manifest contains an XHTML document that is not referenced by the spine, commonly nav.xhtml. This can cause chapters to appear in the wrong order and navigation content to be included in the book text.

Description of how this pull request fixes the issue:

Builds a manifest ID lookup once and processes documents in spine order with linear complexity.

Non-spine navigation documents are excluded from the reading content, while other auxiliary XHTML documents remain available after the main reading order. Partially invalid spine entries are skipped with a warning, and manifest order remains as a fallback when no usable spine entries exist.

The preprocessed HTML cache version is updated so previously cached books are rebuilt with the corrected order.

Testing performed:

Known issues with pull request:

None known.

@cary-rowen
cary-rowen marked this pull request as ready for review August 7, 2026 02:50
@cary-rowen

Copy link
Copy Markdown
Collaborator Author

cc @tamaracpadilha

@cary-rowen
cary-rowen merged commit f91913d into blindpandas:develop Aug 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EPUB sections are read in wrong order: spine sort is silently abandoned when a manifest document is not in the spine (nav.xhtml)

1 participant