diff --git a/src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java b/src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java index 7e481440c..9f63ab7bb 100644 --- a/src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java +++ b/src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java @@ -448,7 +448,7 @@ else if (name.equals("blockquote") || name.equals("q") || name.equals("ins") private void checkCiteAttribute() { - URL url = checkResourceURL(currentElement().getAttribute("cite")); + URL url = checkURL(currentElement().getAttribute("cite")); registerReference(url, Type.CITE); } diff --git a/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java b/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java index 214750a42..c4c91a9f6 100755 --- a/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java +++ b/src/main/java/org/w3c/epubcheck/core/references/ResourceReferencesChecker.java @@ -177,7 +177,7 @@ else if (MIMEType.SVG.is(targetMimetype) && !fragment.isValid()) report.message(MessageId.RSC_012, reference.location.context(reference.url.toString())); throw new CheckAbortException(); } - + switch (reference.type) { case SVG_PAINT: @@ -189,6 +189,7 @@ else if (MIMEType.SVG.is(targetMimetype) && !fragment.isValid()) } break; case SVG_SYMBOL: + case CITE: case HYPERLINK: case OVERLAY_TEXT_LINK: if (targetIDType != reference.type && targetIDType != Reference.Type.GENERIC) @@ -334,7 +335,8 @@ else if (!undeclared.contains(reference.targetResource) // links and remote hyperlinks are not Publication Resources && !(reference.type == Reference.Type.LINK || container.isRemote(reference.targetResource) - && reference.type == Reference.Type.HYPERLINK)) + && (reference.type == Reference.Type.HYPERLINK + || reference.type == Reference.Type.CITE))) { undeclared.add(reference.targetResource); report.message(MessageId.RSC_008, reference.location, @@ -351,7 +353,8 @@ private void checkRemoteReference(Reference reference, Optional target // Check if the remote reference is allowed if (// remote links and hyperlinks are not Publication Resources - !EnumSet.of(Reference.Type.LINK, Reference.Type.HYPERLINK).contains(reference.type) + !EnumSet.of(Reference.Type.CITE, Reference.Type.LINK, Reference.Type.HYPERLINK) + .contains(reference.type) // spine items are checked in OPFChecker30 && !(version == EPUBVersion.VERSION_3 && targetResource.isPresent() && targetResource.get().isInSpine()) diff --git a/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/content_001.xhtml b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/content_001.xhtml new file mode 100644 index 000000000..e10cd67c0 --- /dev/null +++ b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/content_001.xhtml @@ -0,0 +1,12 @@ + + + + + Minimal EPUB + + +

Loomings

+

Call me Ishmael.

+ text + + diff --git a/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/nav.xhtml b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/nav.xhtml new file mode 100644 index 000000000..240745e63 --- /dev/null +++ b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/nav.xhtml @@ -0,0 +1,14 @@ + + + + + Minimal Nav + + + + + diff --git a/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/package.opf b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/package.opf new file mode 100644 index 000000000..0d1eec6e9 --- /dev/null +++ b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/EPUB/package.opf @@ -0,0 +1,16 @@ + + + + Minimal EPUB 3.0 + en + NOID + 2017-06-14T00:00:01Z + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/META-INF/container.xml b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/META-INF/container.xml new file mode 100644 index 000000000..318782179 --- /dev/null +++ b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/META-INF/container.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/mimetype b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/mimetype new file mode 100644 index 000000000..57ef03f24 --- /dev/null +++ b/src/test/resources/epub3/04-ocf/files/url-xhtml-cite-absolute-valid/mimetype @@ -0,0 +1 @@ +application/epub+zip \ No newline at end of file diff --git a/src/test/resources/epub3/04-ocf/ocf.feature b/src/test/resources/epub3/04-ocf/ocf.feature index b5c11175c..fb5333437 100644 --- a/src/test/resources/epub3/04-ocf/ocf.feature +++ b/src/test/resources/epub3/04-ocf/ocf.feature @@ -156,8 +156,12 @@ Feature: EPUB 3 — Open Container Format #### resource existence checks: + Scenario: Allow an absolute `cite` URL + When checking EPUB 'url-xhtml-cite-absolute-valid' + Then no errors or warnings are reported + @spec @xref:sec-container-iri - Scenario: Report a reference from an XHTML `cite` attribute not declared in the manifest + Scenario: Report a relative `cite` URL when the resource is not found in the manifest When checking EPUB 'url-xhtml-cite-missing-resource-error' Then error RSC-007 is reported 4 times And no other errors or warnings are reported @@ -168,7 +172,7 @@ Feature: EPUB 3 — Open Container Format Then error RSC-007 is reported And no other errors or warnings are reported - @spec @xref:sec-exempt-resources + @spec @xref:sec-container-iri Scenario: Report a reference from an XHTML `track` not declared in the manifest When checking EPUB 'url-xhtml-track-missing-resource-error' Then error RSC-007 is reported