Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPUB-defined navigation lists must not reference remote resources #890

Closed
mattgarrish opened this issue Nov 12, 2018 · 6 comments
Closed
Assignees
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: has PR The issue is being processed in a pull request
Milestone

Comments

@mattgarrish
Copy link
Member

The toc, page-list and landmarks navs must reference only in-spine content documents.

All other nav elements can reference both internal and external resources.

Reference: https://w3c.github.io/publ-epub-revision/epub32/spec/epub-packages.html#confreq-nav-a-href-default

@mattgarrish mattgarrish added spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: accepted Ready to be further processed labels Nov 12, 2018
@rdeltour
Copy link
Member

Matt suggested the following Schematron snippet (thanks!):

    <pattern id="no-remote-refs">
        <rule context="html:a[ancestor::html:nav[contains('toc|landmarks|page-list',@epub:type)]]">
            <report test=".[matches(@href, '.+?://')]">Hyperlinks in toc, landmarks and page-list nav elements must not reference resources outside the container</report>
        </rule>
    </pattern>

However we may have a more robust facility in the Java code to test the in-container-ness. In addition, this would allow the message to be localizable (while schematron messages currently aren't).

Let's see if it's easy to do in Java, otherwise we'll fallback to the schematron solution.

@mattgarrish
Copy link
Member Author

mattgarrish commented Jan 13, 2019

Ya, this is probably better done in java as the testing just relies on some protocol at the start.

To be safe it would really need to tokenize the epub:type value, too, so something more like:

html:a[ancestor::html:nav[tokenize(@epub:type)=('toc','landmarks','page-list')]]

@rdeltour rdeltour added this to the 4.2.0-RC milestone Feb 25, 2019
@rdeltour
Copy link
Member

just a clarification: it's not only about remote resources, an embedded (non-top-level) local resource is disallowed too, correct?

@mattgarrish
Copy link
Member Author

If you mean referencing a resource outside of its use within a top-level content document, then no. The fragment identifier has to occur within a top-level content document for the three epub navs.

@rdeltour
Copy link
Member

ok, I think I was confused by the following statement:

For all other nav types, it MAY reference any resource, regardless of whether it is a Publication Resource, or whether it is Local or Remote Resource.

which sounds more open that it is. In reality, it can only reference either Top-level Content Documents or remote resources. Other non-top-level-content-document Publication Resources are disallowed, by virtue of the spine restriction:

All Publication Resources hyperlinked to from the EPUB Navigation Document also MUST be listed in the spine

Maybe the first statement could be made clearer by rewording it to something like:

For all other nav types, it MAY reference Remote Resource.

@mattgarrish
Copy link
Member Author

Yes, that language is a bit overzealous. I think it may have slipped through from earlier discussions, as I seem to recall questions of whether data sets and other items of interest in the container could be listed.

I can't find any evidence that we agreed to loosen it that much, only to allow remote references: w3c/epub-specs#594

rdeltour added a commit that referenced this issue Mar 12, 2019
A new message `NAV_010` (`ERROR`) is reported when a `toc`, `landmarks`,
or `page-list` nav contains links to remote resources.

Fix #890
@rdeltour rdeltour added status: has PR The issue is being processed in a pull request and removed status: accepted Ready to be further processed labels Mar 12, 2019
rdeltour added a commit that referenced this issue Mar 12, 2019
A new message `NAV_010` (`ERROR`) is reported when a `toc`, `landmarks`,
or `page-list` nav contains links to remote resources.

Fix #890
@rdeltour rdeltour self-assigned this Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec: EPUB 3.2 Impacting the support of EPUB 3.2 status: has PR The issue is being processed in a pull request
Projects
None yet
Development

No branches or pull requests

2 participants