From 6fd290ddb5398fb626c5ed65b8d99091cccc9bcf Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Tue, 9 Sep 2014 00:46:43 +0200 Subject: [PATCH] Check XHTML Content Doc extension in EPUB 3 * make sure extension is '.xhtml', in `OPFChecker30` * remove duplicate `checkItem()` call in `OPFChecker` * Only report `HTM_014` for EPUB 2 (in `EpubHTML5StructureCheck`) * Add a new test for `HTM_014a` * Add a new test for `HTM_014` * Fix existing tests Fixes #447 --- .../ctc/EpubHTML5StructureCheck.java | 26 +++-- .../epubcheck/messages/MessageDictionary.java | 1 + .../adobe/epubcheck/messages/MessageId.java | 1 + .../com/adobe/epubcheck/opf/OPFChecker.java | 1 - .../com/adobe/epubcheck/opf/OPFChecker30.java | 9 +- .../messages/MessageBundle.properties | 3 +- .../api/Epub20CheckExpandedTest.java | 9 ++ .../api/Epub30CheckExpandedTest.java | 12 +- .../invalid/xhtml-extension/EPUB/lorem.css | 4 + .../invalid/xhtml-extension/EPUB/lorem.foo | 100 ++++++++++++++++ .../invalid/xhtml-extension/EPUB/lorem.ncx | 29 +++++ .../invalid/xhtml-extension/EPUB/lorem.opf | 17 +++ .../xhtml-extension/META-INF/container.xml | 7 ++ .../expanded/invalid/xhtml-extension/mimetype | 1 + .../resources/30/epub/invalid/issue265c.epub | Bin 15357 -> 14887 bytes .../resources/30/epub/valid/issue158.epub | Bin 2206 -> 2207 bytes .../invalid/xhtml-extension/EPUB/lorem.css | 4 + .../invalid/xhtml-extension/EPUB/lorem.html | 108 ++++++++++++++++++ .../invalid/xhtml-extension/EPUB/lorem.opf | 17 +++ .../xhtml-extension/META-INF/container.xml | 7 ++ .../expanded/invalid/xhtml-extension/mimetype | 1 + .../invalid/collection-invalid-do-sch-001.opf | 2 +- .../opf/valid/collection-valid-do-001.opf | 2 +- .../listSeverities_expected_results.txt | 3 +- ...eresting_paths_epub3_expected_results.json | 14 ++- ...teresting_paths_epub3_expected_results.xml | 1 + .../path_resolution/{A.html => A.xhtml} | 0 .../{Description.html => Description.xhtml} | 0 .../test/package/path_resolution/OPS/toc.ncx | 4 +- .../package/path_resolution/OPS/toc.xhtml | 4 +- .../test/package/path_resolution/content.opf | 4 +- .../path_resolution_expected_results.json | 32 +++--- .../test/xhtml/dtd_expected_results.json | 10 +- 33 files changed, 387 insertions(+), 46 deletions(-) create mode 100644 src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.css create mode 100644 src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.foo create mode 100644 src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.ncx create mode 100644 src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.opf create mode 100644 src/test/resources/20/expanded/invalid/xhtml-extension/META-INF/container.xml create mode 100644 src/test/resources/20/expanded/invalid/xhtml-extension/mimetype create mode 100644 src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.css create mode 100644 src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.html create mode 100644 src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.opf create mode 100644 src/test/resources/30/expanded/invalid/xhtml-extension/META-INF/container.xml create mode 100644 src/test/resources/30/expanded/invalid/xhtml-extension/mimetype rename src/test/resources/com/adobe/epubcheck/test/package/path_resolution/{A.html => A.xhtml} (100%) rename src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/{Description.html => Description.xhtml} (100%) diff --git a/src/main/java/com/adobe/epubcheck/ctc/EpubHTML5StructureCheck.java b/src/main/java/com/adobe/epubcheck/ctc/EpubHTML5StructureCheck.java index 5cc31aa69..b04fa8d16 100644 --- a/src/main/java/com/adobe/epubcheck/ctc/EpubHTML5StructureCheck.java +++ b/src/main/java/com/adobe/epubcheck/ctc/EpubHTML5StructureCheck.java @@ -1,5 +1,15 @@ package com.adobe.epubcheck.ctc; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Hashtable; +import java.util.Scanner; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + import com.adobe.epubcheck.api.Report; import com.adobe.epubcheck.ctc.epubpackage.EpubPackage; import com.adobe.epubcheck.ctc.epubpackage.ManifestItem; @@ -15,16 +25,6 @@ import com.adobe.epubcheck.util.SearchDictionary; import com.adobe.epubcheck.util.SearchDictionary.DictionaryType; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Hashtable; -import java.util.Scanner; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - public class EpubHTML5StructureCheck implements DocumentValidator { static final int hasHtml = 1; @@ -113,8 +113,12 @@ else if (prop.equals("rendition:layout-reflowable")) /***VALIDATE FILE EXTENSION***/ String fileExtension = mi.getHref().substring(mi.getHref().lastIndexOf('.') + 1, mi.getHref().length()); - if (!(fileExtension.compareToIgnoreCase("html") == 0 || fileExtension.compareToIgnoreCase("htm") == 0 || fileExtension.compareToIgnoreCase("xhtml") == 0)) + if (epubPackage.getVersion() == EPUBVersion.VERSION_2 + && !(fileExtension.compareToIgnoreCase("html") == 0 + || fileExtension.compareToIgnoreCase("htm") == 0 + || fileExtension.compareToIgnoreCase("xhtml") == 0)) { + // Note: extension is already checked in OPFChecker30 for EPUB 3 report.message(MessageId.HTM_014, new MessageLocation(mi.getHref(), -1, -1)); } diff --git a/src/main/java/com/adobe/epubcheck/messages/MessageDictionary.java b/src/main/java/com/adobe/epubcheck/messages/MessageDictionary.java index 947eae759..b4fe16e6d 100644 --- a/src/main/java/com/adobe/epubcheck/messages/MessageDictionary.java +++ b/src/main/java/com/adobe/epubcheck/messages/MessageDictionary.java @@ -134,6 +134,7 @@ static Map getDefaultSeverities() map.put(MessageId.HTM_012, Severity.USAGE); map.put(MessageId.HTM_013, Severity.USAGE); map.put(MessageId.HTM_014, Severity.WARNING); + map.put(MessageId.HTM_014a, Severity.WARNING); map.put(MessageId.HTM_015, Severity.WARNING); map.put(MessageId.HTM_016, Severity.WARNING); map.put(MessageId.HTM_017, Severity.ERROR); diff --git a/src/main/java/com/adobe/epubcheck/messages/MessageId.java b/src/main/java/com/adobe/epubcheck/messages/MessageId.java index 3d0bdd3a1..e111a6533 100644 --- a/src/main/java/com/adobe/epubcheck/messages/MessageId.java +++ b/src/main/java/com/adobe/epubcheck/messages/MessageId.java @@ -98,6 +98,7 @@ public enum MessageId implements Comparable HTM_012("HTM-012"), HTM_013("HTM-013"), HTM_014("HTM-014"), + HTM_014a("HTM-014a"), HTM_015("HTM-015"), HTM_016("HTM-016"), HTM_017("HTM-017"), diff --git a/src/main/java/com/adobe/epubcheck/opf/OPFChecker.java b/src/main/java/com/adobe/epubcheck/opf/OPFChecker.java index c21e0e34c..790f19ab5 100755 --- a/src/main/java/com/adobe/epubcheck/opf/OPFChecker.java +++ b/src/main/java/com/adobe/epubcheck/opf/OPFChecker.java @@ -156,7 +156,6 @@ public void runChecks() } report.info(item.getPath(), FeatureEnum.DECLARED_MIMETYPE, item.getMimeType()); - checkItem(item, opfHandler); } checkGuide(); diff --git a/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java b/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java index a52951149..f33dca9f4 100644 --- a/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java +++ b/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java @@ -38,6 +38,7 @@ import com.adobe.epubcheck.util.EPUBVersion; import com.adobe.epubcheck.util.GenericResourceProvider; import com.adobe.epubcheck.xml.XMLValidator; +import com.google.common.io.Files; public class OPFChecker30 extends OPFChecker implements DocumentValidator { @@ -109,7 +110,13 @@ protected void checkItem(OPFItem item, OPFHandler opfHandler) // "invalid content for media-type attribute"); return; } - + + if ("application/xhtml+xml".equals(mimeType) && !"xhtml".equals(Files.getFileExtension(item.getPath()))) + { + report.message(MessageId.HTM_014a, + new MessageLocation(path, item.getLineNumber(), item.getColumnNumber()), item.getPath()); + } + if (fallback != null) { OPFItem fallbackItem = opfHandler.getItemById(fallback); diff --git a/src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties b/src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties index 562cba49e..d7c212d65 100644 --- a/src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties +++ b/src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties @@ -80,7 +80,8 @@ HTM_011=Entity is undeclared. HTM_011_SUG=Define the entity or use the numbered entity instead. HTM_012=Found a link to a CFI in an external book. HTM_013=Intra-Publication CFIs found in document. -HTM_014=Invalid file extension for HTML5 file, expecting (html, htm or xhtml). +HTM_014=Invalid file extension for HTML file, expecting (html, htm or xhtml). +HTM_014a=XHTML Content Document file name '%1$s' should have the extension '.xhtml'. HTM_015=HTML4 DOCTYPE definition within ePub v3. HTM_016=HTML5 DOCTYPE definition within ePub v2. HTM_017=Content file has different language value in attributes xml:lang and lang. diff --git a/src/test/java/com/adobe/epubcheck/api/Epub20CheckExpandedTest.java b/src/test/java/com/adobe/epubcheck/api/Epub20CheckExpandedTest.java index 8541116ef..1fbf1279b 100644 --- a/src/test/java/com/adobe/epubcheck/api/Epub20CheckExpandedTest.java +++ b/src/test/java/com/adobe/epubcheck/api/Epub20CheckExpandedTest.java @@ -150,4 +150,13 @@ public void testValidateEPUB20_issue267() { List expectedWarnings = new ArrayList(); testValidateDocument("valid/issue267/", expectedErrors, expectedWarnings, "valid/issue267.txt"); } + + @Test + public void testXHTMLExtension() + { + List expectedErrors = new ArrayList(); + List expectedWarnings = new ArrayList(); + Collections.addAll(expectedWarnings, MessageId.HTM_014); + testValidateDocument("invalid/xhtml-extension", expectedErrors, expectedWarnings); + } } diff --git a/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java b/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java index c5722d7ba..c9404c889 100644 --- a/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java +++ b/src/test/java/com/adobe/epubcheck/api/Epub30CheckExpandedTest.java @@ -476,7 +476,7 @@ public void testValidateEPUB30_circularFallback() public void testValidateEPUB30_nonresolvingFallback() { List expectedErrors = new ArrayList(); - Collections.addAll(expectedErrors, MessageId.RSC_005, MessageId.OPF_040, MessageId.OPF_040, MessageId.MED_003); + Collections.addAll(expectedErrors, MessageId.RSC_005, MessageId.OPF_040, MessageId.MED_003); List expectedWarnings = new ArrayList(); //dupe messages, tbf testValidateDocument("invalid/fallbacks-nonresolving/", expectedErrors, expectedWarnings); @@ -694,4 +694,14 @@ public void testCollectionPreview() { testValidateDocument("valid/collections-preview/", expectedErrors, expectedWarnings, expectedFatals,true); } + @Test + public void testXHTMExtension() + { + List expectedErrors = new ArrayList(); + List expectedWarnings = new ArrayList(); + List expectedFatals = new ArrayList(); + Collections.addAll(expectedWarnings, MessageId.HTM_014a); + testValidateDocument("invalid/xhtml-extension", expectedErrors, expectedWarnings, expectedFatals, true); + } + } diff --git a/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.css b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.css new file mode 100644 index 000000000..59fa2ede4 --- /dev/null +++ b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.css @@ -0,0 +1,4 @@ +body { + color:black; + font-family: arial, helvetica, sans-serif; +} \ No newline at end of file diff --git a/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.foo b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.foo new file mode 100644 index 000000000..52731c69d --- /dev/null +++ b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.foo @@ -0,0 +1,100 @@ + + + + + Lorem Ipsum + + + +

Lorem Ipsum

+
+

Chapter 1

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vel purus mauris, ut + auctor massa. Pellentesque non nunc risus. Fusce a massa augue. Nunc erat ante, + auctor id varius ac, vestibulum non purus. Quisque non dui in sem consectetur + condimentum non ac quam. Quisque ultricies nulla nec urna fringilla pretium. + Pellentesque dictum pulvinar purus in mattis. Aliquam vestibulum orci sed magna + vestibulum a sollicitudin lectus pharetra. Suspendisse luctus risus imperdiet nunc + condimentum malesuada. Nulla fringilla vulputate vestibulum. Sed diam dui, fringilla + quis sagittis nec, viverra et nibh.

+ +

Sed sollicitudin accumsan augue, quis pulvinar sem volutpat at. Vestibulum rutrum + bibendum augue sit amet accumsan. Etiam tempus malesuada libero vestibulum + fringilla. Maecenas diam nulla, ultricies ac sodales vitae, viverra ut velit. + Vivamus posuere, mi sit amet vehicula tempus, nibh purus scelerisque enim, non + vestibulum erat arcu in libero. Aliquam vel convallis nibh. Sed in nisi ipsum. Sed + sed est justo, in lacinia nulla.

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed luctus est vel lacus + ullamcorper vestibulum. Mauris est sapien, pharetra id feugiat in, ornare a erat. + Nam consectetur vehicula nisi vel faucibus. Morbi blandit augue nec lacus malesuada + venenatis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur + ridiculus mus. Maecenas consectetur, odio vitae suscipit ullamcorper, arcu ligula + pellentesque sem, quis rhoncus enim eros id lectus. Nam ornare dui est, vel posuere + metus. Quisque non nisl metus. Pellentesque id mi nunc, in gravida metus. Nullam + neque tellus, ultricies quis laoreet vitae, imperdiet at nunc. Ut laoreet massa quis + quam vulputate et ultricies nibh consectetur. Donec convallis, nulla id ultricies + ullamcorper, diam tortor interdum dolor, vel tempor lectus urna ut est. Praesent + convallis lacus vitae justo lobortis euismod. In at ante elit.

+ +

Aenean quis consectetur justo. Nulla nec enim nisl. Etiam rutrum volutpat tellus, a + scelerisque mauris malesuada sit amet. Suspendisse quis urna augue. Proin tempus + hendrerit libero non cursus. Praesent non massa at nisl luctus facilisis. Nullam + pulvinar, ligula eu porta ornare, mi mi accumsan orci, a iaculis tortor lorem quis + dolor. Phasellus ante nibh, pulvinar ac pulvinar eu, pulvinar ac enim.

+ +

Donec vel velit id elit volutpat vestibulum vitae a erat. Duis id est id magna + aliquam pretium nec sit amet nibh. Nullam condimentum suscipit felis, sed interdum + felis dictum ac. Phasellus non nisi quis magna pellentesque auctor. Cras risus + lectus, viverra eu fringilla malesuada, rhoncus et est. Etiam rhoncus pharetra + accumsan. Nullam suscipit tellus felis.

+
+
+

Chapter 2

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet nibh felis. + Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia + Curae; Etiam est sapien, dapibus eget gravida nec, accumsan a turpis. Nunc in nisi + ut dolor elementum porttitor. Mauris hendrerit pulvinar tincidunt. Etiam metus + metus, ullamcorper ut varius lacinia, luctus et nibh. Donec ut metus enim, id + faucibus nunc. Quisque ut iaculis mauris. Duis pellentesque nulla ut eros ultricies + quis condimentum eros adipiscing. Sed porta ultrices diam, ut sagittis lectus mattis + a. Phasellus gravida, sapien vitae mollis interdum, dui neque tempor arcu, ac ornare + leo ipsum ut nisl.

+ +

Donec porta, odio et aliquet molestie, felis tellus fermentum leo, id interdum magna + massa quis ligula. Integer elementum mauris eget nisl eleifend facilisis nec sit + amet tellus. Morbi consectetur dignissim egestas. Donec pulvinar, enim eu auctor + cursus, turpis arcu venenatis turpis, eu cursus magna nisl sit amet ante. Curabitur + eleifend arcu eget nibh facilisis mattis. Etiam nisl nunc, semper vitae condimentum + sed, viverra sit amet lacus. Curabitur et orci augue. Suspendisse sollicitudin + vulputate risus, sit amet consequat erat mollis eu. Nunc sodales tincidunt + tincidunt.

+ +

Aliquam erat volutpat. Aliquam ornare augue et nulla consequat commodo. Quisque + dictum rhoncus orci vel euismod. Proin leo turpis, adipiscing quis facilisis id, + condimentum sed metus. Nullam pellentesque scelerisque est nec tristique. Nunc augue + turpis, consequat non varius quis, aliquam auctor dolor. Cras luctus dignissim justo + sit amet laoreet. Quisque vel ipsum quis massa suscipit vehicula.

+ +

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis + egestas. Vivamus fringilla eleifend magna, vel commodo turpis egestas at. + Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis + egestas. Sed eu lorem quam, et sagittis libero. Maecenas vel ante id sem bibendum + laoreet nec dignissim justo. Class aptent taciti sociosqu ad litora torquent per + conubia nostra, per inceptos himenaeos. Fusce eu lorem orci, eu viverra nisi. Lorem + ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum dapibus commodo + pellentesque. Maecenas quis est accumsan est interdum pharetra egestas nec lorem. + Nam a lectus sit amet justo facilisis suscipit.

+ +

Integer dolor dolor, volutpat id commodo id, gravida id risus. Donec consectetur + sollicitudin sem, non auctor urna pulvinar non. Vivamus ipsum nisi, commodo sed + scelerisque id, porta nec massa. Vestibulum ac risus et augue faucibus fermentum ut + et nisi. Integer tincidunt suscipit ipsum, sed interdum felis mollis sed. + Suspendisse potenti. Praesent et mauris et quam consequat tristique. Morbi mi dolor, + pharetra quis rutrum quis, fringilla in tortor. Sed a nulla vitae leo dapibus + cursus. Aliquam erat volutpat. Integer purus purus, dictum id bibendum at, lobortis + quis metus.

+
+ + diff --git a/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.ncx b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.ncx new file mode 100644 index 000000000..143423c3a --- /dev/null +++ b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.ncx @@ -0,0 +1,29 @@ + + + + + + + + + + Lorem Ipsum + + + + + Chapter 1 + + + + + + Chapter 2 + + + + + \ No newline at end of file diff --git a/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.opf b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.opf new file mode 100644 index 000000000..063de9f27 --- /dev/null +++ b/src/test/resources/20/expanded/invalid/xhtml-extension/EPUB/lorem.opf @@ -0,0 +1,17 @@ + + + + urn:uuid:550e8400-e29b-41d4-a716-4466674412314 + Lorem Ipsum + la + 2011-09-01 + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/20/expanded/invalid/xhtml-extension/META-INF/container.xml b/src/test/resources/20/expanded/invalid/xhtml-extension/META-INF/container.xml new file mode 100644 index 000000000..a92c6ad86 --- /dev/null +++ b/src/test/resources/20/expanded/invalid/xhtml-extension/META-INF/container.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/src/test/resources/20/expanded/invalid/xhtml-extension/mimetype b/src/test/resources/20/expanded/invalid/xhtml-extension/mimetype new file mode 100644 index 000000000..57ef03f24 --- /dev/null +++ b/src/test/resources/20/expanded/invalid/xhtml-extension/mimetype @@ -0,0 +1 @@ +application/epub+zip \ No newline at end of file diff --git a/src/test/resources/30/epub/invalid/issue265c.epub b/src/test/resources/30/epub/invalid/issue265c.epub index 0a69ba63d478e9ef626e501ce442227101b2d09d..609acb7dc1979cc1c1429ac2489d748d3c648759 100644 GIT binary patch delta 810 zcmexczPyAZz?+$ci-Cb-B8N>q2L}hkEe1_j1|+}-WV;50I_c-+7p3Ov!)t?J@Jl>(Q<3h(vXR(zFeB!-5$I8*p6c<=Kt-Eai6~QM8eOY>iz7Q z=8GyUwo2`7cpaMVbw;>NaK^65r`~w~dHqxR=EL?^%Qh_fr~R$Iq3PBaRlAD(Vz2(= z$%~fcPCEBC^VE%LW!nyNzbiY!>-JZ=L4)(yYPUx1j|)`RR5}GNvbo%?LT5otl zPg$tHnP(t3b>p@b$1*0A&SiZb@2!)~zwYg4Ga2TFjNi3l``-QjYPYe#_j|!7ldzYn>qG5a z^QSic-^6v~K>r;>!>C%D!&`M~)wN$p%5t;L{kQHFZ-6&D$Jt`tmn#?<82XqQ7+{e- z`68<#b45nU!~%`YvTPhu;1saYO_LGKm|V=b0K&M)D!ti7!BVQ;o*9%z7#MuYw>xRq zu5yw9rV0=S3Za4A%-qzH%7WAYZ$>721`!5WnnHF4C`}=N9gvBd!oYfwY}A{4gOy(c zp+kuYs>8=W$kkU5=#ktUgr3Pet>jo37^-9@-?oxrgSdS1Un@B|28QLbC{`sG7b9uA V$STHzu)|w!@>Odkw#618Apk{8D}?|6 delta 1150 zcmb7EL5tHs7){&lvQ%&{i!95w#yN;0=_K83+k_;@!lJTWEV6*zVLh+T7%ktb20C-fM7 ze_uvzRhA{x&|XTa;;NF}Qks&gHk-|ssw#~=MK$OdOFY?V3x0x$hpY}0ES5k~qO^3St;?=_YCzUE_m{sjgRN{x!?y$6Lorzri3ycPy#qu6;vhmj z6J+;18W7(DiwQ7_O%T}UKulj$w;%A$d-URg2rZ_4dF2{%^2UO^^Z3c(asAoDljBat zHThpICyp0n*`&PSBNy8e8Hb2UK_dcr6<#^9qTGl>9H4B^XQLZzQYxN0!7X5BA$6;=XEjmX>n9dC97TeImV{WGkF gJ@2Kn*TmWMdwC97y2@1$o$HpE{?@?ySZB0<05JJ9p#T5? diff --git a/src/test/resources/30/epub/valid/issue158.epub b/src/test/resources/30/epub/valid/issue158.epub index 4783771ee55692132eaaa5a96f511de51470904d..88d59429210feea46654d72e88d8961b5561164f 100644 GIT binary patch delta 419 zcmbOyIA4$>z?+$ci-Cb-B8R0C2M5Cp!&rxfCm3`tF)%QMGBPmm18IL(r+{Gnyu>oS zipg$lH^d+sI2cM8G+onvFO4u|Vqjop-E73D%B24<{g7YF6r8QEQM zbDYw@$@zMfL(jo@sn`EAuU?gh+v;?mkz?|GcCpQKnY9=hIX0hQiD0Z}WU^-lxrqVn zoczSqIwC-4fG|)94diC#rj}F|qy~7ybYb@dLYozkiR7h>lH44yW(JUzAYaKMdy9cV z5TO;wvYdR7U4jkbzR5A{QcxGoWu9EeE&~(44;Qaxnas!`0uz_!kkW;iwvQF&h?4wd Yy}aa#0B=?{kQ5sb<^ls=h8@HM0PW9HO8@`> delta 490 zcmbO)I8Trxz?+$ci-Cb*B8Md-!{nvR_XQa^7-ks8I@llS$T4GLVED(fIgnA6$za+4 zsrknf{(A5&Gsu?do1f6MyM=#AAph0HuP$tn6G;Bhf9zL$ROwfCn1P#HSsWM{88#nd zjbK!R*a0zk;RyzvOF$b#85tP(fV97>Q$VnOUSgTv#N-VY_}ATc>RF+Ei;zaR}^*JK$Esd|X9^~^Ap28MbS86~+n2xSmk zvaIe#8Uqyv07H})#g+psFuf)D$$ELo73f;g!wcaXIW{$zUQqBs>}6#GDPRM_9H4zN H>>wTh0cUG{ diff --git a/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.css b/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.css new file mode 100644 index 000000000..59fa2ede4 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.css @@ -0,0 +1,4 @@ +body { + color:black; + font-family: arial, helvetica, sans-serif; +} \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.html b/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.html new file mode 100644 index 000000000..ce440bb00 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.html @@ -0,0 +1,108 @@ + + + + Lorem Ipsum + + + +

Lorem Ipsum

+
+

Table of Contents

+ +
+
+

Chapter 1

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vel purus mauris, ut + auctor massa. Pellentesque non nunc risus. Fusce a massa augue. Nunc erat ante, + auctor id varius ac, vestibulum non purus. Quisque non dui in sem consectetur + condimentum non ac quam. Quisque ultricies nulla nec urna fringilla pretium. + Pellentesque dictum pulvinar purus in mattis. Aliquam vestibulum orci sed magna + vestibulum a sollicitudin lectus pharetra. Suspendisse luctus risus imperdiet nunc + condimentum malesuada. Nulla fringilla vulputate vestibulum. Sed diam dui, fringilla + quis sagittis nec, viverra et nibh.

+ +

Sed sollicitudin accumsan augue, quis pulvinar sem volutpat at. Vestibulum rutrum + bibendum augue sit amet accumsan. Etiam tempus malesuada libero vestibulum + fringilla. Maecenas diam nulla, ultricies ac sodales vitae, viverra ut velit. + Vivamus posuere, mi sit amet vehicula tempus, nibh purus scelerisque enim, non + vestibulum erat arcu in libero. Aliquam vel convallis nibh. Sed in nisi ipsum. Sed + sed est justo, in lacinia nulla.

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed luctus est vel lacus + ullamcorper vestibulum. Mauris est sapien, pharetra id feugiat in, ornare a erat. + Nam consectetur vehicula nisi vel faucibus. Morbi blandit augue nec lacus malesuada + venenatis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur + ridiculus mus. Maecenas consectetur, odio vitae suscipit ullamcorper, arcu ligula + pellentesque sem, quis rhoncus enim eros id lectus. Nam ornare dui est, vel posuere + metus. Quisque non nisl metus. Pellentesque id mi nunc, in gravida metus. Nullam + neque tellus, ultricies quis laoreet vitae, imperdiet at nunc. Ut laoreet massa quis + quam vulputate et ultricies nibh consectetur. Donec convallis, nulla id ultricies + ullamcorper, diam tortor interdum dolor, vel tempor lectus urna ut est. Praesent + convallis lacus vitae justo lobortis euismod. In at ante elit.

+ +

Aenean quis consectetur justo. Nulla nec enim nisl. Etiam rutrum volutpat tellus, a + scelerisque mauris malesuada sit amet. Suspendisse quis urna augue. Proin tempus + hendrerit libero non cursus. Praesent non massa at nisl luctus facilisis. Nullam + pulvinar, ligula eu porta ornare, mi mi accumsan orci, a iaculis tortor lorem quis + dolor. Phasellus ante nibh, pulvinar ac pulvinar eu, pulvinar ac enim.

+ +

Donec vel velit id elit volutpat vestibulum vitae a erat. Duis id est id magna + aliquam pretium nec sit amet nibh. Nullam condimentum suscipit felis, sed interdum + felis dictum ac. Phasellus non nisi quis magna pellentesque auctor. Cras risus + lectus, viverra eu fringilla malesuada, rhoncus et est. Etiam rhoncus pharetra + accumsan. Nullam suscipit tellus felis.

+
+
+

Chapter 2

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla laoreet nibh felis. + Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia + Curae; Etiam est sapien, dapibus eget gravida nec, accumsan a turpis. Nunc in nisi + ut dolor elementum porttitor. Mauris hendrerit pulvinar tincidunt. Etiam metus + metus, ullamcorper ut varius lacinia, luctus et nibh. Donec ut metus enim, id + faucibus nunc. Quisque ut iaculis mauris. Duis pellentesque nulla ut eros ultricies + quis condimentum eros adipiscing. Sed porta ultrices diam, ut sagittis lectus mattis + a. Phasellus gravida, sapien vitae mollis interdum, dui neque tempor arcu, ac ornare + leo ipsum ut nisl.

+ +

Donec porta, odio et aliquet molestie, felis tellus fermentum leo, id interdum magna + massa quis ligula. Integer elementum mauris eget nisl eleifend facilisis nec sit + amet tellus. Morbi consectetur dignissim egestas. Donec pulvinar, enim eu auctor + cursus, turpis arcu venenatis turpis, eu cursus magna nisl sit amet ante. Curabitur + eleifend arcu eget nibh facilisis mattis. Etiam nisl nunc, semper vitae condimentum + sed, viverra sit amet lacus. Curabitur et orci augue. Suspendisse sollicitudin + vulputate risus, sit amet consequat erat mollis eu. Nunc sodales tincidunt + tincidunt.

+ +

Aliquam erat volutpat. Aliquam ornare augue et nulla consequat commodo. Quisque + dictum rhoncus orci vel euismod. Proin leo turpis, adipiscing quis facilisis id, + condimentum sed metus. Nullam pellentesque scelerisque est nec tristique. Nunc augue + turpis, consequat non varius quis, aliquam auctor dolor. Cras luctus dignissim justo + sit amet laoreet. Quisque vel ipsum quis massa suscipit vehicula.

+ +

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis + egestas. Vivamus fringilla eleifend magna, vel commodo turpis egestas at. + Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis + egestas. Sed eu lorem quam, et sagittis libero. Maecenas vel ante id sem bibendum + laoreet nec dignissim justo. Class aptent taciti sociosqu ad litora torquent per + conubia nostra, per inceptos himenaeos. Fusce eu lorem orci, eu viverra nisi. Lorem + ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum dapibus commodo + pellentesque. Maecenas quis est accumsan est interdum pharetra egestas nec lorem. + Nam a lectus sit amet justo facilisis suscipit.

+ +

Integer dolor dolor, volutpat id commodo id, gravida id risus. Donec consectetur + sollicitudin sem, non auctor urna pulvinar non. Vivamus ipsum nisi, commodo sed + scelerisque id, porta nec massa. Vestibulum ac risus et augue faucibus fermentum ut + et nisi. Integer tincidunt suscipit ipsum, sed interdum felis mollis sed. + Suspendisse potenti. Praesent et mauris et quam consequat tristique. Morbi mi dolor, + pharetra quis rutrum quis, fringilla in tortor. Sed a nulla vitae leo dapibus + cursus. Aliquam erat volutpat. Integer purus purus, dictum id bibendum at, lobortis + quis metus.

+
+ + diff --git a/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.opf b/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.opf new file mode 100644 index 000000000..569bc97da --- /dev/null +++ b/src/test/resources/30/expanded/invalid/xhtml-extension/EPUB/lorem.opf @@ -0,0 +1,17 @@ + + + + urn:uuid:550e8400-e29b-41d4-a716-4466674412314 + Lorem Ipsum + la + 2011-09-01 + 2011-09-01T17:18:00Z + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/xhtml-extension/META-INF/container.xml b/src/test/resources/30/expanded/invalid/xhtml-extension/META-INF/container.xml new file mode 100644 index 000000000..a92c6ad86 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/xhtml-extension/META-INF/container.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/src/test/resources/30/expanded/invalid/xhtml-extension/mimetype b/src/test/resources/30/expanded/invalid/xhtml-extension/mimetype new file mode 100644 index 000000000..57ef03f24 --- /dev/null +++ b/src/test/resources/30/expanded/invalid/xhtml-extension/mimetype @@ -0,0 +1 @@ +application/epub+zip \ No newline at end of file diff --git a/src/test/resources/30/single/opf/invalid/collection-invalid-do-sch-001.opf b/src/test/resources/30/single/opf/invalid/collection-invalid-do-sch-001.opf index b586e333f..d0f3b6f50 100644 --- a/src/test/resources/30/single/opf/invalid/collection-invalid-do-sch-001.opf +++ b/src/test/resources/30/single/opf/invalid/collection-invalid-do-sch-001.opf @@ -60,7 +60,7 @@ - + diff --git a/src/test/resources/30/single/opf/valid/collection-valid-do-001.opf b/src/test/resources/30/single/opf/valid/collection-valid-do-001.opf index bbc5bec47..f6096c0fe 100644 --- a/src/test/resources/30/single/opf/valid/collection-valid-do-001.opf +++ b/src/test/resources/30/single/opf/valid/collection-valid-do-001.opf @@ -59,7 +59,7 @@ - + diff --git a/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt b/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt index 13f7bcbdb..f62671bd8 100644 --- a/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt +++ b/src/test/resources/com/adobe/epubcheck/test/command_line/listSeverities_expected_results.txt @@ -61,7 +61,8 @@ HTM-010 USAGE Namespace uri '%1$s' was found. HTM-011 ERROR Entity is undeclared. Define the entity or use the numbered entity instead. HTM-012 USAGE Found a link to a CFI in an external book. HTM-013 USAGE Intra-Publication CFIs found in document. -HTM-014 WARNING Invalid file extension for HTML5 file, expecting (html, htm or xhtml). +HTM-014 WARNING Invalid file extension for HTML file, expecting (html, htm or xhtml). +HTM-014a WARNING XHTML Content Document file name '%1$s' should have the extension '.xhtml'. HTM-015 WARNING HTML4 DOCTYPE definition within ePub v3. HTM-016 WARNING HTML5 DOCTYPE definition within ePub v2. HTM-017 ERROR Content file has different language value in attributes xml:lang and lang. diff --git a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json index 0a424d024..d4c77b84c 100644 --- a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json +++ b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.json @@ -8,7 +8,7 @@ "elapsedTime" : 125, "nFatal" : 0, "nError" : 4, - "nWarning" : 2, + "nWarning" : 3, "nUsage" : 5 }, "publication" : { @@ -328,6 +328,18 @@ "context" : "" } ], "suggestion" : null + }, { + "ID" : "HTM-014a", + "severity" : "WARNING", + "message" : "XHTML Content Document file name 'OPS Content/Cyrillic_phi.html' should have the extension '.xhtml'.", + "additionalLocations" : 0, + "locations" : [ { + "fileName" : "OPS Content/content.opf", + "line" : 14, + "column" : 86, + "context" : null + } ], + "suggestion" : null }, { "ID" : "OPF-003", "severity" : "WARNING", diff --git a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml index 687a7eadf..bb609e369 100644 --- a/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml +++ b/src/test/resources/com/adobe/epubcheck/test/package/interesting_paths_epub3_expected_results.xml @@ -12,6 +12,7 @@ RSC-001, ERROR, [File 'OPS Content/style.' is not found.], interesting_paths_epub3.epub RSC-007, ERROR, [Referenced resource is not found in the ePub.], OPS Content/More XHTML Content/page01.xhtml (13-35) PKG-009, ERROR, [File name contains characters that are not allowed in OCF file names: '"{","}"'.], OPS Content/page{03}.xhtml + HTM-014a, WARN, [XHTML Content Document file name 'OPS Content/Cyrillic_phi.html' should have the extension '.xhtml'.], OPS Content/content.opf (14-86) PKG-010, WARN, [Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename.], OPS Content/More XHTML Content/page01.xhtml PKG-010, WARN, [Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename.], OPS Content/toc.xhtml PKG-010, WARN, [Filename contains spaces, therefore URI escaping is necessary. Consider removing spaces from filename.], OPS Content/page{03}.xhtml diff --git a/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/A.html b/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/A.xhtml similarity index 100% rename from src/test/resources/com/adobe/epubcheck/test/package/path_resolution/A.html rename to src/test/resources/com/adobe/epubcheck/test/package/path_resolution/A.xhtml diff --git a/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/Description.html b/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/Description.xhtml similarity index 100% rename from src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/Description.html rename to src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/Description.xhtml diff --git a/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.ncx b/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.ncx index 369340a19..4df2fce88 100644 --- a/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.ncx +++ b/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.ncx @@ -13,9 +13,9 @@ - Description.html + Description.xhtml - + diff --git a/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.xhtml b/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.xhtml index 122776b5c..5f9fc09a6 100644 --- a/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.xhtml +++ b/src/test/resources/com/adobe/epubcheck/test/package/path_resolution/OPS/toc.xhtml @@ -8,8 +8,8 @@