internetarchive / internetarchive/bookreader

Page numbering confusion

Open
#43 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
491
Avg merge
2d 15h
Merged PRs (30d)
3

Description

The docs mention using 1 based page numbers in URLs `page/1` instead of 0 based `page/n0`, but it does not seem to work.
https://openlibrary.org/dev/docs/bookurls

The code tries to parse URLs that start with `n` then falls back to a custom page numbering.
[BookReader/BookReader.js#L4502](https://github.com/openlibrary/bookreader/blob/master/BookReader/BookReader.js#L4502)
[BookReader/BookReader.js#L4515](https://github.com/openlibrary/bookreader/blob/master/BookReader/BookReader.js#L4515)

Custom page numbers that are never actually implemented default to `null`, which later falls back to `n0` numbering, which is redundant.
[BookReaderIA/datanode/BookReaderJSIA.php#L277](https://github.com/openlibrary/bookreader/blob/master/BookReaderIA/datanode/BookReaderJSIA.php#L277)
[BookReaderIA/datanode/BookReaderJSIA.php#L349](https://github.com/openlibrary/bookreader/blob/master/BookReaderIA/datanode/BookReaderJSIA.php#L349)
[BookReaderIA/datanode/BookReaderJSIA.php#L549](https://github.com/openlibrary/bookreader/blob/master/BookReaderIA/datanode/BookReaderJSIA.php#L549)

The issue seems to be that the book meta data never contains custom page numbers.
The long term solution would be to actually provide this metadata (probably out of the scope of this repo).
A short term solution would be to fall back to `page/1` or `page/p1` style 1 based indexed page numbers when the custom page numbers are null.

Context:
This ambiguity recently caused some confusion when trying to coordinate a transcription effort. https://github.com/XioNYC/StarRaiders/issues/18

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.