Naked groups of LI in HTML5 mode will now have an inferred UL applied to
them consistent with HTML4 and earlier modes.

Test case added.

Note that three regressions were updated in favor of this corrected behavior.
This commit is contained in:
Jim Derry 2021-08-17 12:34:43 -04:00
parent a46949f46a
commit 1ca8e210c8
11 changed files with 109 additions and 25 deletions

View File

@ -0,0 +1,2 @@
sort-attributes: none
priority-attributes: id, style, class

View File

@ -0,0 +1,25 @@
<!--
This test case represents HTML Tidy issue #525, which claims
that in HTML5 mode, LI tags are not enclosed in UL autiomatically.
-->
<!DOCTYPE html>
<html>
<head>
<title>Issue 525 Infer UL around LI</title>
</head>
<body>
<br>
<li>Bachelor of Arts</li>
<li>Bachelor of Biomedical Science</li>
<li>Bachelor of Commerce</li>
<li>Bachelor of Commerce Specialist</li>
<li>Bachelor of Computer Science</li>
<li>Bachelor of Education (Honours)</li>
<li>Bachelor of Engineering (Honours)</li>
<li>Bachelor of Global Studies</li>
<li>Bachelor of Information Technology</li>
<li>Bachelor of Laws (Honours)</li>
<li>Bachelor of Music.</li>
<br>
</body>
</html>

View File

@ -0,0 +1,26 @@
<!--
This test case represents HTML Tidy issue #525, which claims
that in HTML5 mode, LI tags are not enclosed in UL autiomatically.
-->
<!DOCTYPE html>
<html>
<head>
<title>Issue 525 Infer UL around LI</title>
</head>
<body>
<br>
<ul>
<li>Bachelor of Arts</li>
<li>Bachelor of Biomedical Science</li>
<li>Bachelor of Commerce</li>
<li>Bachelor of Commerce Specialist</li>
<li>Bachelor of Computer Science</li>
<li>Bachelor of Education (Honours)</li>
<li>Bachelor of Engineering (Honours)</li>
<li>Bachelor of Global Studies</li>
<li>Bachelor of Information Technology</li>
<li>Bachelor of Laws (Honours)</li>
<li>Bachelor of Music.</li>
<br></ul>
</body>
</html>

View File

@ -0,0 +1,19 @@
line 12 column 1 - Warning: <li> isn't allowed in <body> elements
line 10 column 1 - Info: <body> previously mentioned
line 12 column 1 - Warning: inserting implicit <ul>
line 24 column 1 - Warning: discarding unexpected </body>
line 25 column 1 - Warning: discarding unexpected </html>
line 12 column 1 - Warning: missing </ul>
Info: Document content looks like HTML5
Tidy found 5 warnings and 0 errors!
About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: https://html.spec.whatwg.org/multipage/
Validate your HTML documents: https://validator.w3.org/nu/
Lobby your company to join the W3C: https://www.w3.org/Consortium
Do you speak a language other than English, or a different variant of
English? Consider helping us to localize HTML Tidy. For details please see
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md

View File

@ -14,8 +14,8 @@ processor. The small footprint enables it to be installed even in
restricted spaces. The Compact E.O.S. can be extended at the back
with a table for film processing from a darkroom.<br>
<br>
<li>capacity: up to 240 films per hour (medium format)<br>
<ul class="c1">
<li>capacity: up to 240 films per hour (medium format)<br></li>
<li>cassette cycle time: 15 s<br></li>
<li>film formats: 18 x24cm to 35 x 43cm<br></li>
<li>film storage magazines that can be used: Curix, Scopix<br></li>
@ -33,6 +33,5 @@ lower heat dissipation<br></li>
possible service messages<br>
<br></li>
</ul>
</li>
</body>
</html>

View File

@ -1,6 +1,8 @@
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 6 column 319 - Warning: <li> isn't allowed in <body> elements
line 5 column 1 - Info: <body> previously mentioned
line 6 column 319 - Warning: inserting implicit <ul>
line 6 column 319 - Info: missing optional end tag </li>
line 6 column 378 - Warning: inserting implicit <ul>
line 6 column 378 - Info: missing optional end tag </li>
line 6 column 412 - Info: missing optional end tag </li>
line 6 column 456 - Info: missing optional end tag </li>
@ -10,7 +12,7 @@ line 6 column 665 - Info: missing optional end tag </li>
line 6 column 690 - Info: missing optional end tag </li>
line 6 column 754 - Info: missing optional end tag </li>
line 6 column 842 - Info: missing optional end tag </li>
line 6 column 378 - Warning: missing </ul> before </li>
line 6 column 1041 - Warning: discarding unexpected </li>
line 6 column 1046 - Warning: discarding unexpected </li>
line 6 column 1051 - Warning: discarding unexpected </li>
line 6 column 1056 - Warning: discarding unexpected </li>
@ -20,8 +22,11 @@ line 6 column 1071 - Warning: discarding unexpected </li>
line 6 column 1076 - Warning: discarding unexpected </li>
line 6 column 1081 - Warning: discarding unexpected </li>
line 6 column 1086 - Warning: discarding unexpected </li>
line 7 column 1 - Warning: discarding unexpected </body>
line 8 column 1 - Warning: discarding unexpected </html>
line 6 column 319 - Warning: missing </ul>
Info: Document content looks like HTML5
Tidy found 12 warnings and 0 errors!
Tidy found 16 warnings and 0 errors!
About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues

View File

@ -4,13 +4,16 @@
<title>1410061 - issue 1 inferred ul</title>
<style type="text/css">
span.c1 {font-size: 200%}
span.c2 {font-size: 200%}
ul.c1 {padding-left: 2ex; margin-left: 0ex; margin-top: 0ex; margin-bottom: 0ex}
</style>
</head>
<body>
<b><span class="c1">In bold</span></b>
<li><span class="c1">Not in bold</span></li>
<li><span class="c1">With font size 6</span></li>
<li><span class="c1">But should NOT be indented</span></li>
<b><span class="c2">In bold</span></b>
<ul class="c1">
<li><span class="c2">Not in bold</span></li>
<li><span class="c2">With font size 6</span></li>
<li><span class="c2">But should NOT be indented</span></li>
</ul>
</body>
</html>

View File

@ -2,12 +2,18 @@ line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 6 column 4 - Warning: replacing unexpected b with </b>
line 6 column 30 - Warning: inserting implicit <font>
line 6 column 30 - Warning: missing </font> before <li>
line 7 column 1 - Warning: <li> isn't allowed in <body> elements
line 5 column 1 - Info: <body> previously mentioned
line 7 column 1 - Warning: inserting implicit <ul>
line 7 column 5 - Warning: inserting implicit <font>
line 8 column 5 - Warning: inserting implicit <font>
line 9 column 5 - Warning: inserting implicit <font>
line 10 column 1 - Warning: discarding unexpected </body>
line 11 column 1 - Warning: discarding unexpected </html>
line 7 column 1 - Warning: missing </ul>
line 6 column 30 - Warning: trimming empty <font>
Info: Document content looks like HTML5
Tidy found 8 warnings and 0 errors!
Tidy found 13 warnings and 0 errors!
You are recommended to use CSS to specify the font and
properties such as its size and color. This will reduce

View File

@ -6,15 +6,11 @@
probably throw up its hands and emit an error. -->
</head>
<body>
<li>
<ul>
<p>Identify the member disks with <strong>ssaraid -H -lssa0 -n
pdisk <em>[n]</em> -u -a use=member</strong></p>
<ul>
<li>
<p><strong>Identify the hot spare with ssaraid -H -lssa0 -n
pdisk <em>[n]</em>-u -a use=spare</strong></p>
</li>
</ul>
</li>
<p><strong>Identify the hot spare with ssaraid -H -lssa0 -n
pdisk <em>[n]</em>-u -a use=spare</strong></p>
</ul>
</body>
</html>

View File

@ -1,23 +1,26 @@
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 4 column 1 - Warning: inserting implicit <body>
line 4 column 1 - Warning: <li> isn't allowed in <body> elements
line 4 column 1 - Info: <body> previously mentioned
line 4 column 1 - Warning: inserting implicit <ul>
line 4 column 39 - Warning: missing </b> before <p>
line 6 column 9 - Warning: inserting implicit <b>
line 6 column 9 - Warning: missing </b> before <li>
line 4 column 1 - Info: missing optional end tag </li>
line 7 column 1 - Warning: inserting implicit <ul>
line 7 column 5 - Warning: inserting implicit <b>
line 7 column 5 - Warning: missing </b> before <p>
line 7 column 8 - Warning: inserting implicit <b>
line 7 column 8 - Warning: nested emphasis <b>
line 7 column 8 - Warning: missing </b> before <p>
line 7 column 8 - Warning: missing </b> before <p>
line 7 column 1 - Warning: missing </ul>
line 4 column 1 - Warning: missing </ul>
line 4 column 1 - Warning: trimming empty <li>
line 6 column 9 - Warning: trimming empty <b>
line 6 column 6 - Warning: trimming empty <p>
line 7 column 5 - Warning: trimming empty <b>
line 7 column 1 - Warning: trimming empty <li>
line 8 column 35 - Warning: trimming empty <p>
Info: Document content looks like HTML5
Tidy found 17 warnings and 0 errors!
Tidy found 20 warnings and 0 errors!
One or more empty elements were present in the source document but
dropped on output. If these elements are necessary or you don't want

View File

@ -1809,9 +1809,9 @@ Node* TY_(ParseBody)( TidyDocImpl* doc, Node *body, GetTokenMode mode )
*/
lexer->excludeBlocks = no;
if (( nodeIsINPUT(node) ||
if ((( nodeIsINPUT(node) ||
(!TY_(nodeHasCM)(node, CM_BLOCK) && !TY_(nodeHasCM)(node, CM_INLINE))
) && !TY_(IsHTML5Mode)(doc) )
) && !TY_(IsHTML5Mode)(doc)) || nodeIsLI(node) )
{
/* avoid this error message being issued twice */
if (!(node->tag->model & CM_HEAD))