Merge branch 'develop-500' of github.com:htacg/tidy-html5 into develop-500
This commit is contained in:
commit
3e0cfbb88d
31
src/parser.c
31
src/parser.c
|
@ -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);
|
||||
/* #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
|
||||
|
|
Loading…
Reference in a new issue