From 0d72ca395f8bf293a0c83e58718ab4603178f504 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 17 Aug 2021 14:51:40 -0400 Subject: [PATCH 1/2] Fixes #611. --- .../cases/github-cases/case-611a.conf | 3 ++ .../cases/github-cases/case-611a@0.html | 7 ++++ .../cases/github-cases/case-611b.conf | 3 ++ .../cases/github-cases/case-611b@0.html | 10 +++++ .../cases/github-cases/case-611c.conf | 3 ++ .../cases/github-cases/case-611c@0.html | 39 +++++++++++++++++++ src/parser.c | 2 +- src/tags.h | 1 + 8 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 regression_testing/cases/github-cases/case-611a.conf create mode 100644 regression_testing/cases/github-cases/case-611a@0.html create mode 100644 regression_testing/cases/github-cases/case-611b.conf create mode 100644 regression_testing/cases/github-cases/case-611b@0.html create mode 100644 regression_testing/cases/github-cases/case-611c.conf create mode 100644 regression_testing/cases/github-cases/case-611c@0.html diff --git a/regression_testing/cases/github-cases/case-611a.conf b/regression_testing/cases/github-cases/case-611a.conf new file mode 100644 index 0000000..a75c08d --- /dev/null +++ b/regression_testing/cases/github-cases/case-611a.conf @@ -0,0 +1,3 @@ +indent: auto +tidy-mark: no +clean: yes diff --git a/regression_testing/cases/github-cases/case-611a@0.html b/regression_testing/cases/github-cases/case-611a@0.html new file mode 100644 index 0000000..98798c5 --- /dev/null +++ b/regression_testing/cases/github-cases/case-611a@0.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/regression_testing/cases/github-cases/case-611b.conf b/regression_testing/cases/github-cases/case-611b.conf new file mode 100644 index 0000000..a75c08d --- /dev/null +++ b/regression_testing/cases/github-cases/case-611b.conf @@ -0,0 +1,3 @@ +indent: auto +tidy-mark: no +clean: yes diff --git a/regression_testing/cases/github-cases/case-611b@0.html b/regression_testing/cases/github-cases/case-611b@0.html new file mode 100644 index 0000000..24aa42e --- /dev/null +++ b/regression_testing/cases/github-cases/case-611b@0.html @@ -0,0 +1,10 @@ + + + + +Issue #611-1 + + + + + diff --git a/regression_testing/cases/github-cases/case-611c.conf b/regression_testing/cases/github-cases/case-611c.conf new file mode 100644 index 0000000..a75c08d --- /dev/null +++ b/regression_testing/cases/github-cases/case-611c.conf @@ -0,0 +1,3 @@ +indent: auto +tidy-mark: no +clean: yes diff --git a/regression_testing/cases/github-cases/case-611c@0.html b/regression_testing/cases/github-cases/case-611c@0.html new file mode 100644 index 0000000..eb4eadd --- /dev/null +++ b/regression_testing/cases/github-cases/case-611c@0.html @@ -0,0 +1,39 @@ + + + + +Issue #611-2d + + + + + + + + +
Name Color Sex Legs +
+ + + + diff --git a/src/parser.c b/src/parser.c index 61e353a..0317eda 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1417,7 +1417,7 @@ Node* TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode ) return NULL; } } - else /* things like list items */ + else if ( ! nodeIsTEMPLATE( element ) )/* things like list items */ { if (node->tag->model & CM_HEAD) { diff --git a/src/tags.h b/src/tags.h index a02f230..b97ca6d 100644 --- a/src/tags.h +++ b/src/tags.h @@ -463,6 +463,7 @@ TY_PRIVATE uint TY_(nodeHeaderLevel)( Node* node ); #define nodeIsDATALIST( node ) TagIsId( node, TidyTag_DATALIST ) #define nodeIsDATA( node ) TagIsId( node, TidyTag_DATA ) #define nodeIsMATHML( node ) TagIsId( node, TidyTag_MATHML ) /* #130 MathML attr and entity fix! */ +#define nodeIsTEMPLATE( node ) TagIsId( node, TidyTag_TEMPLATE ) /* NOT in HTML 5 */ #define nodeIsACRONYM( node ) TagIsId( node, TidyTag_ACRONYM ) From 8a45f44f36158e27c1e74beebac1e026182c554d Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 17 Aug 2021 14:53:28 -0400 Subject: [PATCH 2/2] Tests cases for previous. --- .../{case-611a@0.html => case-611a@1.html} | 0 .../{case-611c@0.html => case-611c@1.html} | 0 .../cases/github-expects/case-611a.html | 19 ++++++++ .../cases/github-expects/case-611a.txt | 15 ++++++ .../cases/github-expects/case-611b.html | 14 ++++++ .../cases/github-expects/case-611b.txt | 13 +++++ .../cases/github-expects/case-611c.html | 47 +++++++++++++++++++ .../cases/github-expects/case-611c.txt | 27 +++++++++++ 8 files changed, 135 insertions(+) rename regression_testing/cases/github-cases/{case-611a@0.html => case-611a@1.html} (100%) rename regression_testing/cases/github-cases/{case-611c@0.html => case-611c@1.html} (100%) create mode 100644 regression_testing/cases/github-expects/case-611a.html create mode 100644 regression_testing/cases/github-expects/case-611a.txt create mode 100644 regression_testing/cases/github-expects/case-611b.html create mode 100644 regression_testing/cases/github-expects/case-611b.txt create mode 100644 regression_testing/cases/github-expects/case-611c.html create mode 100644 regression_testing/cases/github-expects/case-611c.txt diff --git a/regression_testing/cases/github-cases/case-611a@0.html b/regression_testing/cases/github-cases/case-611a@1.html similarity index 100% rename from regression_testing/cases/github-cases/case-611a@0.html rename to regression_testing/cases/github-cases/case-611a@1.html diff --git a/regression_testing/cases/github-cases/case-611c@0.html b/regression_testing/cases/github-cases/case-611c@1.html similarity index 100% rename from regression_testing/cases/github-cases/case-611c@0.html rename to regression_testing/cases/github-cases/case-611c@1.html diff --git a/regression_testing/cases/github-expects/case-611a.html b/regression_testing/cases/github-expects/case-611a.html new file mode 100644 index 0000000..fdba873 --- /dev/null +++ b/regression_testing/cases/github-expects/case-611a.html @@ -0,0 +1,19 @@ + + + + + + + + + + + diff --git a/regression_testing/cases/github-expects/case-611a.txt b/regression_testing/cases/github-expects/case-611a.txt new file mode 100644 index 0000000..50ce2d0 --- /dev/null +++ b/regression_testing/cases/github-expects/case-611a.txt @@ -0,0 +1,15 @@ +line 1 column 1 - Warning: missing declaration +line 1 column 1 - Warning: inserting missing 'title' element +Info: Document content looks like HTML5 +Tidy found 2 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/github-expects/case-611b.html b/regression_testing/cases/github-expects/case-611b.html new file mode 100644 index 0000000..c443322 --- /dev/null +++ b/regression_testing/cases/github-expects/case-611b.html @@ -0,0 +1,14 @@ + + + + + Issue #611-1 + + + + + diff --git a/regression_testing/cases/github-expects/case-611b.txt b/regression_testing/cases/github-expects/case-611b.txt new file mode 100644 index 0000000..84c51cb --- /dev/null +++ b/regression_testing/cases/github-expects/case-611b.txt @@ -0,0 +1,13 @@ +Info: Document content looks like HTML5 +No warnings or errors were found. + +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-611c.html b/regression_testing/cases/github-expects/case-611c.html new file mode 100644 index 0000000..d9ade9c --- /dev/null +++ b/regression_testing/cases/github-expects/case-611c.html @@ -0,0 +1,47 @@ + + + + + Issue #611-2d + + + + + + + + + + + + + + +
NameColorSexLegs
+ + diff --git a/regression_testing/cases/github-expects/case-611c.txt b/regression_testing/cases/github-expects/case-611c.txt new file mode 100644 index 0000000..b104683 --- /dev/null +++ b/regression_testing/cases/github-expects/case-611c.txt @@ -0,0 +1,27 @@ +line 20 column 3 - Warning: +line 23 column 1 - Warning: discarding unexpected +line 24 column 1 - Warning: