readium / webpub-manifest

📜 A JSON based Web Publication Manifest format used at the core of the Readium project
BSD 3-Clause "New" or "Revised" License
91 stars 23 forks source link

TOC entries with no `href` just `title` #60

Open jccr opened 4 years ago

jccr commented 4 years ago

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 commented 4 years ago

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"
      }
    ]
  }
]
qnga commented 4 years ago

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

On mobile platforms, we arbitrarily use "#".

mickael-menu commented 4 years ago

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.

HadrienGardeur commented 3 months ago

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