From 1ca8e210c8c09315b0b77b47b02b32a226f69e30 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 17 Aug 2021 12:34:43 -0400 Subject: [PATCH] Fixes #525. 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. --- .../cases/github-cases/case-525.conf | 2 ++ .../cases/github-cases/case-525@1.html | 25 ++++++++++++++++++ .../cases/github-expects/case-525.html | 26 +++++++++++++++++++ .../cases/github-expects/case-525.txt | 19 ++++++++++++++ .../cases/legacy-expects/case-1410061a.html | 3 +-- .../cases/legacy-expects/case-1410061a.txt | 11 +++++--- .../cases/legacy-expects/case-1410061b.html | 13 ++++++---- .../cases/legacy-expects/case-1410061b.txt | 8 +++++- .../cases/legacy-expects/case-566542.html | 12 +++------ .../cases/legacy-expects/case-566542.txt | 11 +++++--- src/parser.c | 4 +-- 11 files changed, 109 insertions(+), 25 deletions(-) create mode 100644 regression_testing/cases/github-cases/case-525.conf create mode 100755 regression_testing/cases/github-cases/case-525@1.html create mode 100644 regression_testing/cases/github-expects/case-525.html create mode 100644 regression_testing/cases/github-expects/case-525.txt diff --git a/regression_testing/cases/github-cases/case-525.conf b/regression_testing/cases/github-cases/case-525.conf new file mode 100644 index 0000000..e569388 --- /dev/null +++ b/regression_testing/cases/github-cases/case-525.conf @@ -0,0 +1,2 @@ +sort-attributes: none +priority-attributes: id, style, class diff --git a/regression_testing/cases/github-cases/case-525@1.html b/regression_testing/cases/github-cases/case-525@1.html new file mode 100755 index 0000000..1996695 --- /dev/null +++ b/regression_testing/cases/github-cases/case-525@1.html @@ -0,0 +1,25 @@ + + + + +Issue 525 – Infer UL around LI + + +
+
  • Bachelor of Arts
  • +
  • Bachelor of Biomedical Science
  • +
  • Bachelor of Commerce
  • +
  • Bachelor of Commerce Specialist
  • +
  • Bachelor of Computer Science
  • +
  • Bachelor of Education (Honours)
  • +
  • Bachelor of Engineering (Honours)
  • +
  • Bachelor of Global Studies
  • +
  • Bachelor of Information Technology
  • +
  • Bachelor of Laws (Honours)
  • +
  • Bachelor of Music.
  • +
    + + diff --git a/regression_testing/cases/github-expects/case-525.html b/regression_testing/cases/github-expects/case-525.html new file mode 100644 index 0000000..28a6174 --- /dev/null +++ b/regression_testing/cases/github-expects/case-525.html @@ -0,0 +1,26 @@ + + + + +Issue 525 – Infer UL around LI + + +
    + + + diff --git a/regression_testing/cases/github-expects/case-525.txt b/regression_testing/cases/github-expects/case-525.txt new file mode 100644 index 0000000..5b9ef5e --- /dev/null +++ b/regression_testing/cases/github-expects/case-525.txt @@ -0,0 +1,19 @@ +line 12 column 1 - Warning:
  • isn't allowed in elements +line 10 column 1 - Info: previously mentioned +line 12 column 1 - Warning: inserting implicit +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 diff --git a/regression_testing/cases/legacy-expects/case-1410061a.html b/regression_testing/cases/legacy-expects/case-1410061a.html index 6f4d028..a19d6c6 100644 --- a/regression_testing/cases/legacy-expects/case-1410061a.html +++ b/regression_testing/cases/legacy-expects/case-1410061a.html @@ -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.

    -
  • capacity: up to 240 films per hour (medium format)
    -
  • diff --git a/regression_testing/cases/legacy-expects/case-1410061a.txt b/regression_testing/cases/legacy-expects/case-1410061a.txt index 9b401eb..e698793 100644 --- a/regression_testing/cases/legacy-expects/case-1410061a.txt +++ b/regression_testing/cases/legacy-expects/case-1410061a.txt @@ -1,6 +1,8 @@ line 1 column 1 - Warning: missing declaration +line 6 column 319 - Warning:
  • isn't allowed in elements +line 5 column 1 - Info: previously mentioned +line 6 column 319 - Warning: inserting implicit 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 diff --git a/regression_testing/cases/legacy-expects/case-1410061b.html b/regression_testing/cases/legacy-expects/case-1410061b.html index c022158..8eff94b 100644 --- a/regression_testing/cases/legacy-expects/case-1410061b.html +++ b/regression_testing/cases/legacy-expects/case-1410061b.html @@ -4,13 +4,16 @@ 1410061 - issue 1 inferred ul -In bold -
  • Not in bold
  • -
  • With font size 6
  • -
  • But should NOT be indented
  • +In bold + diff --git a/regression_testing/cases/legacy-expects/case-1410061b.txt b/regression_testing/cases/legacy-expects/case-1410061b.txt index 302051c..1a456b3 100644 --- a/regression_testing/cases/legacy-expects/case-1410061b.txt +++ b/regression_testing/cases/legacy-expects/case-1410061b.txt @@ -2,12 +2,18 @@ line 1 column 1 - Warning: missing declaration line 6 column 4 - Warning: replacing unexpected b with line 6 column 30 - Warning: inserting implicit line 6 column 30 - Warning: missing before
  • +line 7 column 1 - Warning:
  • isn't allowed in elements +line 5 column 1 - Info: previously mentioned +line 7 column 1 - Warning: inserting implicit line 6 column 30 - Warning: trimming empty 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 diff --git a/regression_testing/cases/legacy-expects/case-566542.html b/regression_testing/cases/legacy-expects/case-566542.html index 115e6b1..06852a8 100644 --- a/regression_testing/cases/legacy-expects/case-566542.html +++ b/regression_testing/cases/legacy-expects/case-566542.html @@ -6,15 +6,11 @@ probably throw up its hands and emit an error. --> -
  • +

      Identify the member disks with ssaraid -H -lssa0 -n pdisk [n] -u -a use=member

      -
        -
      • -

        Identify the hot spare with ssaraid -H -lssa0 -n - pdisk [n]-u -a use=spare

        -
      • -
      - +

      Identify the hot spare with ssaraid -H -lssa0 -n + pdisk [n]-u -a use=spare

      +
    diff --git a/regression_testing/cases/legacy-expects/case-566542.txt b/regression_testing/cases/legacy-expects/case-566542.txt index df3b23b..45feacd 100644 --- a/regression_testing/cases/legacy-expects/case-566542.txt +++ b/regression_testing/cases/legacy-expects/case-566542.txt @@ -1,23 +1,26 @@ line 1 column 1 - Warning: missing declaration line 4 column 1 - Warning: inserting implicit +line 4 column 1 - Warning:
  • isn't allowed in elements +line 4 column 1 - Info: previously mentioned +line 4 column 1 - Warning: inserting implicit
      line 4 column 39 - Warning: missing before

      line 6 column 9 - Warning: inserting implicit line 6 column 9 - Warning: missing before

    • -line 4 column 1 - Info: missing optional end tag
    • -line 7 column 1 - Warning: inserting implicit
        line 7 column 5 - Warning: inserting implicit line 7 column 5 - Warning: missing before

        line 7 column 8 - Warning: inserting implicit line 7 column 8 - Warning: nested emphasis line 7 column 8 - Warning: missing before

        line 7 column 8 - Warning: missing before

        -line 7 column 1 - Warning: missing

      +line 4 column 1 - Warning: missing
    +line 4 column 1 - Warning: trimming empty
  • line 6 column 9 - Warning: trimming empty line 6 column 6 - Warning: trimming empty

    line 7 column 5 - Warning: trimming empty +line 7 column 1 - Warning: trimming empty

  • line 8 column 35 - Warning: trimming empty

    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 diff --git a/src/parser.c b/src/parser.c index 594cd3e..61e353a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -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))