-
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.
fix: do not check entity references in comment or CDATA
- suppress poorly implemented checks `HTM-023` and `HTM-024` (entity references are already checked at parsing time) - add more tests for entity references Fixes #800
- Loading branch information
Showing
14 changed files
with
535 additions
and
97 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
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
6 changes: 6 additions & 0 deletions
6
src/test/resources/30/expanded/valid/entities-in-comment-or-cdata/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="OPS/package.opf" media-type="application/oebps-package+xml"/> | ||
</rootfiles> | ||
</container> |
19 changes: 19 additions & 0 deletions
19
src/test/resources/30/expanded/valid/entities-in-comment-or-cdata/OPS/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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Minimal EPUB</title> | ||
</head> | ||
<body epub:type="bodymatter"> | ||
<h1>Loomings</h1> | ||
<p>Call me Ishmael.</p> | ||
<!-- this is a valid entity reference --> | ||
& | ||
<!-- this is a valid character reference --> | ||
& | ||
<!-- this is not an entity reference, as it’s in a comment --> | ||
<!-- &foo; --> | ||
<!-- this is not an entity reference, as it’s in a CDATA section --> | ||
<![CDATA[&foo;]]> | ||
</body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
src/test/resources/30/expanded/valid/entities-in-comment-or-cdata/OPS/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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Minimal Nav</title> | ||
</head> | ||
<body> | ||
<nav epub:type="toc"> | ||
<ol> | ||
<li><a href="content_001.xhtml">content 001</a></li> | ||
</ol> | ||
</nav> | ||
<nav epub:type="landmarks"> | ||
<ol> | ||
<li><a href="content_001.xhtml" epub:type="bodymatter">Start Reading</a></li> | ||
</ol> | ||
</nav> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
src/test/resources/30/expanded/valid/entities-in-comment-or-cdata/OPS/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,16 @@ | ||
<?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"/> | ||
</manifest> | ||
<spine> | ||
<itemref idref="content_001" /> | ||
</spine> | ||
</package> |
1 change: 1 addition & 0 deletions
1
src/test/resources/30/expanded/valid/entities-in-comment-or-cdata/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 |
10 changes: 10 additions & 0 deletions
10
src/test/resources/30/single/xhtml/invalid/entities-missing-semicolon.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,10 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Test</title> | ||
</head> | ||
<body> | ||
<!-- this entity reference is missing the final semicolon --> | ||
& | ||
</body> | ||
</html> |
10 changes: 10 additions & 0 deletions
10
src/test/resources/30/single/xhtml/invalid/entities-unknown.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,10 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Test</title> | ||
</head> | ||
<body> | ||
<!-- this entity reference uses an unknown entity name --> | ||
&foo; | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
src/test/resources/30/single/xhtml/valid/entities-internal.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,13 @@ | ||
<?xml version="1.0" standalone="yes" ?> | ||
<!DOCTYPE html [ | ||
<!ENTITY foo "foo"> | ||
]> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | ||
<head> | ||
<title>Test</title> | ||
</head> | ||
<body> | ||
<!-- entity declarations are not allowed --> | ||
&foo; | ||
</body> | ||
</html> |
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,16 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<title>Test</title> | ||
</head> | ||
<body> | ||
<!-- this is a valid entity reference --> | ||
& | ||
<!-- this is a valid character reference --> | ||
& | ||
<!-- this is not an entity reference, as it’s in a comment --> | ||
<!-- &foo; --> | ||
<!-- this is not an entity reference, as it’s in a CDATA section --> | ||
<![CDATA[&foo;]]> | ||
</body> | ||
</html> |
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
Oops, something went wrong.