feat(reader): reference page numbers from EPUB page-list with manual page count fallback - #4549
Merged
Conversation
…page count fallback Add a 'Reference Pages' reading progress style that shows physical book page numbers in the footer progress info: - When the book carries a page list (EPUB3 nav page-list or EPUB2 NCX pageList — foliate-js already parses both and resolves the current pageItem on relocate; it was just never consumed), display the current page label and use the highest numeric label as the total, so a trailing roman-numeral index page can't corrupt the total (#672). - When the book has none, a per-book 'Reference Page Count' input appears; the reading fraction is mapped linearly onto the entered count (#4542). The count is saved per book only and never propagates to global view settings. - Falls back to percentage display when neither source is available. Verified with the sample books from #672: Caleb's Crossing (EPUB3 page-list, 419 pages) and Count Zero (EPUB2 NCX pageList/page-map, 346 pages — chapter 2 lands exactly on page 22 per its page-map), plus a stripped no-pagelist copy for the manual-count path (175/350 at 50%). Closes #672 Closes #4542 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dalzyu
added a commit
to dalzyu/readest-hermes
that referenced
this pull request
Jun 18, 2026
…page count fallback (readest#4549)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merges #4542 into #672: a new Reference Pages reading progress style that shows physical-book page numbers in the reader's progress info.
What it does
page-listand the EPUB2 NCXpageListand resolves the currentpageItemon every relocate — it was just never consumed. The footer now shows the current page label, with the total taken from the highest numeric label in the page list, so a trailing roman-numeral entry (e.g. an index page labeled "XII", reported in the FR: Support for Page-Map/Page-List/Reference Pages #672 comments) can't corrupt the total. Non-numeric current labels (front-matter roman numerals) display as-is.ceil(fraction × count), clamped to [1, count]). The count is saved per-book only (skipGlobal) and never propagates to global view settings.Implementation
getReferencePageInfo()pure util inutils/progress.ts(unit-tested, 11 cases)detail.pageItemwired throughprogressRelocateHandler→setProgress→BookProgressBookDoc.pageListtyped; rendering inProgressBar(in-page footer) andDesktopFooterBarprogressStyle: 'reference'option + conditionalNumberInputinLayoutPanel(input hidden when the book has its own page list)Verification (sample EPUBs from #672)
26 / 419, advances on page turns1 / 346; chapter 2 shows22 / 346— exact match withpage-map.xml(Text/c2.html→name="22")1 / 350at start,175 / 350at the 50% jumppnpm test(5282 passed) andpnpm lintclean.Closes #672
Closes #4542
🤖 Generated with Claude Code