From f20e89051c5b7cfaeff25af87fa60c54749ae8e3 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Fri, 1 May 2020 10:01:34 +0200 Subject: [PATCH] feat: report empty `title` elements in XHTML Content Documents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Empty or whitespace-only `title` elements are disallowed in HTML: https://html.spec.whatwg.org/#the-title-element Nu HTML Checker checks this with Java Code, so it’s not exposed in EPUBCheck (which only uses the Checkr’s schemas). This change re-implements the check in Schematron. Fixes #1093 --- .../com/adobe/epubcheck/schema/30/epub-xhtml-30.sch | 7 +++++++ .../java/com/adobe/epubcheck/ops/OPSCheckerTest.java | 8 ++++++++ .../resources/30/single/xhtml/invalid/issue153.xhtml | 2 +- .../30/single/xhtml/invalid/title-empty.xhtml | 10 ++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/30/single/xhtml/invalid/title-empty.xhtml diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch index 5cbbf029d..40d0213ec 100644 --- a/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch +++ b/src/main/resources/com/adobe/epubcheck/schema/30/epub-xhtml-30.sch @@ -28,6 +28,13 @@ + + + Element "title" must not be empty. + + + - + Test diff --git a/src/test/resources/30/single/xhtml/invalid/title-empty.xhtml b/src/test/resources/30/single/xhtml/invalid/title-empty.xhtml new file mode 100644 index 000000000..c811cc75b --- /dev/null +++ b/src/test/resources/30/single/xhtml/invalid/title-empty.xhtml @@ -0,0 +1,10 @@ + + + + + + + +

Test

+ +