Skip to content

Commit c8e9f45

Browse files
committed
fix: report HTML discouraged constructs as "usage"
The HTML discouraged constructs section is non-normative. This PR now reports use of these constructs as a usage message instead of a warning. The severity level of `HTM-055` is now `USAGE`. Fix #1387.
1 parent 88e15ec commit c8e9f45

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
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
@@ -138,7 +138,7 @@ private void initialize()
138138
severities.put(MessageId.HTM_052, Severity.ERROR);
139139
severities.put(MessageId.HTM_053, Severity.SUPPRESSED);
140140
severities.put(MessageId.HTM_054, Severity.ERROR);
141-
severities.put(MessageId.HTM_055, Severity.WARNING);
141+
severities.put(MessageId.HTM_055, Severity.USAGE);
142142
severities.put(MessageId.HTM_056, Severity.ERROR);
143143
severities.put(MessageId.HTM_057, Severity.ERROR);
144144
severities.put(MessageId.HTM_058, Severity.ERROR);

src/test/resources/epub3/03-resources/resources.feature

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@
110110
And no errors or warnings are reported
111111

112112
@spec @xref:sec-foreign-resources
113-
Scenario: Report a foreign resource in HTML `embed` with a manifest fallback
113+
Scenario: Allow a foreign resource in HTML `embed` with a manifest fallback
114114
When checking EPUB 'foreign-xhtml-embed-fallback-valid'
115-
And warning HTM-055 is reported (using embed is discouraged)
116-
And no other errors or warnings are reported
115+
Then no errors or warnings are reported
117116

118117
@spec @xref:sec-foreign-resources
119118
Scenario: Report a foreign resource in HTML `embed` with no fallback
120119
When checking EPUB 'foreign-xhtml-embed-no-fallback-error'
121120
Then error RSC-032 is reported
122-
And warning HTM-055 is reported (using embed is discouraged)
123121
And no other errors or warnings are reported
124122

125123
@spec @xref:sec-foreign-resources
@@ -652,5 +650,4 @@
652650
Scenario: Report an `embed` element with a `type` attribute not matching the publication resource type
653651
When checking EPUB 'type-mismatch-in-embed-warning'
654652
Then warning OPF-013 is reported
655-
And warning HTM-055 is reported (using embed is discouraged)
656653
And no other errors or warnings are reported

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,10 @@ Feature: EPUB 3 — Content Documents — XHTML
197197

198198
Scenario: Verify that a base url can be set
199199
When checking EPUB 'content-xhtml-base-url-valid'
200-
Then warning HTM-055 is reported (side effect of `base` being discouraged)
201200
Then no errors or warnings are reported
202201

203202
Scenario: Report relative paths as remote resources when HTML `base` is set to an extenal URL (issue 155)
204203
When checking EPUB 'content-xhtml-base-url-remote-relative-path-error'
205-
Then warning HTM-055 is reported (side effect of `base` being discouraged)
206204
Then error RSC-006 is reported
207205
And no other errors or warnings are reported
208206

@@ -978,20 +976,23 @@ Feature: EPUB 3 — Content Documents — XHTML
978976
#### 6.1.4.3 Discouraged Constructs
979977

980978
Scenario: Report `base` as a discouraged construct
979+
Given the reporting level is set to usage
981980
When checking document 'discouraged-base-warning.xhtml'
982-
Then warning HTM-055 is reported
981+
Then usage HTM-055 is reported
983982
And the message contains 'base'
984-
And no other errors or warnings are reported
983+
And no errors or warnings are reported
985984

986985
Scenario: Report `embed` as a discouraged construct
986+
Given the reporting level is set to usage
987987
When checking document 'discouraged-embed-warning.xhtml'
988-
Then warning HTM-055 is reported
988+
Then usage HTM-055 is reported
989989
And the message contains 'embed'
990990
And no other errors or warnings are reported
991991

992992
Scenario: Report `rp` as a discouraged construct
993+
Given the reporting level is set to usage
993994
When checking document 'discouraged-rp-warning.xhtml'
994-
Then warning HTM-055 is reported 2 times
995+
Then usage HTM-055 is reported 2 times
995996
And the message contains 'rp'
996997
And no other errors or warnings are reported
997998

0 commit comments

Comments
 (0)