Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check that toc & page-list nav are in reading order
New Message: - `NAV_011` (`ERROR`) is reported when the links in `toc` and `page-list` `nav` (in the Navigation Document) do not follow the reading order (i.e. spine order + order of IDs in the Content Documents). Checking logic for `NAV_011`: 1. collect the nav links as references in `XRefChecker` 2. check the reading order consistency in `XRefChecker.checkReferences` (ran after all documents have been parsed and validated) Internal changes: - In the `PathUtil` utilities: - rename the `removeAnchor` method to `removeFragment` - add a new `getFragment` method - In the `OPFItem` class: - for spine items, record their position in the spine - add a new public `getSpinePosition()` getter - In the `XRefChecker` class: - add a new `getResource(path)` public method to get an `OPFItem` for a given path. - add a new `getAnchorPosition(id)` method to the internal `Resource` class. - some registered references are duplicates of already-registered references, with a specific reference type (e.g. a Nav Doc link is registered both as a HYPERLINK and as a NAV_TOC_LINK): these subtypes are now checked in separate private methods, to keep the main `checkReference(Reference)` method pristine. - add a new `checkReadingOrder(Queue, int, int)` private method which processes a queue of references (along with the last known spine position and fragment position) and check they are in reading order - add new tests for the Navigation Document reading order check - fix existing tests Fix #888
- Loading branch information