From edc8b3b4a19ae4067723d21b6cac11b58bd83e72 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Sat, 13 Nov 2021 17:07:29 +0100 Subject: [PATCH] feat: do not check conformance of SVG content EPUB 3.3 no longer requires that SVG content conforms to SVG content model requirements, only that they are well-formed, that ID are uniques, and that they respect some additional EPUB-specific requirements. This commit: * introduces a new permissive RelaxNG schema for SVG, checking only the EPUB-specific requirements on the `title` and `foreignObject` content model see w3c/epub-specs#1323 * removes checks on the value of the `requiredExtensions` attribute of `foreignObject` see w3c/epub-specs#1087 * adapts the main XHTML to SVG schema driver to the new permissive SVG schema * adds various tests for EPUB-specific requirements --- .../epubcheck/schema/30/epub-svg-30.nvdl | 19 +----- .../adobe/epubcheck/schema/30/epub-svg-30.rnc | 18 ++++- .../adobe/epubcheck/schema/30/epub-svg-30.sch | 4 -- .../epubcheck/schema/30/epub-xhtml-30.rnc | 18 +++-- .../epubcheck/schema/30/epub-xhtml-30.sch | 2 - .../epubcheck/schema/30/epub30-catalog.xml | 10 +-- .../epubcheck/schema/30/mod/epub-svg-inc.rnc | 39 +++++++++++ .../epubcheck/schema/30/mod/epub-svg11-re.sch | 7 -- .../epubcheck/schema/30/mod/epub-svg11.rnc | 40 ----------- .../epub3/content-document-svg.feature | 57 +++++++++++++--- .../epub3/content-document-xhtml.feature | 68 +++++++++++++------ .../foreignObject-html-invalid-error.svg | 13 ++++ .../foreignObject-multiple-body-error.svg | 19 ++++-- .../foreignObject-non-html-content-error.svg | 11 --- .../foreignObject-not-flow-content-error.svg | 13 ++++ .../foreignObject-not-html-error.svg | 13 ++++ ...eignObject-requiredExtensions-ns-error.svg | 9 --- ...foreignObject-requiredExtensions-valid.svg | 13 ++++ .../foreignObject-valid.svg | 15 ++-- .../content-document-svg/id-invalid-error.svg | 5 ++ .../title-html-invalid-error.svg | 5 ++ .../title-not-phrasing-content-error.svg | 5 ++ .../title-phrasing-content-valid.svg | 5 ++ .../content-document-svg/title-text-valid.svg | 5 ++ ...svg-foreignObject-html-invalid-error.xhtml | 19 ++++++ .../svg-foreignObject-no-flow-error.xhtml | 22 ------ ...foreignObject-not-flow-content-error.xhtml | 19 ++++++ ...eignObject-requiredExtensions-valid.xhtml} | 10 +-- .../svg-foreignObject-valid.xhtml | 32 ++++----- .../content-document-xhtml/svg-id-valid.xhtml | 14 ++++ ...vg-error.xhtml => svg-invalid-usage.xhtml} | 7 +- .../svg-links-valid.xhtml | 26 ------- .../svg-regression-valid.xhtml | 17 +++++ .../svg-rel-attribute-valid.xhtml | 18 +++++ .../svg-title-html-invalid-error.xhtml | 15 ++++ ...svg-title-not-phrasing-content-error.xhtml | 15 ++++ .../svg-title-phrasing-content-valid.xhtml | 15 ++++ .../svg-title-text-valid.xhtml | 15 ++++ .../content-document-xhtml/svg-valid.xhtml | 31 ++------- 39 files changed, 437 insertions(+), 251 deletions(-) create mode 100644 src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc delete mode 100644 src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch delete mode 100644 src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc create mode 100644 src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg delete mode 100644 src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg delete mode 100644 src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg create mode 100644 src/test/resources/epub3/files/content-document-svg/title-text-valid.svg create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml delete mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-no-flow-error.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-not-flow-content-error.xhtml rename src/test/resources/epub3/files/content-document-xhtml/{svg-requiredExtensions-error.xhtml => svg-foreignObject-requiredExtensions-valid.xhtml} (51%) create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-id-valid.xhtml rename src/test/resources/epub3/files/content-document-xhtml/{svg-error.xhtml => svg-invalid-usage.xhtml} (57%) delete mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-links-valid.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-regression-valid.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-rel-attribute-valid.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-title-html-invalid-error.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-title-not-phrasing-content-error.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-title-phrasing-content-valid.xhtml create mode 100644 src/test/resources/epub3/files/content-document-xhtml/svg-title-text-valid.xhtml diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl index 026d153a3..0bcd7caf2 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.nvdl @@ -4,7 +4,7 @@ - + @@ -29,23 +29,6 @@ - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc index 87363bdf2..887e9b79d 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc @@ -1 +1,17 @@ -include "./mod/epub-svg11.rnc" +namespace svg = "http://www.w3.org/2000/svg" + +include "./mod/epub-xhtml.rnc" { + start = svg +} +include "./mod/epub-mathml3.rnc" +include "./mod/epub-svg-inc.rnc" + +svg.title.content |= common.elem.phrasing + +svg.foreignObject.content |= + ( body.elem + | common.inner.flow + | math + ) + +mtext.content |= common.elem.phrasing \ No newline at end of file diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch index 10ad603a4..0804a324f 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch @@ -1,11 +1,7 @@ - - - - diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc index acbe1a6aa..8a3368292 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc @@ -1,7 +1,17 @@ -## XHTML5 +namespace svg = "http://www.w3.org/2000/svg" + include "./mod/epub-xhtml.rnc" +include "./mod/epub-mathml3.rnc" +include "./mod/epub-svg-inc.rnc" { + svg.attr.id = attribute id { datatype.html5.token }? +} + +common.elem.phrasing |= svg +common.elem.phrasing |= math -## SVG and MathML +svg.title.content |= common.elem.phrasing -include "./mod/epub-xhtml-mathml3.rnc" -include "./mod/epub-xhtml-svg11.rnc" +svg.foreignObject.content |= + ( common.inner.flow + | math + ) diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch index 40d0213ec..5cae1670d 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch @@ -402,6 +402,4 @@ - - diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml b/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml index c0916fb8f..0ad3c153f 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub30-catalog.xml @@ -52,13 +52,9 @@ uri="mod/epub-ssml-attrs.rnc"/> - - - - - + + diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc new file mode 100644 index 000000000..eac862938 --- /dev/null +++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc @@ -0,0 +1,39 @@ +default namespace = "http://www.w3.org/2000/svg" + +# ##################################################################### +## Anything-goes schema for svg # +# ##################################################################### + +## SVG root +svg = svg.elem +svg.elem = + element svg { any.content & any.attr } + +## Special cases +specific.elems = + ( svg.foreignObject + | svg.title + ) +specific.attrs = svg.attr.id + +### SVG ID datatype +svg.attr.id = attribute id { xsd:ID }? + +### SVG foreignObject element restrictions +svg.foreignObject = + element foreignObject { any.attr & svg.foreignObject.content } +svg.foreignObject.content = notAllowed + +### SVG title element restrictions +svg.title = + element title { any.attr & svg.title.content } +svg.title.content = text + +## Anything + +## Any attribute from any namespace, other than the special cases +any.attr = attribute * -id { text }* & svg.attr.id +## Any element from any namespace, other than the special cases +any.elem = element * - (foreignObject|title) { any.content & any.attr } +## Any content from any namespace +any.content = text & any.elem* & specific.elems* diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch deleted file mode 100644 index 223d39ab4..000000000 --- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch +++ /dev/null @@ -1,7 +0,0 @@ - - - - Invalid value (expecting: "http://www.idpf.org/2007/ops") - - \ No newline at end of file diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc deleted file mode 100644 index 56e5cb1aa..000000000 --- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc +++ /dev/null @@ -1,40 +0,0 @@ -# Credit: integration adapted from the Nu Html Checker drivers - -namespace svg = "http://www.w3.org/2000/svg" -namespace math = "http://www.w3.org/1998/Math/MathML" -namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - -include "epub-xhtml.rnc" { - start = svg -} -include "svg11/svg11-inc.rnc" -include "svg11/inkscape.rnc" - -include "epub-mathml3.rnc" - -common.elem.phrasing |= svg - -common.elem.phrasing |= math - -SVG.foreignObject.content |= - ( math - | html.elem - | body.elem - | common.inner.flow - ) - -SVG.Core.attrib &= aria.global? -SVG.Core.extra.attrib &= epub.type.attr? - -# augment MathML annotation-xml content model -# annotation-xml.model.svg |= svg -# annotation-xml.model.xhtml |= -# ( html.elem -# | common.elem.flow -# ) - -# in our integration, is the only MathML "token element" that can -# contain HTML element content; the , , and elements -# cannot; see http://www.w3.org/Bugs/Public/show_bug.cgi?id=9859#c8 for a -# rationale -mtext.content |= common.elem.phrasing diff --git a/src/test/resources/epub3/content-document-svg.feature b/src/test/resources/epub3/content-document-svg.feature index c41d4f778..fff944a69 100644 --- a/src/test/resources/epub3/content-document-svg.feature +++ b/src/test/resources/epub3/content-document-svg.feature @@ -19,7 +19,7 @@ Feature: EPUB 3 ▸ Content Documents ▸ SVG Document Checks ## 3.2 Content Conformance ### ARIA attributes - + Scenario: Verify ARIA attributes are allowed When checking document 'aria-attributes-valid.svg' Then no errors or warnings are reported @@ -65,6 +65,12 @@ Feature: EPUB 3 ▸ Content Documents ▸ SVG Document Checks And the message contains 'Duplicate' And no other errors or warnings are reported + Scenario: Report invalid `id` attribute values + When checking document 'id-invalid-error.svg' + Then error RSC-005 is reported + And the message contains '"id" is invalid' + And no other errors or warnings are reported + ### Style Attribute Scenario: Verify `style` element without explicit `type` (issue 688) @@ -84,20 +90,51 @@ Feature: EPUB 3 ▸ Content Documents ▸ SVG Document Checks When checking document 'foreignObject-valid.svg' Then no errors or warnings are reported - Scenario: Report `foreignObject` with a `requiredExtensions` attribute with a non-OPS namespace - When checking document 'foreignObject-requiredExtensions-ns-error.svg' + Scenario: Verify that the `requiredExtensions` attribute can have any value + Note: 'requiredExensions' was required to be set to 'http://www.idpf.org/2007/ops' in EPUB 3.2 and earlier versions + When checking document 'foreignObject-requiredExtensions-valid.svg' + Then no errors or warnings are reported + + Scenario: Report `foreignObject` with non-HTML child content + When checking document 'foreignObject-not-html-error.svg' Then error RSC-005 is reported - And the message contains 'Invalid value (expecting: "http://www.idpf.org/2007/ops")' + And the message contains 'element "foo" not allowed here' And no other errors or warnings are reported - - Scenario: Report `foreignObject` with non-HTML child content - When checking document 'foreignObject-non-html-content-error.svg' + + Scenario: Report `foreignObject` with non-flow content + When checking document 'foreignObject-not-flow-content-error.svg' Then error RSC-005 is reported - And the message contains 'elements from namespace "https://example.org" are not allowed' + And the message contains 'element "title" not allowed here' And no other errors or warnings are reported - + Scenario: Report `foreignObject` with multiple HTML `body` elements When checking document 'foreignObject-multiple-body-error.svg' Then error RSC-005 is reported - And the message contains 'element "h:body" not allowed here' + And the message contains 'element "body" not allowed here' + And no other errors or warnings are reported + + Scenario: Report HTML validation errors within `foreignObject` content + When checking document 'foreignObject-html-invalid-error.svg' + Then error RSC-005 is reported + And the message contains 'attribute "href" not allowed here' + And no other errors or warnings are reported + + Scenario: Verify `title` can contain text + When checking document 'title-text-valid.svg' + Then no errors or warnings are reported + + Scenario: Verify `title` can contain HTML phrasing content + When checking document 'title-phrasing-content-valid.svg' + Then no errors or warnings are reported + + Scenario: Report `title` with non-phrasing content + When checking document 'title-not-phrasing-content-error.svg' + Then error RSC-005 is reported + And the message contains 'element "h1" not allowed here' + And no other errors or warnings are reported + + Scenario: Report HTML validation errors within `title` content + When checking document 'title-html-invalid-error.svg' + Then error RSC-005 is reported + And the message contains 'attribute "href" not allowed here' And no other errors or warnings are reported diff --git a/src/test/resources/epub3/content-document-xhtml.feature b/src/test/resources/epub3/content-document-xhtml.feature index b233eec86..c1630a6e7 100644 --- a/src/test/resources/epub3/content-document-xhtml.feature +++ b/src/test/resources/epub3/content-document-xhtml.feature @@ -710,26 +710,25 @@ Feature: EPUB 3 ▸ Content Documents ▸ XHTML Document Checks When checking document 'svg-valid.xhtml' Then no errors or warnings are reported + Scenario: Verify conforming SVG markup does not create false-positives + When checking document 'svg-regression-valid.xhtml' + Then no errors or warnings are reported + Scenario: Verify the SVG IDs can be any valid HTML ID + When checking document 'svg-id-valid.xhtml' + Then no errors or warnings are reported + Scenario: Verify that `epub:type` attribute can be used on SVG When checking document 'svg-with-epubtype-valid.xhtml' Then no errors or warnings are reported - Scenario: Report SVG with invalid content model - When checking document 'svg-error.xhtml' - Then error RSC-005 is reported - And the message contains 'The svg element must not appear inside title elements' - And no other errors or warnings are reported - - Scenario: Report SVG with incorrect `requiredExtensions` attribute value - When checking document 'svg-requiredExtensions-error.xhtml' - Then error RSC-005 is reported - And the message contains 'Invalid value (expecting: "http://www.idpf.org/2007/ops")' + Scenario: Verify that SVG validation erors are reported as USAGE + Given the reporting level set to usage + When checking document 'svg-invalid-usage.xhtml' + #Then usage SVG-000 is reported + #And the message contains 'element "foo" not allowed here' And no other errors or warnings are reported - Scenario: Verify `xlink:href` allowed on SVG elements - When checking document 'svg-links-valid.xhtml' - Then no errors or warnings are reported - + #TODO review if this warning is relevant Scenario: Report an SVG link without a recommended title When checking document 'svg-links-no-title-warning.xhtml' Then warning ACC-011 is reported @@ -739,19 +738,48 @@ Feature: EPUB 3 ▸ Content Documents ▸ XHTML Document Checks When checking document 'svg-foreignObject-valid.xhtml' Then no errors or warnings are reported - Scenario: Report `foreignObject` with disallowed body element + Scenario: Verify that the `requiredExtensions` attribute can have any value + When checking document 'svg-foreignObject-requiredExtensions-valid.xhtml' + And no other errors or warnings are reported + + Scenario: Report `foreignObject` with a body element When checking document 'svg-foreignObject-with-body-error.xhtml' Then error RSC-005 is reported And the message contains 'element "body" not allowed here' And no other errors or warnings are reported + + Scenario: Report HTML validation errors within `foreignObject` content + When checking document 'svg-foreignObject-html-invalid-error.xhtml' + Then error RSC-005 is reported + And the message contains 'attribute "href" not allowed here' + And no other errors or warnings are reported Scenario: Report `foreignObject` without flow content - When checking document 'svg-foreignObject-no-flow-error.xhtml' + When checking document 'svg-foreignObject-not-flow-content-error.xhtml' Then error RSC-005 is reported And the message contains 'element "title" not allowed here' And no other errors or warnings are reported -# Still not allowed by epubcheck - https://github.com/w3c/epubcheck/issues/173 -# Scenario: Verify RDF elements can be embedded in SVG -# When checking document 'svg-rdf-valid.xhtml' -# Then no errors or warnings are reported + Scenario: Verify `title` can contain text + When checking document 'svg-title-text-valid.xhtml' + Then no errors or warnings are reported + + Scenario: Verify `title` can contain HTML phrasing content + When checking document 'svg-title-phrasing-content-valid.xhtml' + Then no errors or warnings are reported + + Scenario: Report `title` with non-phrasing content + When checking document 'svg-title-not-phrasing-content-error.xhtml' + Then error RSC-005 is reported + And the message contains 'element "h1" not allowed here' + And no other errors or warnings are reported + + Scenario: Report HTML validation errors within `title` content + When checking document 'svg-title-html-invalid-error.xhtml' + Then error RSC-005 is reported + And the message contains 'attribute "href" not allowed here' + And no other errors or warnings are reported + + Scenario: Verify RDF elements can be embedded in SVG + When checking document 'svg-rdf-valid.xhtml' + Then no errors or warnings are reported diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg new file mode 100644 index 000000000..35c750d5d --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg @@ -0,0 +1,13 @@ + + + SVG Test + Rectangle + + + +

Hello

+ +
+ +
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg index 31fdbe346..e3d87793c 100644 --- a/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg +++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-multiple-body-error.svg @@ -1,11 +1,16 @@ - foreignObject cannot contain more than one HTML body + SVG Test Rectangle - - - - - + + + +

Hello

+ + +

Hello

+ +
+ +
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg deleted file mode 100644 index c72aaec1d..000000000 --- a/src/test/resources/epub3/files/content-document-svg/foreignObject-non-html-content-error.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - foreignObject has to contain only html content - Rectangle - - - hello - hello - - diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg new file mode 100644 index 000000000..769e49598 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-flow-content-error.svg @@ -0,0 +1,13 @@ + + + SVG Test + Rectangle + + + + Test + + + + + diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg new file mode 100644 index 000000000..09fad21b7 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-not-html-error.svg @@ -0,0 +1,13 @@ + + + SVG Test + Rectangle + + + +

Hello

+
+
+ +
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg deleted file mode 100644 index bb773d3a5..000000000 --- a/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-ns-error.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - foreignObject has to have OPS namespace in requiredExtensions - Rectangle - - - hello - - diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg new file mode 100644 index 000000000..79bcc86b3 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-requiredExtensions-valid.svg @@ -0,0 +1,13 @@ + + + SVG Test + Rectangle + + + +

Hello

+ +
+ +
+
diff --git a/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg b/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg index 9ed4a23dd..272b8abdb 100644 --- a/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg +++ b/src/test/resources/epub3/files/content-document-svg/foreignObject-valid.svg @@ -1,10 +1,13 @@ - Valid foreignObject element + SVG Test Rectangle - - - hello - + + + +

Hello

+ +
+ +
diff --git a/src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg b/src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg new file mode 100644 index 000000000..023c2e5ce --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/id-invalid-error.svg @@ -0,0 +1,5 @@ + + + Two elements with the same ID value + Rectangle + diff --git a/src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg b/src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg new file mode 100644 index 000000000..ff287bba0 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/title-html-invalid-error.svg @@ -0,0 +1,5 @@ + + + SVG Test + Rectangle + diff --git a/src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg b/src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg new file mode 100644 index 000000000..5e577203f --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/title-not-phrasing-content-error.svg @@ -0,0 +1,5 @@ + + +

SVG Test

+ Rectangle +
diff --git a/src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg b/src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg new file mode 100644 index 000000000..af7f1a5e5 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/title-phrasing-content-valid.svg @@ -0,0 +1,5 @@ + + + SVG Test + Rectangle + diff --git a/src/test/resources/epub3/files/content-document-svg/title-text-valid.svg b/src/test/resources/epub3/files/content-document-svg/title-text-valid.svg new file mode 100644 index 000000000..9e68f0f9c --- /dev/null +++ b/src/test/resources/epub3/files/content-document-svg/title-text-valid.svg @@ -0,0 +1,5 @@ + + + SVG Test + Rectangle + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml new file mode 100644 index 000000000..778d8fc7c --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-html-invalid-error.xhtml @@ -0,0 +1,19 @@ + + + + + Test + + +

Test

+ + Example + + +

Hello

+
+
+
+ + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-no-flow-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-no-flow-error.xhtml deleted file mode 100644 index b7827d313..000000000 --- a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-no-flow-error.xhtml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - foreignObject element with non-flow content - - - - - - - - - - - - Disallowed - - - - - diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-not-flow-content-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-not-flow-content-error.xhtml new file mode 100644 index 000000000..7c0755393 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-not-flow-content-error.xhtml @@ -0,0 +1,19 @@ + + + + + Test + + +

Test

+ + Example + + + Hello + + + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-requiredExtensions-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-requiredExtensions-valid.xhtml similarity index 51% rename from src/test/resources/epub3/files/content-document-xhtml/svg-requiredExtensions-error.xhtml rename to src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-requiredExtensions-valid.xhtml index d62a9850a..1fda7fe58 100644 --- a/src/test/resources/epub3/files/content-document-xhtml/svg-requiredExtensions-error.xhtml +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-requiredExtensions-valid.xhtml @@ -1,21 +1,15 @@ - - SVG with invalid requiredExtensions + SVG Test

...

- Example rect02 - rounded rectangles - + Example - - - -

...

diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-valid.xhtml index 0f144c9e6..8b9e6b1c9 100644 --- a/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-valid.xhtml +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-foreignObject-valid.xhtml @@ -1,27 +1,19 @@ - + - Allow html elements inside prefixed svg:foreignObject + Test -
- - - - - - - - - -

heading

-

text

-
-
-
-
+

Test

+ + Example + + +

Hello

+
+
+
diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-id-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-id-valid.xhtml new file mode 100644 index 000000000..9b169aa15 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-id-valid.xhtml @@ -0,0 +1,14 @@ + + + + + Test + + +

Test

+ + Example + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-invalid-usage.xhtml similarity index 57% rename from src/test/resources/epub3/files/content-document-xhtml/svg-error.xhtml rename to src/test/resources/epub3/files/content-document-xhtml/svg-invalid-usage.xhtml index d0d129853..105002b24 100644 --- a/src/test/resources/epub3/files/content-document-xhtml/svg-error.xhtml +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-invalid-usage.xhtml @@ -9,11 +9,8 @@

...

- Title - Example rect01 - rectangle with sharp corners - - - + Title + Invalid

...

diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-links-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-links-valid.xhtml deleted file mode 100644 index 65e6fc4ea..000000000 --- a/src/test/resources/epub3/files/content-document-xhtml/svg-links-valid.xhtml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - xlink:href allowed on SVG elements - - -

SVG test

- - Rectangle - Example rect01 - rectangle with sharp corners - - - - - - link - - - -

- another link outside svg -

- - diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-regression-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-regression-valid.xhtml new file mode 100644 index 000000000..f08129e81 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-regression-valid.xhtml @@ -0,0 +1,17 @@ + + + + + Test + + +

Test

+ + Example + + + link + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-rel-attribute-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-rel-attribute-valid.xhtml new file mode 100644 index 000000000..e63cae24d --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-rel-attribute-valid.xhtml @@ -0,0 +1,18 @@ + + + + + Test + + +

Test

+ + Example rect01 - rectangle with sharp corners + + + + link + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-title-html-invalid-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-title-html-invalid-error.xhtml new file mode 100644 index 000000000..7fdd9b9c3 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-title-html-invalid-error.xhtml @@ -0,0 +1,15 @@ + + + + + Test + + +

Test

+ + title + Example + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-title-not-phrasing-content-error.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-title-not-phrasing-content-error.xhtml new file mode 100644 index 000000000..5b4fd6ea4 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-title-not-phrasing-content-error.xhtml @@ -0,0 +1,15 @@ + + + + + Test + + +

Test

+ +

title

+ Example +
+ + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-title-phrasing-content-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-title-phrasing-content-valid.xhtml new file mode 100644 index 000000000..02fc22782 --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-title-phrasing-content-valid.xhtml @@ -0,0 +1,15 @@ + + + + + Test + + +

Test

+ + title + Example + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-title-text-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-title-text-valid.xhtml new file mode 100644 index 000000000..85c11cd3c --- /dev/null +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-title-text-valid.xhtml @@ -0,0 +1,15 @@ + + + + + Test + + +

Test

+ + title + Example + + + diff --git a/src/test/resources/epub3/files/content-document-xhtml/svg-valid.xhtml b/src/test/resources/epub3/files/content-document-xhtml/svg-valid.xhtml index 15533ce50..4ea5385f9 100644 --- a/src/test/resources/epub3/files/content-document-xhtml/svg-valid.xhtml +++ b/src/test/resources/epub3/files/content-document-xhtml/svg-valid.xhtml @@ -1,31 +1,14 @@ - + - Embedded SVG + Test -
-

...

- - Example rect01 - rectangle with sharp corners - - - - - - Example rect02 - rounded rectangles - - - - - - - - - - -

...

-
+

Test

+ + Example +