Is. #839 - 2nd look - add new message for 'blank' title
This is a compromise - 1. Keep insertion of a blank title tag, if none. 2. Add new warn if title tag is blank, in html5 modified: include/tidyenum.h modified: src/language_en.h modified: src/message.c modified: src/parser.c
This commit is contained in:
parent
188988022d
commit
48efad6a2b
|
@ -282,7 +282,8 @@ extern "C" {
|
|||
FN(VENDOR_SPECIFIC_CHARS) \
|
||||
FN(WHITE_IN_URI) \
|
||||
FN(XML_DECLARATION_DETECTED) \
|
||||
FN(XML_ID_SYNTAX)
|
||||
FN(XML_ID_SYNTAX) \
|
||||
FN(BLANK_TITLE_ELEMENT)
|
||||
|
||||
|
||||
/** These are report messages added by Tidy's accessibility module.
|
||||
|
|
|
@ -2055,6 +2055,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
|||
{ WHITE_IN_URI, 0, "%s discarding whitespace in URI reference" },
|
||||
{ XML_DECLARATION_DETECTED, 0, "An XML declaration was detected. Did you mean to use input-xml?" },
|
||||
{ XML_ID_SYNTAX, 0, "%s ID \"%s\" uses XML ID syntax" },
|
||||
{ BLANK_TITLE_ELEMENT, 0, "blank 'title' element" },
|
||||
|
||||
|
||||
/***************************************
|
||||
|
|
|
@ -372,6 +372,7 @@ static struct _dispatchTable {
|
|||
{ WHITE_IN_URI, TidyWarning, formatAttributeReport },
|
||||
{ XML_DECLARATION_DETECTED, TidyWarning, formatStandard },
|
||||
{ XML_ID_SYNTAX, TidyWarning, formatAttributeReport },
|
||||
{ BLANK_TITLE_ELEMENT, TidyWarning, formatStandard },
|
||||
|
||||
{ APPLET_MISSING_ALT, TidyAccess, formatAccessReport },
|
||||
{ AREA_MISSING_ALT, TidyAccess, formatAccessReport },
|
||||
|
@ -819,6 +820,7 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin
|
|||
case NESTED_QUOTATION:
|
||||
case SUSPECTED_MISSING_QUOTE:
|
||||
case XML_DECLARATION_DETECTED:
|
||||
case BLANK_TITLE_ELEMENT:
|
||||
return TY_(tidyMessageCreateWithNode)(doc, rpt, code, level );
|
||||
|
||||
case ELEMENT_NOT_EMPTY:
|
||||
|
|
11
src/parser.c
11
src/parser.c
|
@ -4713,7 +4713,8 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
|
|||
TY_(ParseHTML)(doc, html, IgnoreWhitespace);
|
||||
}
|
||||
|
||||
if (!TY_(FindTITLE)(doc))
|
||||
node = TY_(FindTITLE)(doc);
|
||||
if (!node)
|
||||
{
|
||||
Node* head = TY_(FindHEAD)(doc);
|
||||
/* #72, avoid MISSING_TITLE_ELEMENT if show-body-only (but allow InsertNodeAtEnd to avoid new warning) */
|
||||
|
@ -4723,6 +4724,14 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
|
|||
}
|
||||
TY_(InsertNodeAtEnd)(head, TY_(InferredTag)(doc, TidyTag_TITLE));
|
||||
}
|
||||
else if (!node->content && !showingBodyOnly(doc))
|
||||
{
|
||||
/* Is #839 - warn node is blank in HTML5 */
|
||||
if (TY_(IsHTML5Mode)(doc))
|
||||
{
|
||||
TY_(Report)(doc, node, NULL, BLANK_TITLE_ELEMENT);
|
||||
}
|
||||
}
|
||||
|
||||
AttributeChecks(doc, &doc->root);
|
||||
ReplaceObsoleteElements(doc, &doc->root);
|
||||
|
|
Loading…
Reference in a new issue