Skip to content

feat(reader): reference page numbers from EPUB page-list with manual page count fallback - #4549

Merged
chrox merged 1 commit into
mainfrom
feat/reference-pages
Jun 12, 2026
Merged

feat(reader): reference page numbers from EPUB page-list with manual page count fallback#4549
chrox merged 1 commit into
mainfrom
feat/reference-pages

Conversation

@chrox

@chrox chrox commented Jun 12, 2026

Copy link
Copy Markdown
Member

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

  • Books with a page list (FR: Support for Page-Map/Page-List/Reference Pages #672): foliate-js already parses the EPUB3 nav page-list and the EPUB2 NCX pageList and resolves the current pageItem on 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.
  • Books without one (FR: Customizable page count for display purposes #4542): a per-book Reference Page Count input appears under the progress style select; the reading fraction is mapped linearly onto the entered count (ceil(fraction × count), clamped to [1, count]). The count is saved per-book only (skipGlobal) and never propagates to global view settings.
  • Falls back to the percentage display when neither source is available.

Implementation

  • getReferencePageInfo() pure util in utils/progress.ts (unit-tested, 11 cases)
  • detail.pageItem wired through progressRelocateHandlersetProgressBookProgress
  • BookDoc.pageList typed; rendering in ProgressBar (in-page footer) and DesktopFooterBar
  • progressStyle: 'reference' option + conditional NumberInput in LayoutPanel (input hidden when the book has its own page list)
  • i18n: 2 new keys translated across all 33 locales

Verification (sample EPUBs from #672)

Book Source Result
Caleb's Crossing EPUB3 nav page-list (419 pages) shows 26 / 419, advances on page turns
Count Zero EPUB2 NCX pageList / page-map (346 pages) cover 1 / 346; chapter 2 shows 22 / 346 — exact match with page-map.xml (Text/c2.htmlname="22")
Caleb's stripped of its page-list none percentage fallback; after entering 350: 1 / 350 at start, 175 / 350 at the 50% jump

pnpm test (5282 passed) and pnpm lint clean.

Closes #672
Closes #4542

🤖 Generated with Claude Code

…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>
@chrox
chrox merged commit 9dc41e7 into main Jun 12, 2026
8 checks passed
@chrox
chrox deleted the feat/reference-pages branch June 12, 2026 06:44
dalzyu added a commit to dalzyu/readest-hermes that referenced this pull request Jun 18, 2026
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.

FR: Customizable page count for display purposes FR: Support for Page-Map/Page-List/Reference Pages

1 participant