Skip to content

Commit 39c1e69

Browse files
authored
Merge pull request #930 from htacg/issue-839-2
Is. #839 - new message for 'blank' title
2 parents dc2e2d2 + ad8cae9 commit 39c1e69

File tree

12 files changed

+70
-7
lines changed

12 files changed

+70
-7
lines changed

include/tidyenum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ extern "C" {
282282
FN(VENDOR_SPECIFIC_CHARS) \
283283
FN(WHITE_IN_URI) \
284284
FN(XML_DECLARATION_DETECTED) \
285-
FN(XML_ID_SYNTAX)
285+
FN(XML_ID_SYNTAX) \
286+
FN(BLANK_TITLE_ELEMENT)
286287

287288

288289
/** These are report messages added by Tidy's accessibility module.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!--
2+
This test case represents HTML Tidy issue #839, which describes
3+
a descrepancy between tidy's behavior and the W3C Nu HTML
4+
checker behavior. Tidy has historically allowed empty <title>
5+
elements, but this is not allowed by HTML5, and is flagged by
6+
the Nu checker. Because a <title> is required by HTML5, it
7+
would be even worse for HTML Tidy to remove this element, and
8+
so Tidy will now provide a warning if the title element is
9+
empty. It is assumed the HTML author will add a title as well
10+
as addressing other warnings.
11+
-->
12+
<!DOCTYPE html><title></title>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
This test case represents HTML Tidy issue #839, which describes
3+
a descrepancy between tidy's behavior and the W3C Nu HTML
4+
checker behavior. Tidy has historically allowed empty <title>
5+
elements, but this is not allowed by HTML5, and is flagged by
6+
the Nu checker. Because a <title> is required by HTML5, it
7+
would be even worse for HTML Tidy to remove this element, and
8+
so Tidy will now provide a warning if the title element is
9+
empty. It is assumed the HTML author will add a title as well
10+
as addressing other warnings.
11+
-->
12+
<!DOCTYPE html>
13+
<html>
14+
<head>
15+
<title></title>
16+
</head>
17+
<body>
18+
</body>
19+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
line 12 column 16 - Warning: blank 'title' element
2+
Info: Document content looks like HTML5
3+
Tidy found 1 warning and 0 errors!
4+
5+
About HTML Tidy: https://github.com/htacg/tidy-html5
6+
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
7+
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
8+
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
9+
Validate your HTML documents: http://validator.w3.org/nu/
10+
Lobby your company to join the W3C: http://www.w3.org/Consortium
11+
12+
Do you speak a language other than English, or a different variant of
13+
English? Consider helping us to localize HTML Tidy. For details please see
14+
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md

regression_testing/cases/legacy-expects/case-1062511.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ line 7 column 1 - Warning: <base> isn't allowed in <b> elements
88
line 6 column 1 - Info: <b> previously mentioned
99
line 6 column 1 - Warning: missing </b> before <hr>
1010
line 3 column 1 - Warning: content occurs after end of body
11+
line 2 column 1 - Warning: blank 'title' element
1112
line 3 column 1 - Warning: trimming empty <marquee>
1213
line 6 column 1 - Warning: trimming empty <b>
1314
Info: Document content looks like HTML5
14-
Tidy found 11 warnings and 0 errors!
15+
Tidy found 12 warnings and 0 errors!
1516

1617
One or more empty elements were present in the source document but
1718
dropped on output. If these elements are necessary or you don't want

regression_testing/cases/legacy-expects/case-1674502.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
22
line 7 column 1 - Warning: discarding unexpected XML declaration
3+
line 3 column 1 - Warning: blank 'title' element
34
Info: Document content looks like HTML5
4-
Tidy found 2 warnings and 0 errors!
5+
Tidy found 3 warnings and 0 errors!
56

67
About HTML Tidy: https://github.com/htacg/tidy-html5
78
Bug reports and comments: https://github.com/htacg/tidy-html5/issues

regression_testing/cases/legacy-expects/case-1773932.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ line 7 column 1 - Warning: missing </font> before <ol>
33
line 8 column 9 - Warning: inserting implicit <font>
44
line 9 column 10 - Warning: inserting implicit <font>
55
line 10 column 10 - Warning: inserting implicit <font>
6+
line 3 column 1 - Warning: blank 'title' element
67
line 7 column 1 - Warning: trimming empty <font>
78
Info: Document content looks like HTML5
8-
Tidy found 6 warnings and 0 errors!
9+
Tidy found 7 warnings and 0 errors!
910

1011
You are recommended to use CSS to specify the font and
1112
properties such as its size and color. This will reduce

regression_testing/cases/legacy-expects/case-427675.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
22
line 8 column 1 - Warning: discarding unexpected <frame>
33
line 10 column 1 - Warning: missing </noframes>
4+
line 3 column 3 - Warning: blank 'title' element
45
line 5 column 1 - Warning: <frameset> element removed from HTML5
56
line 6 column 3 - Warning: <frame> element removed from HTML5
67
line 10 column 1 - Warning: <noframes> element removed from HTML5
78
Info: Document content looks like HTML5
8-
Tidy found 6 warnings and 0 errors!
9+
Tidy found 7 warnings and 0 errors!
910

1011
About HTML Tidy: https://github.com/htacg/tidy-html5
1112
Bug reports and comments: https://github.com/htacg/tidy-html5/issues

regression_testing/cases/legacy-expects/case-427676.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ line 6 column 14 - Error: <spanstyle> is not recognized!
55
line 6 column 14 - Warning: discarding unexpected <spanstyle>
66
line 6 column 44 - Warning: discarding unexpected </span>
77
line 6 column 52 - Info: value for attribute "href" missing quote marks
8+
line 3 column 3 - Warning: blank 'title' element
89
line 6 column 52 - Warning: <a> illegal characters found in URI
910
Info: Document content looks like HTML5
10-
Tidy found 6 warnings and 1 error!
11+
Tidy found 7 warnings and 1 error!
1112

1213
This document has errors that must be fixed before
1314
using HTML Tidy to generate a tidied up version.

src/language_en.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
20552055
{ WHITE_IN_URI, 0, "%s discarding whitespace in URI reference" },
20562056
{ XML_DECLARATION_DETECTED, 0, "An XML declaration was detected. Did you mean to use input-xml?" },
20572057
{ XML_ID_SYNTAX, 0, "%s ID \"%s\" uses XML ID syntax" },
2058+
{ BLANK_TITLE_ELEMENT, 0, "blank 'title' element" },
20582059

20592060

20602061
/***************************************

0 commit comments

Comments
 (0)