diff --git a/regression_testing/cases/github-cases/case-464a.conf b/regression_testing/cases/github-cases/case-464a.conf new file mode 100644 index 0000000..46022f7 --- /dev/null +++ b/regression_testing/cases/github-cases/case-464a.conf @@ -0,0 +1,3 @@ +tidy-mark: no +wrap: 0 +indent: yes diff --git a/regression_testing/cases/github-cases/case-464a@1.html b/regression_testing/cases/github-cases/case-464a@1.html new file mode 100644 index 0000000..4afbbf0 --- /dev/null +++ b/regression_testing/cases/github-cases/case-464a@1.html @@ -0,0 +1,29 @@ + + + + + +Issue #464 + + +
+
term
+
def
+
another term
+
another def
+
+
+
+
term
+
def
+
another term
+
another def
+
+
+ + diff --git a/regression_testing/cases/github-cases/case-464b.conf b/regression_testing/cases/github-cases/case-464b.conf new file mode 100644 index 0000000..46022f7 --- /dev/null +++ b/regression_testing/cases/github-cases/case-464b.conf @@ -0,0 +1,3 @@ +tidy-mark: no +wrap: 0 +indent: yes diff --git a/regression_testing/cases/github-cases/case-464b@1.html b/regression_testing/cases/github-cases/case-464b@1.html new file mode 100644 index 0000000..33ac69d --- /dev/null +++ b/regression_testing/cases/github-cases/case-464b@1.html @@ -0,0 +1,29 @@ + + + + + +Issue #464 + + +
+
term
+
def
+
another term
+
another def
+
+
+
+
term
+
def
+
another term
+
another def
+
+
+ + diff --git a/regression_testing/cases/github-expects/case-464a.html b/regression_testing/cases/github-expects/case-464a.html new file mode 100644 index 0000000..8a1ff1f --- /dev/null +++ b/regression_testing/cases/github-expects/case-464a.html @@ -0,0 +1,47 @@ + + + + + + + Issue #464 + + + +
+
+ term +
+
+ def +
+
+ another term +
+
+ another def +
+
+
+
+
+ term +
+
+ def +
+
+ another term +
+
+ another def +
+
+
+ + diff --git a/regression_testing/cases/github-expects/case-464a.txt b/regression_testing/cases/github-expects/case-464a.txt new file mode 100644 index 0000000..3e950b4 --- /dev/null +++ b/regression_testing/cases/github-expects/case-464a.txt @@ -0,0 +1,20 @@ +line 17 column 21 - Warning: trimming empty
+line 24 column 21 - Warning: trimming empty
+Info: Document content looks like HTML5 +Tidy found 2 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 +this behavior, then consider setting the option "drop-empty-elements" +to no. + +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/github-expects/case-464b.html b/regression_testing/cases/github-expects/case-464b.html new file mode 100644 index 0000000..8354900 --- /dev/null +++ b/regression_testing/cases/github-expects/case-464b.html @@ -0,0 +1,52 @@ + + + + + + + Issue #464 + + + +
+
+ term +
+
+ def +
+
+ another term +
+
+ another def +
+
+
+
+
+
+
+ term +
+
+ def +
+
+ another term +
+
+ another def +
+
+
+
+
+ + diff --git a/regression_testing/cases/github-expects/case-464b.txt b/regression_testing/cases/github-expects/case-464b.txt new file mode 100644 index 0000000..d10e74f --- /dev/null +++ b/regression_testing/cases/github-expects/case-464b.txt @@ -0,0 +1,25 @@ +line 21 column 4 - Warning: missing
+line 21 column 4 - Warning: missing before
+line 22 column 5 - Warning: inserting implicit
+line 22 column 5 - Warning: missing
before +line 17 column 21 - Warning: trimming empty
+line 24 column 21 - Warning: trimming empty
+Info: Doctype given is "-//W3C//DTD HTML 4.01//EN" +Info: Document content looks like HTML Proprietary +Tidy found 6 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 +this behavior, then consider setting the option "drop-empty-elements" +to no. + +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/src/parser.c b/src/parser.c index 9844ab2..594cd3e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1115,6 +1115,11 @@ Node* TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode ) return NULL; } + if ( nodeIsDIV(element) && nodeIsDL(element->parent) && TY_(IsHTML5Mode)(doc) ) + { + return TY_(ParseDefList)(doc, element, mode); + } + if ( nodeIsFORM(element) && DescendantOf(element, TidyTag_FORM) ) TY_(Report)(doc, element, NULL, ILLEGAL_NESTING ); @@ -1332,7 +1337,7 @@ Node* TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode ) TY_(FreeNode)( doc, node ); continue; } - + /* #427671 - Fix by Randy Waki - 10 Aug 00 */ /* If an LI contains an illegal FRAME, FRAMESET, OPTGROUP, or OPTION @@ -2311,7 +2316,7 @@ Node* TY_(ParseDefList)( TidyDocImpl* doc, Node *list, GetTokenMode mode ) } } - if ( !(nodeIsDT(node) || nodeIsDD(node)) ) + if ( !( nodeIsDT(node) || nodeIsDD(node) || ( nodeIsDIV(node) && TY_(IsHTML5Mode)(doc) ) ) ) { TY_(UngetToken)( doc ); @@ -2340,7 +2345,7 @@ Node* TY_(ParseDefList)( TidyDocImpl* doc, Node *list, GetTokenMode mode ) continue; } - /* node should be
or
*/ + /* node should be
or
or
*/ TY_(InsertNodeAtEnd)(list, node); { TidyParserMemory memory = {0}; diff --git a/src/parser.h b/src/parser.h index 8980372..3a89234 100644 --- a/src/parser.h +++ b/src/parser.h @@ -56,7 +56,7 @@ typedef struct _TidyParserMemory int reentry_state; /**< State to set during re-entry. Defined locally in each parser. */ GetTokenMode mode; /**< The caller will peek at this value to get the correct mode. */ int register_1; /**< Local variable storage. */ - int register_2; /**< Local variable storage. */ + int register_2; /**< Local variable storage. */ } TidyParserMemory;