webpub-manifest icon indicating copy to clipboard operation
webpub-manifest copied to clipboard

TOC entries with no `href` just `title`

Open jccr opened this issue 5 years ago • 4 comments

When looking at data from the EPUB context: The EPUB spec allows you to have navigation document headings be "link-less".

For example:

<ol>
  …
  <li>
    <span>Appendix</span>
    <ol>
      <li>
        <a href="appendix.xhtml#a.1-birds">A.1 Birds</a>
      </li>
      <li>
        <a href="appendix.xhtml#a.2-turtles">A.2 Turtles</a>
      </li>
    </ol>
  </li>
</ol>

How would someone represent this data as a RWPM ToC compact subcollection? Given that the items are Link objects that require an href attribute.

My only idea right now is to have the href value be a blank string.

The resulting collection would look like this:

"toc": [
  {
    "href": "",
    "title": "Appendix",
    "children": [
      {
        "href": "appendix.xhtml#a.1-birds",
        "title": "A.1 Birds"
      },
      {
        "href": "appendix.xhtml#a.2-turtles",
        "title": "A.2 Turtles"
      }
    ]
  }
]

jccr avatar May 11 '20 21:05 jccr

Another idea is that it takes the href without fragments.. somehow.. it's ambiguous...

The resulting collection would look like this:

"toc": [
  {
    "href": "appendix.xhtml",
    "title": "Appendix",
    "children": [
      {
        "href": "appendix.xhtml#a.1-birds",
        "title": "A.1 Birds"
      },
      {
        "href": "appendix.xhtml#a.2-turtles",
        "title": "A.2 Turtles"
      }
    ]
  }
]

jccr avatar May 11 '20 21:05 jccr

My only idea right now is to have the href value be a blank string.

On mobile platforms, we arbitrarily use "#".

qnga avatar May 12 '20 04:05 qnga

On mobile platforms, we arbitrarily use "#".

Yes, I felt somehow that at least it was a valid HREF, but it's not great. Maybe a blank string is better, I'm not sure.

Another idea is that it takes the href without fragments.. somehow.. it's ambiguous...

I don't think that we can guarantee that all children are in the same resource though.

mickael-menu avatar May 12 '20 07:05 mickael-menu

Another option would be to drop this requirement for Link Objects listed in toc.

HadrienGardeur avatar Jun 21 '24 15:06 HadrienGardeur