-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow SVG/MathML doctype declarations
EPUB 3.3. now allows a reserved set of external identifiers in doctype declarations of documents with select media types. See: https://www.w3.org/TR/epub-33/#app-identifiers-allowed This commit: - adds those as special cases to the XML parser code - totally removes entity fetching for EPUB 3.3 - keeps forbidding external entities in the internal subset Fix #1192, Fix #1114
- Loading branch information
Showing
23 changed files
with
215 additions
and
10 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
11 changes: 11 additions & 0 deletions
11
...t/resources/epub3/files/epub/xml-external-identifier-allowed-valid/EPUB/content_001.xhtml
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,11 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body> | ||
<h1>Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
15 changes: 15 additions & 0 deletions
15
...ources/epub3/files/epub/xml-external-identifier-allowed-valid/EPUB/mathml-mediatype-1.xml
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 3.0//EN" "http://www.w3.org/Math/DTD/mathml3/mathml3.dtd"> | ||
<math xmlns="http://www.w3.org/1998/Math/MathML" alttext="2x+y-z"> | ||
<mrow> | ||
<mn>2</mn> | ||
<mo> ⁡<!--INVISIBLE TIMES--></mo> | ||
<mi>x</mi> | ||
</mrow> | ||
<mrow> | ||
<mo>+</mo> | ||
<mi>y</mi> | ||
<mo>-</mo> | ||
<mi>z</mi> | ||
</mrow> | ||
</math> |
15 changes: 15 additions & 0 deletions
15
...ources/epub3/files/epub/xml-external-identifier-allowed-valid/EPUB/mathml-mediatype-2.xml
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 3.0//EN" "http://www.w3.org/Math/DTD/mathml3/mathml3.dtd"> | ||
<math xmlns="http://www.w3.org/1998/Math/MathML" alttext="2x+y-z"> | ||
<mrow> | ||
<mn>2</mn> | ||
<mo> ⁡<!--INVISIBLE TIMES--></mo> | ||
<mi>x</mi> | ||
</mrow> | ||
<mrow> | ||
<mo>+</mo> | ||
<mi>y</mi> | ||
<mo>-</mo> | ||
<mi>z</mi> | ||
</mrow> | ||
</math> |
15 changes: 15 additions & 0 deletions
15
...ources/epub3/files/epub/xml-external-identifier-allowed-valid/EPUB/mathml-mediatype-3.xml
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 3.0//EN" "http://www.w3.org/Math/DTD/mathml3/mathml3.dtd"> | ||
<math xmlns="http://www.w3.org/1998/Math/MathML" alttext="2x+y-z"> | ||
<mrow> | ||
<mn>2</mn> | ||
<mo> ⁡<!--INVISIBLE TIMES--></mo> | ||
<mi>x</mi> | ||
</mrow> | ||
<mrow> | ||
<mo>+</mo> | ||
<mi>y</mi> | ||
<mo>-</mo> | ||
<mi>z</mi> | ||
</mrow> | ||
</math> |
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
src/test/resources/epub3/files/epub/xml-external-identifier-allowed-valid/EPUB/package.opf
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q"> | ||
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> | ||
<dc:title id="title">Minimal EPUB 3.0</dc:title> | ||
<dc:language>en</dc:language> | ||
<dc:identifier id="q">NOID</dc:identifier> | ||
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta> | ||
</metadata> | ||
<manifest> | ||
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/> | ||
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> | ||
<item id="mathml-1" href="mathml-mediatype-1.xml" media-type="application/mathml+xml" fallback="content_001"/> | ||
<item id="mathml-2" href="mathml-mediatype-2.xml" media-type="application/mathml-presentation+xml" fallback="content_001"/> | ||
<item id="mathml-3" href="mathml-mediatype-3.xml" media-type="application/mathml-content+xml" fallback="content_001"/> | ||
<item id="svg" href="svg.svg" media-type="image/svg+xml"/> | ||
</manifest> | ||
<spine> | ||
<itemref idref="content_001" /> | ||
<itemref idref="svg"/> | ||
<itemref idref="mathml-1"/> | ||
<itemref idref="mathml-2"/> | ||
<itemref idref="mathml-3"/> | ||
</spine> | ||
</package> |
7 changes: 7 additions & 0 deletions
7
...t/resources/epub3/files/epub/xml-external-identifier-allowed-valid/EPUB/svg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
...t/resources/epub3/files/epub/xml-external-identifier-allowed-valid/META-INF/container.xml
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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | ||
<rootfiles> | ||
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> | ||
</rootfiles> | ||
</container> |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
...urces/epub3/files/epub/xml-external-identifier-bad-mediatype-error/EPUB/content_001.xhtml
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,11 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body> | ||
<h1 id="ch1">Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
</body> | ||
</html> |
14 changes: 14 additions & 0 deletions
14
...est/resources/epub3/files/epub/xml-external-identifier-bad-mediatype-error/EPUB/nav.xhtml
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,14 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>Minimal Nav</title> | ||
</head> | ||
<body> | ||
<nav epub:type="toc"> | ||
<ol> | ||
<li><a href="content_001.xhtml">content 001</a></li> | ||
</ol> | ||
</nav> | ||
</body> | ||
</html> |
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
src/test/resources/epub3/files/epub/xml-external-identifier-bad-mediatype-error/EPUB/toc.ncx
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,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
<ncx xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" | ||
xmlns="http://www.daisy.org/z3986/2005/ncx/" | ||
version="2005-1" | ||
xml:lang="en"> | ||
<head> | ||
<meta name="dtb:uid" content="NOID"/> | ||
<meta name="dtb:depth" content="1"/> | ||
<meta name="dtb:totalPageCount" content="0"/> | ||
<meta name="dtb:maxPageNumber" content="0"/> | ||
</head> | ||
<docTitle> | ||
<text>NCX</text> | ||
</docTitle> | ||
<navMap> | ||
<navPoint id="ch1" playOrder="1"> | ||
<navLabel> | ||
<text>Chapter 1</text> | ||
</navLabel> | ||
<content src="content_001.xhtml#ch1"/> | ||
</navPoint> | ||
</navMap> | ||
</ncx> |
6 changes: 6 additions & 0 deletions
6
...urces/epub3/files/epub/xml-external-identifier-bad-mediatype-error/META-INF/container.xml
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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> | ||
<rootfiles> | ||
<rootfile full-path="EPUB/package.opf" media-type="application/oebps-package+xml"/> | ||
</rootfiles> | ||
</container> |
1 change: 1 addition & 0 deletions
1
src/test/resources/epub3/files/epub/xml-external-identifier-bad-mediatype-error/mimetype
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 @@ | ||
application/epub+zip |
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
src/test/resources/epub3/files/epub/xml-external-identifier-disallowed-error/EPUB/nav.xhtml
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,14 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>Minimal Nav</title> | ||
</head> | ||
<body> | ||
<nav epub:type="toc"> | ||
<ol> | ||
<li><a href="content_001.xhtml">content 001</a></li> | ||
</ol> | ||
</nav> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
...test/resources/epub3/files/epub/xml-external-identifier-disallowed-error/EPUB/package.opf
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="q"> | ||
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> | ||
<dc:title id="title">Minimal EPUB 3.0</dc:title> | ||
<dc:language>en</dc:language> | ||
<dc:identifier id="q">NOID</dc:identifier> | ||
<meta property="dcterms:modified">2017-06-14T00:00:01Z</meta> | ||
</metadata> | ||
<manifest> | ||
<item id="content_001" href="content_001.xhtml" media-type="application/xhtml+xml"/> | ||
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/> | ||
<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" /> | ||
</manifest> | ||
<spine toc="ncx"> | ||
<itemref idref="content_001" /> | ||
</spine> | ||
</package> |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
src/test/resources/epub3/files/epub/xml-external-identifier-disallowed-error/mimetype
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 @@ | ||
application/epub+zip |
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