Skip to content

Commit e3d3afe

Browse files
committed
feat: report empty URL as a schema error instead of HTM-008
This change effectively removes `HTM-008` by integrating (the emptyness part of) the check for valid non-empty URL in the RelaxNG schema.
1 parent 419f651 commit e3d3afe

File tree

6 files changed

+5
-13
lines changed

6 files changed

+5
-13
lines changed

src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private void initialize()
102102
severities.put(MessageId.HTM_005, Severity.USAGE);
103103
severities.put(MessageId.HTM_006, Severity.SUPPRESSED);
104104
severities.put(MessageId.HTM_007, Severity.WARNING);
105-
severities.put(MessageId.HTM_008, Severity.ERROR);
105+
severities.put(MessageId.HTM_008, Severity.SUPPRESSED);
106106
severities.put(MessageId.HTM_009, Severity.ERROR);
107107
severities.put(MessageId.HTM_010, Severity.USAGE);
108108
severities.put(MessageId.HTM_011, Severity.ERROR);

src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -678,14 +678,7 @@ protected void processHyperlink(URL href)
678678

679679
protected URL checkResourceURL(String src)
680680
{
681-
if (src == null) return null;
682-
// check that the URL is not empty
683-
// TODO this should be moved to a schema check
684-
if (src.trim().isEmpty())
685-
{
686-
report.message(MessageId.HTM_008, location());
687-
return null;
688-
}
681+
if (src == null || src.trim().isEmpty()) return null;
689682

690683
// parse and check the URL
691684
URL url = checkURL(src);

src/main/resources/com/adobe/epubcheck/messages/MessageBundle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ HTM_003=External entities are not allowed in EPUB v3 documents. External entity
4242
HTM_004=Irregular DOCTYPE: found "%1$s", expected "%2$s".
4343
HTM_005=An external reference was found.
4444
HTM_007=Empty or whitespace-only value of attribute ssml:ph.
45-
HTM_008=The resource URL must not be empty
4645
HTM_009=The DOCTYPE provided is obsolete or irregular and can be removed.
4746
HTM_010=Namespace uri "%1$s" was found.
4847
HTM_011=Entity is undeclared.

src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/common.rnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ common.attrs.other =
335335
)
336336

337337
common.data.uri.non-empty =
338-
datatype.IRI
338+
datatype.string.nonempty
339339

340340
common.data.uris =
341341
list { datatype.IRI* }

src/test/resources/epub3/06-content-document/content-document-xhtml.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ Feature: EPUB 3 — Content Documents — XHTML
313313

314314
Scenario: Report an `img` element with an empty `src` attribute
315315
When checking document 'img-src-empty-error.xhtml'
316-
Then error HTM-008 is reported
316+
Then error RSC-005 is reported
317317
And no other errors or warnings are reported
318318

319319
Scenario: Report an `img` element with no `alt` attribute

src/test/resources/epub3/06-content-document/files/img-src-empty-error.xhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
</head>
77
<body>
88
<h1>Test</h1>
9-
<img src="" alt="empty"/>
9+
<img src=" " alt="empty"/>
1010
</body>
1111
</html>

0 commit comments

Comments
 (0)