diff --git a/regression_testing/cases/github-cases/case-729a.conf b/regression_testing/cases/github-cases/case-729a.conf new file mode 100755 index 0000000..471cfa1 --- /dev/null +++ b/regression_testing/cases/github-cases/case-729a.conf @@ -0,0 +1,2 @@ +# Sample config for 729a. +strict-tags-attributes: yes \ No newline at end of file diff --git a/regression_testing/cases/github-cases/case-729a@2.html b/regression_testing/cases/github-cases/case-729a@2.html new file mode 100755 index 0000000..ea80407 --- /dev/null +++ b/regression_testing/cases/github-cases/case-729a@2.html @@ -0,0 +1,25 @@ + + + + + Alignment + + + + + + + +
+ text +
+ + + diff --git a/regression_testing/cases/github-cases/case-729b.conf b/regression_testing/cases/github-cases/case-729b.conf new file mode 100755 index 0000000..499b2c7 --- /dev/null +++ b/regression_testing/cases/github-cases/case-729b.conf @@ -0,0 +1,2 @@ +# Sample config for 729b. +strict-tags-attributes: no diff --git a/regression_testing/cases/github-cases/case-729b@1.html b/regression_testing/cases/github-cases/case-729b@1.html new file mode 100755 index 0000000..ea80407 --- /dev/null +++ b/regression_testing/cases/github-cases/case-729b@1.html @@ -0,0 +1,25 @@ + + + + + Alignment + + + + + + + +
+ text +
+ + + diff --git a/regression_testing/cases/github-expects/case-729a.txt b/regression_testing/cases/github-expects/case-729a.txt new file mode 100644 index 0000000..d87b564 --- /dev/null +++ b/regression_testing/cases/github-expects/case-729a.txt @@ -0,0 +1,19 @@ +line 17 column 13 - Error: attribute "valign" not allowed for HTML5 +line 18 column 17 - Error: attribute "width" not allowed for HTML5 +line 18 column 17 - Error: attribute "align" not allowed for HTML5 +Info: Document content looks like HTML5 +Tidy found 0 warnings and 3 errors! + +This document has errors that must be fixed before +using HTML Tidy to generate a tidied up version. + +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: http://dev.w3.org/html5/spec-author-view/ +Validate your HTML documents: http://validator.w3.org/nu/ +Lobby your company to join the W3C: http://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-729b.html b/regression_testing/cases/github-expects/case-729b.html new file mode 100644 index 0000000..776bf5f --- /dev/null +++ b/regression_testing/cases/github-expects/case-729b.html @@ -0,0 +1,21 @@ + + + + +Alignment + + + + + + +
text
+ + diff --git a/regression_testing/cases/github-expects/case-729b.txt b/regression_testing/cases/github-expects/case-729b.txt new file mode 100644 index 0000000..65cb35a --- /dev/null +++ b/regression_testing/cases/github-expects/case-729b.txt @@ -0,0 +1,17 @@ +line 18 column 17 - Warning: attribute "align" not allowed for HTML5 +line 17 column 13 - Warning: attribute "valign" not allowed for HTML5 +line 18 column 17 - Warning: attribute "width" not allowed for HTML5 +line 18 column 17 - Warning: attribute "align" not allowed for HTML5 +Info: Document content looks like HTML5 +Tidy found 4 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: http://dev.w3.org/html5/spec-author-view/ +Validate your HTML documents: http://validator.w3.org/nu/ +Lobby your company to join the W3C: http://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/tidylib.c b/src/tidylib.c index 86fd31c..de08d91 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -1880,7 +1880,8 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node ) next_attr = attval->next; attrIsProprietary = TY_(AttributeIsProprietary)(node, attval); - attrIsMismatched = check_versions ? TY_(AttributeIsMismatched)(node, attval, doc) : no; + /* Is. #729 - always check version match if HTML5 */ + attrIsMismatched = (check_versions | htmlIs5) ? TY_(AttributeIsMismatched)(node, attval, doc) : no; /* Let the PROPRIETARY_ATTRIBUTE warning have precedence. */ if ( attrIsProprietary ) { @@ -1889,7 +1890,15 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node ) } else if ( attrIsMismatched ) { - TY_(ReportAttrError)(doc, node, attval, attrReportType); + if (htmlIs5) + { + /* Is. #729 - In html5 TidyStrictTagsAttr controls error or warn */ + TY_(ReportAttrError)(doc, node, attval, + check_versions ? MISMATCHED_ATTRIBUTE_ERROR : MISMATCHED_ATTRIBUTE_WARN); + } + else + TY_(ReportAttrError)(doc, node, attval, attrReportType); + } /* @todo: do we need a new option to drop mismatches? Or should we