@likecoin/epubcheck-ts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +339 -0
- package/dist/index.cjs +1904 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +523 -0
- package/dist/index.d.ts +523 -0
- package/dist/index.js +1895 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
- package/schemas/applications.rng +429 -0
- package/schemas/aria.rng +3355 -0
- package/schemas/block.rng +488 -0
- package/schemas/common.rng +1076 -0
- package/schemas/container.rng +24 -0
- package/schemas/core-scripting.rng +950 -0
- package/schemas/data.rng +161 -0
- package/schemas/datatypes.rng +401 -0
- package/schemas/embed.rng +980 -0
- package/schemas/epub-mathml3-inc.rng +161 -0
- package/schemas/epub-nav-30.rnc +44 -0
- package/schemas/epub-nav-30.rng +19985 -0
- package/schemas/epub-nav-30.sch +87 -0
- package/schemas/epub-prefix-attr.rng +17 -0
- package/schemas/epub-shared-inc.rng +29 -0
- package/schemas/epub-ssml-attrs.rng +17 -0
- package/schemas/epub-svg-30.rnc +17 -0
- package/schemas/epub-svg-30.rng +19903 -0
- package/schemas/epub-svg-30.sch +7 -0
- package/schemas/epub-svg-forgiving-inc.rng +315 -0
- package/schemas/epub-switch.rng +121 -0
- package/schemas/epub-trigger.rng +90 -0
- package/schemas/epub-type-attr.rng +12 -0
- package/schemas/epub-xhtml-30.rnc +6 -0
- package/schemas/epub-xhtml-30.rng +19882 -0
- package/schemas/epub-xhtml-30.sch +409 -0
- package/schemas/epub-xhtml-inc.rng +151 -0
- package/schemas/epub-xhtml-integration.rng +565 -0
- package/schemas/epub-xhtml-svg-mathml.rng +17 -0
- package/schemas/form-datatypes.rng +54 -0
- package/schemas/mathml3-common.rng +336 -0
- package/schemas/mathml3-content.rng +1552 -0
- package/schemas/mathml3-inc.rng +30 -0
- package/schemas/mathml3-presentation.rng +2341 -0
- package/schemas/mathml3-strict-content.rng +205 -0
- package/schemas/media.rng +374 -0
- package/schemas/meta.rng +754 -0
- package/schemas/microdata.rng +192 -0
- package/schemas/ncx.rng +308 -0
- package/schemas/ocf-container-30.rnc +37 -0
- package/schemas/ocf-container-30.rng +568 -0
- package/schemas/opf.rng +15 -0
- package/schemas/opf20.rng +513 -0
- package/schemas/package-30.rnc +133 -0
- package/schemas/package-30.rng +1153 -0
- package/schemas/package-30.sch +444 -0
- package/schemas/phrase.rng +746 -0
- package/schemas/rdfa.rng +552 -0
- package/schemas/revision.rng +106 -0
- package/schemas/ruby.rng +141 -0
- package/schemas/sectional.rng +278 -0
- package/schemas/structural.rng +298 -0
- package/schemas/tables.rng +420 -0
- package/schemas/web-components.rng +184 -0
- package/schemas/web-forms.rng +975 -0
- package/schemas/web-forms2.rng +1236 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
|
|
3
|
+
|
|
4
|
+
<ns uri="http://www.w3.org/1999/xhtml" prefix="html"/>
|
|
5
|
+
<ns uri="http://www.idpf.org/2007/ops" prefix="epub"/>
|
|
6
|
+
|
|
7
|
+
<pattern id="nav-ocurrence">
|
|
8
|
+
<rule context="html:body">
|
|
9
|
+
<assert test="count(.//html:nav[tokenize(@epub:type,'\s+')='toc']) = 1">Exactly one "toc" nav element
|
|
10
|
+
must be present</assert>
|
|
11
|
+
<assert test="count(.//html:nav[tokenize(@epub:type,'\s+')='page-list']) < 2">Multiple occurrences of
|
|
12
|
+
the "page-list" nav element</assert>
|
|
13
|
+
<assert test="count(.//html:nav[tokenize(@epub:type,'\s+')='landmarks']) < 2">Multiple occurrences of
|
|
14
|
+
the "landmarks" nav element</assert>
|
|
15
|
+
</rule>
|
|
16
|
+
</pattern>
|
|
17
|
+
|
|
18
|
+
<pattern id="span-no-sublist">
|
|
19
|
+
<rule context="html:body//html:nav[@epub:type]//html:span">
|
|
20
|
+
<assert test="count(.//ol) = 0"> The span element must only be used as heading for flat
|
|
21
|
+
sublists (not hierarchical navigation structures) </assert>
|
|
22
|
+
</rule>
|
|
23
|
+
</pattern>
|
|
24
|
+
|
|
25
|
+
<pattern id="landmarks">
|
|
26
|
+
<rule context="html:nav[tokenize(@epub:type,'\s+')='landmarks']//html:ol//html:a">
|
|
27
|
+
<let name="current" value="."/>
|
|
28
|
+
<let name="current_type_normalized" value="tokenize(lower-case(@epub:type),'\s+')"/>
|
|
29
|
+
<let name="current_href_normalized" value="normalize-space(lower-case(@href))"/>
|
|
30
|
+
|
|
31
|
+
<!-- Check for missing epub:type attributes -->
|
|
32
|
+
<assert test="@epub:type">Missing epub:type attribute on anchor inside "landmarks" nav element</assert>
|
|
33
|
+
|
|
34
|
+
<!--
|
|
35
|
+
landmarks anchors should be unique (#493)
|
|
36
|
+
and only reported within the same ancestor landmarks element
|
|
37
|
+
-->
|
|
38
|
+
<assert test="
|
|
39
|
+
empty(ancestor::html:nav//html:ol//html:a[
|
|
40
|
+
not(. is $current) and
|
|
41
|
+
tokenize(lower-case(@epub:type),'\s+') = $current_type_normalized and
|
|
42
|
+
normalize-space(lower-case(@href)) = $current_href_normalized
|
|
43
|
+
])">Another landmark was found with the same epub:type and same reference to "<value-of select="$current_href_normalized"/>"</assert>
|
|
44
|
+
</rule>
|
|
45
|
+
</pattern>
|
|
46
|
+
|
|
47
|
+
<pattern id="link-labels">
|
|
48
|
+
<rule context="html:nav[@epub:type]//html:ol//html:a">
|
|
49
|
+
<assert
|
|
50
|
+
test="string-length(normalize-space(string-join(.|./html:img/@alt|.//@aria-label))) > 0"
|
|
51
|
+
>Anchors within nav elements must contain text</assert>
|
|
52
|
+
</rule>
|
|
53
|
+
</pattern>
|
|
54
|
+
|
|
55
|
+
<pattern id="span-labels">
|
|
56
|
+
<rule context="html:nav[@epub:type]//html:ol//html:span">
|
|
57
|
+
<assert
|
|
58
|
+
test="string-length(normalize-space(string-join(.|./html:img/@alt|.//@aria-label))) > 0"
|
|
59
|
+
>Spans within nav elements must contain text</assert>
|
|
60
|
+
</rule>
|
|
61
|
+
</pattern>
|
|
62
|
+
|
|
63
|
+
<pattern id="req-heading">
|
|
64
|
+
<rule
|
|
65
|
+
context="html:nav[@epub:type][not(tokenize(@epub:type,'\s+') = ('toc','page-list','landmarks'))]">
|
|
66
|
+
<assert test="child::*[1][self::html:h1|self::html:h2|self::html:h3|self::html:h4|self::html:h5|self::html:h6]">nav
|
|
67
|
+
elements other than "toc", "page-list" and "landmarks" must have a heading as their
|
|
68
|
+
first child</assert>
|
|
69
|
+
</rule>
|
|
70
|
+
</pattern>
|
|
71
|
+
|
|
72
|
+
<pattern id="heading-content">
|
|
73
|
+
<rule context="html:h1|html:h2|html:h3|html:h4|html:h5|html:h6">
|
|
74
|
+
<assert
|
|
75
|
+
test="string-length(normalize-space(string-join(.|./html:img/@alt|.//@aria-label))) > 0"
|
|
76
|
+
>Heading elements must contain text</assert>
|
|
77
|
+
</rule>
|
|
78
|
+
</pattern>
|
|
79
|
+
|
|
80
|
+
<pattern id="flat-nav">
|
|
81
|
+
<rule context="html:nav[tokenize(@epub:type,'\s+') = ('page-list','landmarks')]">
|
|
82
|
+
<assert test="count(.//html:ol) = 1">WARNING: A "<value-of select="@epub:type"/>" nav element should contain
|
|
83
|
+
only a single ol descendant (no nested sublists)</assert>
|
|
84
|
+
</rule>
|
|
85
|
+
</pattern>
|
|
86
|
+
|
|
87
|
+
</schema>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:epub="http://www.idpf.org/2007/ops" xmlns="http://relaxng.org/ns/structure/1.0">
|
|
3
|
+
<!-- ##################################################################### -->
|
|
4
|
+
<define name="epub.prefix.attr">
|
|
5
|
+
<a:documentation> RELAX NG Schema for EPUB: EPUB prefix attributes #</a:documentation>
|
|
6
|
+
<!-- ##################################################################### -->
|
|
7
|
+
<a:documentation>prefix attributes</a:documentation>
|
|
8
|
+
<attribute name="prefix">
|
|
9
|
+
<ref name="datatype.prefixdecl"/>
|
|
10
|
+
</attribute>
|
|
11
|
+
</define>
|
|
12
|
+
<define name="epub.prefix.attr.ns">
|
|
13
|
+
<attribute name="epub:prefix">
|
|
14
|
+
<ref name="datatype.prefixdecl"/>
|
|
15
|
+
</attribute>
|
|
16
|
+
</define>
|
|
17
|
+
</grammar>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
|
|
3
|
+
<!-- ##################################################################### -->
|
|
4
|
+
<!-- EPUB elements -->
|
|
5
|
+
<include href="epub-trigger.rng">
|
|
6
|
+
<a:documentation> RELAX NG Schema for EPUB: shared definitions for inclusion #</a:documentation>
|
|
7
|
+
<!-- ##################################################################### -->
|
|
8
|
+
<a:documentation>Includes</a:documentation>
|
|
9
|
+
</include>
|
|
10
|
+
<include href="epub-switch.rng"/>
|
|
11
|
+
<!-- EPUB attributes -->
|
|
12
|
+
<include href="epub-prefix-attr.rng"/>
|
|
13
|
+
<include href="epub-ssml-attrs.rng"/>
|
|
14
|
+
<include href="epub-type-attr.rng"/>
|
|
15
|
+
<!-- EPUB integration logic -->
|
|
16
|
+
<include href="epub-xhtml-integration.rng"/>
|
|
17
|
+
<!--
|
|
18
|
+
Note: the default HMTL schema does not define such a category, so we
|
|
19
|
+
do our best to include what makes sense here
|
|
20
|
+
-->
|
|
21
|
+
<define name="common.inner.anyhtml">
|
|
22
|
+
<a:documentation>Content model: HTML fragments</a:documentation>
|
|
23
|
+
<choice>
|
|
24
|
+
<ref name="html.elem"/>
|
|
25
|
+
<ref name="body.elem"/>
|
|
26
|
+
<ref name="common.inner.flow"/>
|
|
27
|
+
</choice>
|
|
28
|
+
</define>
|
|
29
|
+
</grammar>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns="http://relaxng.org/ns/structure/1.0">
|
|
3
|
+
<!-- ##################################################################### -->
|
|
4
|
+
<define name="epub.ssml.ph.attr">
|
|
5
|
+
<a:documentation> RELAX NG Schema for EPUB: EPUB SSML attributes #</a:documentation>
|
|
6
|
+
<!-- ##################################################################### -->
|
|
7
|
+
<a:documentation>SSML attributes</a:documentation>
|
|
8
|
+
<attribute name="ssml:ph">
|
|
9
|
+
<ref name="datatype.ssml.PhoneticExpression"/>
|
|
10
|
+
</attribute>
|
|
11
|
+
</define>
|
|
12
|
+
<define name="epub.ssml.alphabet.attr">
|
|
13
|
+
<attribute name="ssml:alphabet">
|
|
14
|
+
<ref name="datatype.ssml.PhoneticAlphabet"/>
|
|
15
|
+
</attribute>
|
|
16
|
+
</define>
|
|
17
|
+
</grammar>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
# #####################################################################
|
|
3
|
+
## RELAX NG Schema for EPUB: EPUB SVG (+ XHTML, + MathML) #
|
|
4
|
+
# #####################################################################
|
|
5
|
+
|
|
6
|
+
include "./mod/epub-xhtml-svg-mathml.rnc" {
|
|
7
|
+
start = svg
|
|
8
|
+
|
|
9
|
+
# Override the `id` attribute to require a valid XML ID
|
|
10
|
+
svg.attr.id = attribute id { xsd:ID }?
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# Allow `body` element as a child of `foreignObject`
|
|
14
|
+
svg.foreignObject.inner |= body.elem
|
|
15
|
+
|
|
16
|
+
# Allow `epub:prefix` attribute on `svg` root
|
|
17
|
+
svg.attrs &= epub.prefix.attr.ns?
|