-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
39 changed files
with
437 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 17 additions & 1 deletion
18
src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.rnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
4 changes: 0 additions & 4 deletions
4
src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30.sch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schema xmlns="http://purl.oclc.org/dsdl/schematron"> | ||
|
||
<ns uri="http://www.w3.org/2000/svg" prefix="svg" /> | ||
|
||
<pattern></pattern> | ||
<include href="./mod/id-unique.sch"/> | ||
<include href="./mod/epub-svg11-re.sch"/> | ||
|
||
</schema> | ||
|
18 changes: 14 additions & 4 deletions
18
src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.rnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -402,6 +402,4 @@ | |
</rule> | ||
</pattern> | ||
|
||
<include href="./mod/epub-svg11-re.sch"/> | ||
|
||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg-inc.rnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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* |
7 changes: 0 additions & 7 deletions
7
src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11-re.sch
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-svg11.rnc
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...resources/epub3/files/content-document-svg/foreignObject-html-invalid-error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.