Issue #456 - Add 'Info:' message, when meta added.
It also fixes the addition of the constant 'http-equiv="Content-Type" attribute.
This commit is contained in:
parent
13b34c9d8b
commit
a4770daa2b
|
@ -270,7 +270,8 @@ extern "C" {
|
||||||
FN(COERCE_TO_ENDTAG) \
|
FN(COERCE_TO_ENDTAG) \
|
||||||
FN(ELEMENT_NOT_EMPTY) \
|
FN(ELEMENT_NOT_EMPTY) \
|
||||||
FN(UNEXPECTED_END_OF_FILE) \
|
FN(UNEXPECTED_END_OF_FILE) \
|
||||||
FN(UNEXPECTED_ENDTAG)
|
FN(UNEXPECTED_ENDTAG) \
|
||||||
|
FN(ADDED_MISSING_CHARSET)
|
||||||
|
|
||||||
|
|
||||||
/** These are report messages added by Tidy's accessibility module. */
|
/** These are report messages added by Tidy's accessibility module. */
|
||||||
|
|
|
@ -2489,10 +2489,12 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
||||||
tidyBufAppend(&buf, "text/html; ", 11);
|
tidyBufAppend(&buf, "text/html; ", 11);
|
||||||
tidyBufAppend(&buf, charsetString.bp, TY_(tmbstrlen)(charsetString.bp));
|
tidyBufAppend(&buf, charsetString.bp, TY_(tmbstrlen)(charsetString.bp));
|
||||||
tidyBufAppend(&buf, "\0", 1); /* zero terminate the buffer */
|
tidyBufAppend(&buf, "\0", 1); /* zero terminate the buffer */
|
||||||
TY_(AddAttribute)(doc, metaTag, "content", (char*)buf.bp);
|
TY_(AddAttribute)(doc, metaTag, "http-equiv", "Content-Type"); /* add 'http-equiv' const. */
|
||||||
|
TY_(AddAttribute)(doc, metaTag, "content", (char*)buf.bp); /* add 'content="<enc>"' */
|
||||||
tidyBufFree(&buf);
|
tidyBufFree(&buf);
|
||||||
}
|
}
|
||||||
TY_(InsertNodeAtStart)(head, metaTag);
|
TY_(InsertNodeAtStart)(head, metaTag);
|
||||||
|
TY_(ReportError)(doc, metaTag, head, ADDED_MISSING_CHARSET); /* actually just 'Info:' */
|
||||||
}
|
}
|
||||||
tidyBufFree(&charsetString);
|
tidyBufFree(&charsetString);
|
||||||
return yes;
|
return yes;
|
||||||
|
|
|
@ -1900,7 +1900,9 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
{ ELEMENT_NOT_EMPTY, 0, "%s element not empty or not closed" }, /* ReportError, ReportAttrError */
|
{ ELEMENT_NOT_EMPTY, 0, "%s element not empty or not closed" }, /* ReportError, ReportAttrError */
|
||||||
{ UNEXPECTED_END_OF_FILE, 0, "unexpected end of file %s" }, /* ReportError, ReportAttrError */
|
{ UNEXPECTED_END_OF_FILE, 0, "unexpected end of file %s" }, /* ReportError, ReportAttrError */
|
||||||
{ UNEXPECTED_ENDTAG, 0, "unexpected </%s>" }, /* ReportError, ReportFatal */
|
{ UNEXPECTED_ENDTAG, 0, "unexpected </%s>" }, /* ReportError, ReportFatal */
|
||||||
|
|
||||||
|
{ ADDED_MISSING_CHARSET, 0, "Added appropriate missing <meta charset=...> to %s" }, /* ReportInfo */
|
||||||
|
|
||||||
#if SUPPORT_ACCESSIBILITY_CHECKS
|
#if SUPPORT_ACCESSIBILITY_CHECKS
|
||||||
|
|
||||||
/***************************************
|
/***************************************
|
||||||
|
|
|
@ -408,6 +408,11 @@ void TY_(ReportError)(TidyDocImpl* doc, Node *element, Node *node, uint code)
|
||||||
case REMOVED_HTML5:
|
case REMOVED_HTML5:
|
||||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyError, nodedesc );
|
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyError, nodedesc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ADDED_MISSING_CHARSET:
|
||||||
|
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyInfo, nodedesc);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
messageOut( message );
|
messageOut( message );
|
||||||
|
|
Loading…
Reference in a new issue