Skip to content

Fix excess warnings about <style> outside of <head> #1135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/tidyenum.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ extern "C" {
FN(MISSING_SEMICOLON) \
FN(MISSING_STARTTAG) \
FN(MISSING_TITLE_ELEMENT) \
FN(MOVED_STYLE_TO_HEAD) \
FN(NESTED_EMPHASIS) \
FN(NESTED_QUOTATION) \
FN(NEWLINE_IN_URI) \
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_de.po
Original file line number Diff line number Diff line change
Expand Up @@ -3014,10 +3014,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr "füge fehlendes 'title' Element ein"

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr "habe <style> Tag in den Kopfbereich (<head>) verschoben! Setzen Sie fix-style-tags: no, um dies zu vermeiden."

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_en_gb.po
Original file line number Diff line number Diff line change
Expand Up @@ -2572,10 +2572,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr ""

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr ""

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_es.po
Original file line number Diff line number Diff line change
Expand Up @@ -2516,10 +2516,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr ""

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr ""

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_es_mx.po
Original file line number Diff line number Diff line change
Expand Up @@ -2511,10 +2511,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr ""

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr ""

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -2955,10 +2955,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr "ajout d'un élément 'title' manquant"

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr ""

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_pt_br.po
Original file line number Diff line number Diff line change
Expand Up @@ -3042,10 +3042,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr "inserindo elemento faltante 'title'"

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr "tag <style> movida para <head>! fix-style-tags: no para evitar."

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/language_zh_cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -2505,10 +2505,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr ""

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr ""

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
4 changes: 0 additions & 4 deletions localize/translations/tidy.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2507,10 +2507,6 @@ msgctxt "MISSING_TITLE_ELEMENT"
msgid "inserting missing 'title' element"
msgstr ""

msgctxt "MOVED_STYLE_TO_HEAD"
msgid "moved <style> tag to <head>! fix-style-tags: no to avoid."
msgstr ""

#, c-format
msgctxt "NESTED_EMPHASIS"
msgid "nested emphasis %s"
Expand Down
5 changes: 2 additions & 3 deletions regression_testing/cases/access-expects/case-6_1_1_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
<html lang="en">
<head>
<title>aert1.0/6.1.1</title>

</head>
<body>
<style>
<!--
p {text-align:justify}
-->
</style>
</head>
<body>
</body>
</html>
2 changes: 1 addition & 1 deletion regression_testing/cases/access-expects/case-6_1_1_2.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
line 7 column 1 - Access: [6.1.1.2]: style sheets require testing (style element).
line 7 column 1 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.
line 7 column 1 - Warning: found <style> tag in <body>! fix-style-tags: yes to move.
Tidy found 1 warning and 0 errors!

For further advice on how to make your pages accessible
Expand Down
1 change: 1 addition & 0 deletions regression_testing/cases/github-cases/case-730.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix-style-tags: yes
13 changes: 13 additions & 0 deletions regression_testing/cases/github-cases/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<title>Issue 730</title>
<body>
<h1>Heading</h1>
<style>
body {
color: red
}
</style>
<p>Paragraph</p>
</body>
</html>
16 changes: 16 additions & 0 deletions regression_testing/cases/github-expects/case-730.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Issue 730</title>

<style>
body {
color: red
}
</style>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph</p>
</body>
</html>
13 changes: 13 additions & 0 deletions regression_testing/cases/github-expects/case-730.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion src/clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,6 @@ static void StyleToHead(TidyDocImpl* doc, Node *head, Node *node, Bool fix, int
{
TY_(RemoveNode)(node); /* unhook style node from body */
TY_(InsertNodeAtEnd)(head, node); /* add to end of head */
TY_(Report)(doc, node, head, MOVED_STYLE_TO_HEAD); /* report move */
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static const TidyOptionImpl option_defs[] =
{ TidySkipNested, MR, "skip-nested", BL, yes, ParsePickList, &boolPicks }, /* 1642186 - Issue #65 */
{ TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParsePickList, &sorterPicks },
{ TidyStrictTagsAttr, MR, "strict-tags-attributes", BL, no, ParsePickList, &boolPicks }, /* 20160209 - Issue #350 */
{ TidyStyleTags, MR, "fix-style-tags", BL, yes, ParsePickList, &boolPicks },
{ TidyStyleTags, MR, "fix-style-tags", BL, no, ParsePickList, &boolPicks },
{ TidyTabSize, PP, "tab-size", IN, 8, ParseInt, NULL },
{ TidyUpperCaseAttrs, MR, "uppercase-attributes", IN, TidyUppercaseNo, ParsePickList, &attributeCasePicks },
{ TidyUpperCaseTags, MR, "uppercase-tags", BL, no, ParsePickList, &boolPicks },
Expand Down
1 change: 0 additions & 1 deletion src/language_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,6 @@ static languageDefinition language_de = { whichPluralForm_de, {
{ MISSING_SEMICOLON, 0, "Entität \"%s\" endet nicht mit ';'" },
{ MISSING_STARTTAG, 0, "fehlendes <%s>" },
{ MISSING_TITLE_ELEMENT, 0, "füge fehlendes 'title' Element ein" },
{ MOVED_STYLE_TO_HEAD, 0, "habe <style> Tag in den Kopfbereich (<head>) verschoben! Setzen Sie fix-style-tags: no, um dies zu vermeiden." },
{ NESTED_EMPHASIS, 0, "verschachtelte Hervorhebung %s" },
{ NESTED_QUOTATION, 0, "verschachtelte q Elemente, möglicher Tippfehler" },
{ NEWLINE_IN_URI, 0, "%s verwerfe Zeilenumbruch im URI-Verweis" },
Expand Down
1 change: 0 additions & 1 deletion src/language_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -2013,7 +2013,6 @@ static languageDefinition language_en = { whichPluralForm_en, {
{ MISSING_SEMICOLON, 0, "entity \"%s\" doesn't end in ';'" },
{ MISSING_STARTTAG, 0, "missing <%s>" },
{ MISSING_TITLE_ELEMENT, 0, "inserting missing 'title' element" },
{ MOVED_STYLE_TO_HEAD, 0, "moved <style> tag to <head>! fix-style-tags: no to avoid." },
{ NESTED_EMPHASIS, 0, "nested emphasis %s" },
{ NESTED_QUOTATION, 0, "nested q elements, possible typo." },
{ NEWLINE_IN_URI, 0, "%s discarding newline in URI reference" },
Expand Down
1 change: 0 additions & 1 deletion src/language_pt_br.h
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,6 @@ static languageDefinition language_pt_br = { whichPluralForm_pt_br, {
{ MISSING_SEMICOLON, 0, "entidade \"%s\" não termina em ';'" },
{ MISSING_STARTTAG, 0, "faltando <%s>" },
{ MISSING_TITLE_ELEMENT, 0, "inserindo elemento faltante 'title'" },
{ MOVED_STYLE_TO_HEAD, 0, "tag <style> movida para <head>! fix-style-tags: no para evitar." },
{ NESTED_EMPHASIS, 0, "ênfase aninhada %s" },
{ NESTED_QUOTATION, 0, "elementos q aninhados, possível erro de escrita." },
{ NEWLINE_IN_URI, 0, "%s descartando nova linha na referência de URI" },
Expand Down
2 changes: 0 additions & 2 deletions src/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ static struct _dispatchTable {
{ MISSING_SEMICOLON, TidyWarning, formatStandard },
{ MISSING_STARTTAG, TidyWarning, formatStandard },
{ MISSING_TITLE_ELEMENT, TidyWarning, formatStandard },
{ MOVED_STYLE_TO_HEAD, TidyWarning, formatStandard },
{ NESTED_EMPHASIS, TidyWarning, formatStandard },
{ NESTED_QUOTATION, TidyWarning, formatStandard },
{ NEWLINE_IN_URI, TidyWarning, formatAttributeReport },
Expand Down Expand Up @@ -826,7 +825,6 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin
case ELEMENT_NOT_EMPTY:
case FOUND_STYLE_IN_BODY:
case ILLEGAL_NESTING:
case MOVED_STYLE_TO_HEAD:
case TRIM_EMPTY_ELEMENT:
case UNEXPECTED_END_OF_FILE:
return TY_(tidyMessageCreateWithNode)(doc, rpt, code, level, elemdesc );
Expand Down