Skip to content

fix: volume and part divider pages no longer count as chapters - #46

Merged
Jatin-Roopchandani merged 1 commit into
mainfrom
chapter-numbers
Dec 1, 2026
Merged

Jatin-Roopchandani merged 1 commit into
mainfrom
chapter-numbers

Conversation

@Jatin-Roopchandani

Copy link
Copy Markdown
Owner

A reader on The Count of Monte Cristo (added through Free classics) found every chapter number two too high: the reading-progress picker showed "Chapter 66. Matrimonial Projects" as 68.

Cause: the book's "VOLUME TWO" … "VOLUME FIVE" pages (each just the heading) are separate sections, classified as story and numbered as chapters. A Study in Scarlet's "PART I." / "PART II." pages did the same, so the sample book was off too.

Fix: story_chapters leaves out a story section whose heading starts with Volume/Part/Book and that has under SHORT_CHARS (500) characters of text. A "Part" that holds a whole chapter's text is still a chapter. A position stored on a divider reads as the chapter before it. It's decided when the list is read, so existing libraries are corrected without reprocessing.

Verified on the real files: Monte Cristo (the exact Gutenberg EPUB on the server) now has 117 chapters, with 66 = Matrimonial Projects and 67 = The Office of the King's Attorney, matching the book. A Study in Scarlet has 14.

Tests: a new divider test, plus 186 tests across reading position, matter, recaps and KOSync.

Monte Cristo's "VOLUME TWO" ... "VOLUME FIVE" pages (just the heading) were numbered as chapters, so the reading-progress picker showed "Chapter 66. Matrimonial Projects" as 68 (reported by a reader, 2026-12-01). A Study in Scarlet's "PART I." pages did the same. story_chapters now leaves out a story section whose heading is Volume/Part/Book over less than SHORT_CHARS of text; a position stored on one reads as the chapter before it. Decided when the list is read, so existing libraries are corrected without reprocessing. Monte Cristo now has its 117 chapters, A Study in Scarlet its 14.
@Jatin-Roopchandani
Jatin-Roopchandani merged commit eaee6be into main Dec 1, 2026
10 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.

1 participant