readium / go-toolkit

A toolkit for ebooks, audiobooks and comics written in Go

Home Page:https://readium.org/web

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle self-referencing link in navigation document

banux opened this issue · comments

There case where the landmarks link reference a anchor link in the navigation document like #toc.

This is related to #3

In a navigation document, it's possible to refer for a link to refer to the current document. For example a landmark can refer to a table of content contained in the same document.

This means that we could end up with the following thing in the manifest:

"landmarks": [
  {
   "href": "#toc",
   "title": "Table of Contents"
  },
  {
   "href": "chapter_001.xhtml",
   "title": "Begin Reading"
  },
  {
   "href": "copyright.xhtml",
   "title": "Copyright Page"
  }
 ]

We need to make sure that when we extract info from the navigation, such fragments are rewritten to point to the navigation document (nav.xhtml#toc instead of #toc).

cc @camill-a since this can be relevant for the Swift implementation too