Merge branch 'develop-500' of github.com:htacg/tidy-html5 into develop-500

This commit is contained in:
Geoff McLane 2015-02-01 14:40:30 +01:00
commit 3e0cfbb88d

View file

@ -4319,6 +4319,29 @@ static void AttributeChecks(TidyDocImpl* doc, Node* node)
}
}
/*
Need to know to avoid error-reporting
*/
Bool showingBodyOnly( TidyDocImpl* doc)
{
Node* node;
TidyTriState bodyOnly = doc->config.value[TidyBodyOnly].v;
switch( bodyOnly )
{
case TidyNoState:
return no;
case TidyYesState:
return yes;
default:
node = TY_(FindBody)( doc );
if (node && node->implicit )
return yes;
}
return yes;
}
/*
HTML is the top level element
*/
@ -4414,7 +4437,8 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
else
html = node;
if (!TY_(FindDocType)(doc))
/* #72, avoid MISSING_DOCTYPE if show-body-only. */
if (!TY_(FindDocType)(doc) && !showingBodyOnly(doc))
TY_(ReportError)(doc, NULL, NULL, MISSING_DOCTYPE);
TY_(InsertNodeAtEnd)( &doc->root, html);
@ -4439,7 +4463,11 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
if (!TY_(FindTITLE)(doc))
{
Node* head = TY_(FindHEAD)(doc);
TY_(ReportError)(doc, head, NULL, MISSING_TITLE_ELEMENT);
/* #72, avoid MISSING_TITLE_ELEMENT if show-body-only (but allow InsertNodeAtEnd to avoid new warning) */
if (!showingBodyOnly(doc))
{
TY_(ReportError)(doc, head, NULL, MISSING_TITLE_ELEMENT);
}
TY_(InsertNodeAtEnd)(head, TY_(InferredTag)(doc, TidyTag_TITLE));
}
@ -4625,6 +4653,7 @@ void TY_(ParseXMLDocument)(TidyDocImpl* doc)
TY_(FixXmlDecl)( doc );
}
/*
* local variables:
* mode: c