GeezerVison is showing github.com — feat: check `epub:type` restrictions in XHTML and SVG · w3c/epubcheck@0fab5c8
File treeExpand file treeCollapse file tree Open diff view settings resources/com/adobe/epubcheck/schema/30
00-minimal/files/minimal/EPUB
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/main/java/com/adobe/epubcheck/ops/OPSChecker.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -56,11 +56,11 @@ public class OPSChecker extends PublicationResourceChecker | 56 | 56 | .putAll(Predicates.and(mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_2)), | 57 | 57 | XMLValidators.XHTML_20_NVDL, XMLValidators.XHTML_20_SCH, XMLValidators.IDUNIQUE_20_SCH) | 58 | 58 | .putAll(Predicates.and(mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)), | 59 | | - XMLValidators.XHTML_30_NVDL, XMLValidators.SVG_INFORMATIVE_30_NVDL) | | 59 | + XMLValidators.XHTML_30_NVDL, XMLValidators.SVG_30_INFORMATIVE_NVDL) | 60 | 60 | .putAll(Predicates.and(mimetype("image/svg+xml"), version(EPUBVersion.VERSION_2)), | 61 | 61 | XMLValidators.SVG_20_NVDL, XMLValidators.IDUNIQUE_20_SCH) | 62 | 62 | .putAll(Predicates.and(mimetype("image/svg+xml"), version(EPUBVersion.VERSION_3)), | 63 | | - XMLValidators.SVG_30_NVDL, XMLValidators.SVG_INFORMATIVE_30_NVDL) | | 63 | + XMLValidators.SVG_30_NVDL, XMLValidators.SVG_30_INFORMATIVE_NVDL) | 64 | 64 | .putAll( | 65 | 65 | and(or(profile(EPUBProfile.DICT), hasPubType(PublicationType.DICTIONARY)), | 66 | 66 | mimetype("application/xhtml+xml"), version(EPUBVersion.VERSION_3)), | |
Collapse file Copy file name to clipboardExpand all lines: src/main/java/com/adobe/epubcheck/xml/XMLValidators.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,7 +39,7 @@ public enum XMLValidators | 39 | 39 | SVG_20_NVDL("schema/20/rng/ops20-svg.nvdl"), | 40 | 40 | SVG_30_RNC("schema/30/epub-svg-30.rnc"), | 41 | 41 | SVG_30_NVDL("schema/30/epub-svg-30.nvdl"), | 42 | | - SVG_INFORMATIVE_30_NVDL("schema/30/epub-svg-informative.nvdl", false), | | 42 | + SVG_30_INFORMATIVE_NVDL("schema/30/epub-svg-30-informative.nvdl", false), | 43 | 43 | SVG_30_SCH("schema/30/epub-svg-30.sch"), | 44 | 44 | XHTML_20_NVDL("schema/20/rng/ops20.nvdl"), | 45 | 45 | XHTML_20_SCH("schema/20/sch/xhtml.sch"), | |
Collapse file Copy file name to clipboardExpand all lines: src/main/resources/com/adobe/epubcheck/schema/30/epub-nav-30.rnc +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | default namespace = "http://www.w3.org/1999/xhtml" | 3 | 3 | namespace epub = "http://www.idpf.org/2007/ops" | 4 | 4 |
| | 5 | + | | 6 | +# ##################################################################### | | 7 | +## RELAX NG Schema for EPUB: EPUB Navigation Documents # | | 8 | +# ##################################################################### | | 9 | + | 5 | 10 | include "epub-xhtml-30.rnc" { | 6 | 11 | nav.attrs = nav.attrs.noepubtype | 7 | 12 | } | |
Collapse file Copy file name to clipboardExpand all lines: src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-30-informative.nvdl +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> | 2 | 2 | <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"> | 3 | 3 | <namespace ns="http://www.w3.org/2000/svg"> | 4 | | - <validate schema="epub-svg-informative.rnc" schemaType="application/relax-ng-compact-syntax"/> | | 4 | + <validate schema="epub-svg-30-informative.rnc" schemaType="application/relax-ng-compact-syntax"/> | 5 | 5 | </namespace> | 6 | 6 | <namespace ns="" match="attributes"> | 7 | 7 | <attach/> | |
Collapse file Copy file name to clipboard +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | + namespace svg = "http://www.w3.org/2000/svg" | | 2 | + | | 3 | +# ##################################################################### | | 4 | +## RELAX NG Schema for EPUB: EPUB SVG and XHTML (+ MathML) # | | 5 | +## strict SVG grammar check (informative only) # | | 6 | +# ##################################################################### | | 7 | + | | 8 | +include "./mod/epub-xhtml-inc.rnc" { | | 9 | + # This schema applies both to XHTML and SVG documents | | 10 | + start = svg | html.elem | | 11 | +} | | 12 | +include "./mod/epub-svg-strict-inc.rnc" | | 13 | +include "./mod/epub-mathml3-inc.rnc" | | 14 | +include "./mod/epub-shared-inc.rnc" | | 15 | + | | 16 | +common.elem.phrasing |= svg | | 17 | +common.elem.phrasing |= math |
Collapse file Copy file name to clipboard +10-13Lines changed: 10 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -namespace svg = "http://www.w3.org/2000/svg" | 2 | 1 |
| 3 | | -include "./mod/epub-xhtml-inc.rnc" { | | 2 | +# ##################################################################### | | 3 | +## RELAX NG Schema for EPUB: EPUB SVG (+ XHTML, + MathML) # | | 4 | +# ##################################################################### | | 5 | + | | 6 | +include "./mod/epub-xhtml-svg-mathml.rnc" { | 4 | 7 | start = svg | | 8 | + | | 9 | + # Override the `id` attribute to require a valid XML ID | | 10 | + svg.attr.id = attribute id { xsd:ID }? | 5 | 11 | } | 6 | | -include "./mod/epub-mathml3.rnc" | 7 | | -include "./mod/epub-svg-inc.rnc" | 8 | | - | 9 | | -svg.title.content |= common.inner.anyhtml | 10 | | - | 11 | | -svg.foreignObject.content |= | 12 | | - ( body.elem | 13 | | - | common.inner.flow | 14 | | - | math | 15 | | - ) | 16 | 12 |
| 17 | | -mtext.content |= common.elem.phrasing | | 13 | +# Allow `body` element as a child of `foreignObject` | | 14 | +svg.foreignObject.inner |= body.elem |
Collapse file Copy file name to clipboardExpand all lines: src/main/resources/com/adobe/epubcheck/schema/30/epub-svg-informative.rnc -21Lines changed: 0 additions & 21 deletions Collapse file Copy file name to clipboard +4-17Lines changed: 4 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -namespace svg = "http://www.w3.org/2000/svg" | 2 | 1 |
| 3 | | -include "./mod/epub-xhtml-inc.rnc" | 4 | | -include "./mod/epub-mathml3.rnc" | 5 | | -include "./mod/epub-svg-inc.rnc" { | 6 | | - svg.attr.id = attribute id { datatype.html5.token }? | 7 | | -} | | 2 | +# ##################################################################### | | 3 | +## RELAX NG Schema for EPUB: EPUB XHTML (+ SVG, + MathML) # | | 4 | +# ##################################################################### | 8 | 5 |
| 9 | | -common.elem.phrasing |= svg | 10 | | -common.elem.phrasing |= math | 11 | | - | 12 | | -math.attributes &= aria.global? | 13 | | - | 14 | | -svg.title.content |= common.inner.anyhtml | 15 | | - | 16 | | -svg.foreignObject.content |= | 17 | | - ( common.inner.flow | 18 | | - | math | 19 | | - ) | | 6 | +include "./mod/epub-xhtml-svg-mathml.rnc" |
Collapse file Copy file name to clipboardExpand all lines: src/main/resources/com/adobe/epubcheck/schema/30/mod/epub-mathml3-inc.rnc +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,16 +29,18 @@ include "mathml/mathml3-inc.rnc" { | 29 | 29 | # override annotation-xml with EPUB restrictions | 30 | 30 | annotation-xml = epub.annotation-xml | 31 | 31 | } | 32 | | - | 33 | 32 | # Common attribute extensions | 34 | 33 | # - SSML attributes | 35 | 34 | CommonAtt &= epub.ssml.ph.attr? | 36 | 35 | # - xml:base | 37 | 36 | CommonAtt &= common.attrs.xmlbase? | | 37 | +# - ARIA | | 38 | +CommonAtt &= aria.global? | 38 | 39 |
| 39 | 40 | annotation-xml.model.xhtml |= common.inner.flow | 40 | 41 | annotation-xml.model.svg |= svg | 41 | 42 |
| | 43 | + | 42 | 44 | # The following comes from validator.nu’s xhtml5-svg-mathml.rnc driver: | 43 | 45 | # in our integration, <mtext> is the only MathML "token element" that can | 44 | 46 | # contain HTML element content; the <mi>, <mn>, <mo> and <ms> elements | @@ -84,4 +86,3 @@ epub.annotation-xml = | 84 | 86 | attribute name { | 85 | 87 | xsd:NCName | 86 | 88 | } | 87 | | - | |
Collapse file Copy file name to clipboard +16-6Lines changed: 16 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 |
| | 2 | + namespace epub = "http://www.idpf.org/2007/ops" | 2 | 3 |
| 3 | | - namespace epub = "http://www.idpf.org/2007/ops" | 4 | | - | 5 | | - html.attrs &= epub.prefix.attr.ns? | 6 | | - | 7 | | - epub.prefix.attr = attribute prefix { datatype.prefixdecl } | 8 | | - epub.prefix.attr.ns = attribute epub:prefix { datatype.prefixdecl } | | 4 | +# ##################################################################### | | 5 | +## RELAX NG Schema for EPUB: EPUB prefix attributes # | | 6 | +# ##################################################################### | | 7 | + | | 8 | +## prefix attributes | | 9 | + | | 10 | + epub.prefix.attr = | | 11 | + attribute prefix { | | 12 | + datatype.prefixdecl | | 13 | + } | | 14 | + | | 15 | + epub.prefix.attr.ns = | | 16 | + attribute epub:prefix { | | 17 | + datatype.prefixdecl | | 18 | + } |
|