Migrated reports using formatFileError and formatStandard to flexible messaging system. Migrated old reportNotice() to report().
This commit is contained in:
parent
1d2c019162
commit
283f8974c3
20
src/clean.c
20
src/clean.c
|
@ -1986,7 +1986,7 @@ void TY_(CleanWord2000)( TidyDocImpl* doc, Node *node)
|
|||
* meaning this result would not ordinarily be displayed.
|
||||
*/
|
||||
Node* next;
|
||||
TY_(ReportNotice)(doc, NULL, node, PROPRIETARY_ELEMENT);
|
||||
TY_(Report)(doc, NULL, node, PROPRIETARY_ELEMENT);
|
||||
DiscardContainer( doc, node, &next );
|
||||
node = next;
|
||||
continue;
|
||||
|
@ -2358,7 +2358,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
if (charsetFound || !charsetAttr->value)
|
||||
{
|
||||
prevNode = currentNode->prev;
|
||||
TY_(ReportNotice)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(DiscardElement)(doc, currentNode);
|
||||
currentNode = prevNode;
|
||||
continue;
|
||||
|
@ -2395,7 +2395,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
if (!httpEquivAttr->value)
|
||||
{
|
||||
prevNode = currentNode->prev;
|
||||
TY_(ReportNotice)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(DiscardElement)(doc, currentNode);
|
||||
currentNode = prevNode;
|
||||
continue;
|
||||
|
@ -2412,7 +2412,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
#if 0 /* 0000000000000000000000000000000000000000000000000 */
|
||||
prevNode = currentNode->prev;
|
||||
/* maybe need better message here */
|
||||
TY_(ReportNotice)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(DiscardElement)(doc, currentNode);
|
||||
currentNode = prevNode;
|
||||
#endif /* 000000000000000000000000000000000000000000000000 */
|
||||
|
@ -2429,7 +2429,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
if (charsetFound)
|
||||
{
|
||||
prevNode = currentNode->prev;
|
||||
TY_(ReportNotice)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(DiscardElement)(doc, currentNode);
|
||||
currentNode = prevNode;
|
||||
continue;
|
||||
|
@ -2442,7 +2442,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
if (charsetFound)
|
||||
{
|
||||
prevNode = currentNode->prev;
|
||||
TY_(ReportNotice)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(DiscardElement)(doc, currentNode);
|
||||
currentNode = prevNode;
|
||||
}
|
||||
|
@ -2469,7 +2469,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
{
|
||||
/* printf("WARN ABOUT HTTP EQUIV AND CHARSET ATTR! \n"); */
|
||||
prevNode = currentNode->prev;
|
||||
TY_(ReportNotice)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(Report)(doc, head, currentNode, DISCARDING_UNEXPECTED);
|
||||
TY_(DiscardElement)(doc, currentNode);
|
||||
currentNode = prevNode;
|
||||
}
|
||||
|
@ -2496,7 +2496,7 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
|
|||
tidyBufFree(&buf);
|
||||
}
|
||||
TY_(InsertNodeAtStart)(head, metaTag);
|
||||
TY_(ReportNotice)(doc, metaTag, head, ADDED_MISSING_CHARSET); /* actually just 'Info:' */
|
||||
TY_(Report)(doc, metaTag, head, ADDED_MISSING_CHARSET); /* actually just 'Info:' */
|
||||
}
|
||||
tidyBufFree(&charsetString);
|
||||
return yes;
|
||||
|
@ -2882,11 +2882,11 @@ 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_(ReportNotice)(doc, node, head, MOVED_STYLE_TO_HEAD); /* report move */
|
||||
TY_(Report)(doc, node, head, MOVED_STYLE_TO_HEAD); /* report move */
|
||||
}
|
||||
else
|
||||
{
|
||||
TY_(ReportNotice)(doc, node, head, FOUND_STYLE_IN_BODY);
|
||||
TY_(Report)(doc, node, head, FOUND_STYLE_IN_BODY);
|
||||
}
|
||||
}
|
||||
else if (node->content)
|
||||
|
|
|
@ -788,7 +788,7 @@ int TY_(ParseConfigFileEnc)( TidyDocImpl* doc, ctmbstr file, ctmbstr charenc )
|
|||
|
||||
if ( fin == NULL || enc < 0 )
|
||||
{
|
||||
TY_(FileError)( doc, fname, TidyConfig, FILE_CANT_OPEN );
|
||||
TY_(ReportFileError)( doc, fname, FILE_CANT_OPEN_CFG );
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
|
|
22
src/lexer.c
22
src/lexer.c
|
@ -2454,7 +2454,7 @@ static Node *GetCDATA( TidyDocImpl* doc, Node *container )
|
|||
if ((TY_(IsJavaScript)(container)) && cfgBool(doc, TidyEscapeScripts))
|
||||
{
|
||||
/* Issue #281 - only warn if adding the escape! */
|
||||
TY_(ReportNotice)(doc, NULL, NULL, BAD_CDATA_CONTENT);
|
||||
TY_(Report)(doc, NULL, NULL, BAD_CDATA_CONTENT);
|
||||
|
||||
for (i = lexer->lexsize; i > start-1; --i)
|
||||
lexer->lexbuf[i] = lexer->lexbuf[i-1];
|
||||
|
@ -2472,7 +2472,7 @@ static Node *GetCDATA( TidyDocImpl* doc, Node *container )
|
|||
lexer->txtend = lexer->lexsize;
|
||||
|
||||
if (c == EndOfStream)
|
||||
TY_(ReportNotice)(doc, container, NULL, MISSING_ENDTAG_FOR );
|
||||
TY_(Report)(doc, container, NULL, MISSING_ENDTAG_FOR );
|
||||
|
||||
/* this was disabled for some reason... */
|
||||
#if 0
|
||||
|
@ -2764,7 +2764,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
|||
continue;
|
||||
}
|
||||
|
||||
TY_(ReportNotice)(doc, NULL, NULL, MALFORMED_COMMENT );
|
||||
TY_(Report)(doc, NULL, NULL, MALFORMED_COMMENT );
|
||||
}
|
||||
else if (c == 'd' || c == 'D')
|
||||
{
|
||||
|
@ -3013,9 +3013,9 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
|||
for older HTML, because it's not truly supported
|
||||
by the standard, although Tidy will allow it. */
|
||||
if ( (doc->lexer->doctype & VERS_HTML5) > 0 && TY_(elementIsAutonomousCustomFormat)( lexer->token->element ) )
|
||||
TY_(ReportNotice)( doc, NULL, lexer->token, UNKNOWN_ELEMENT_LOOKS_CUSTOM );
|
||||
TY_(Report)( doc, NULL, lexer->token, UNKNOWN_ELEMENT_LOOKS_CUSTOM );
|
||||
else
|
||||
TY_(ReportNotice)( doc, NULL, lexer->token, UNKNOWN_ELEMENT );
|
||||
TY_(Report)( doc, NULL, lexer->token, UNKNOWN_ELEMENT );
|
||||
}
|
||||
}
|
||||
else if ( !cfgBool(doc, TidyXmlTags) )
|
||||
|
@ -3048,7 +3048,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
|||
if (c == '>')
|
||||
{
|
||||
if (badcomment)
|
||||
TY_(ReportNotice)(doc, NULL, NULL, MALFORMED_COMMENT );
|
||||
TY_(Report)(doc, NULL, NULL, MALFORMED_COMMENT );
|
||||
|
||||
/* do not store closing -- in lexbuf */
|
||||
lexer->lexsize -= 2;
|
||||
|
@ -3163,7 +3163,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
|||
|
||||
if (c == EndOfStream)
|
||||
{
|
||||
TY_(ReportNotice)(doc, NULL, NULL, UNEXPECTED_END_OF_FILE );
|
||||
TY_(Report)(doc, NULL, NULL, UNEXPECTED_END_OF_FILE );
|
||||
TY_(UngetChar)(c, doc->docIn);
|
||||
continue;
|
||||
}
|
||||
|
@ -3474,7 +3474,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
|||
else if (lexer->state == LEX_COMMENT) /* comment */
|
||||
{
|
||||
if (c == EndOfStream)
|
||||
TY_(ReportNotice)(doc, NULL, NULL, MALFORMED_COMMENT );
|
||||
TY_(Report)(doc, NULL, NULL, MALFORMED_COMMENT );
|
||||
|
||||
lexer->txtend = lexer->lexsize;
|
||||
lexer->lexbuf[lexer->lexsize] = '\0';
|
||||
|
@ -4111,7 +4111,7 @@ static tmbstr ParseValue( TidyDocImpl* doc, ctmbstr name,
|
|||
!(TY_(IsUrl)(doc, name) && TY_(tmbstrncmp)(lexer->lexbuf+start, "javascript:", 11) == 0) &&
|
||||
!(TY_(tmbstrncmp)(lexer->lexbuf+start, "<xml ", 5) == 0)
|
||||
)
|
||||
TY_(ReportNotice)( doc, NULL, NULL, SUSPECTED_MISSING_QUOTE );
|
||||
TY_(Report)( doc, NULL, NULL, SUSPECTED_MISSING_QUOTE );
|
||||
}
|
||||
|
||||
len = lexer->lexsize - start;
|
||||
|
@ -4383,7 +4383,7 @@ static Node *ParseDocTypeDecl(TidyDocImpl* doc)
|
|||
|
||||
if (!node->element || !IsValidXMLElemName(node->element))
|
||||
{
|
||||
TY_(ReportNotice)(doc, NULL, NULL, MALFORMED_DOCTYPE);
|
||||
TY_(Report)(doc, NULL, NULL, MALFORMED_DOCTYPE);
|
||||
TY_(FreeNode)(doc, node);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -4469,7 +4469,7 @@ static Node *ParseDocTypeDecl(TidyDocImpl* doc)
|
|||
}
|
||||
|
||||
/* document type declaration not finished */
|
||||
TY_(ReportNotice)(doc, NULL, NULL, MALFORMED_DOCTYPE);
|
||||
TY_(Report)(doc, NULL, NULL, MALFORMED_DOCTYPE);
|
||||
TY_(FreeNode)(doc, node);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam ) {
|
|||
TY_(freeStreamIn)( in );
|
||||
}
|
||||
else /* Error message! */
|
||||
TY_(FileError)( doc, filnam, TidyError, FILE_CANT_OPEN );
|
||||
TY_(ReportFileError)( doc, filnam, FILE_CANT_OPEN );
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
161
src/message.c
161
src/message.c
|
@ -282,6 +282,7 @@ static struct _dispatchTable {
|
|||
{ ENCODING_MISMATCH, TidyWarning, NULL },
|
||||
{ ESCAPED_ILLEGAL_URI, TidyWarning, formatAttributeReport },
|
||||
{ FILE_CANT_OPEN, TidyBadDocument, formatFileError },
|
||||
{ FILE_CANT_OPEN_CFG, TidyBadDocument, formatFileError },
|
||||
{ FILE_NOT_FILE, TidyBadDocument, formatFileError },
|
||||
{ FIXED_BACKSLASH, TidyWarning, formatAttributeReport },
|
||||
{ FOUND_STYLE_IN_BODY, TidyWarning, formatStandard },
|
||||
|
@ -547,6 +548,7 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin
|
|||
case MISSING_STARTTAG:
|
||||
case TOO_MANY_ELEMENTS:
|
||||
case UNEXPECTED_ENDTAG:
|
||||
case UNEXPECTED_ENDTAG_ERR: /* generated by XML docs */
|
||||
/* Can we use `rpt` here? No; `element` has a value in every case. */
|
||||
return TY_(tidyMessageCreateWithNode)(doc, node, code, level, node->element );
|
||||
break;
|
||||
|
@ -571,7 +573,9 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin
|
|||
break;
|
||||
|
||||
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 );
|
||||
|
@ -583,6 +587,7 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin
|
|||
return TY_(tidyMessageCreateWithNode)(doc, rpt, code, level, elemdesc, nodedesc );
|
||||
break;
|
||||
|
||||
case ADDED_MISSING_CHARSET:
|
||||
case BAD_SUMMARY_HTML5:
|
||||
case NESTED_EMPHASIS:
|
||||
case PROPRIETARY_ELEMENT:
|
||||
|
@ -711,11 +716,6 @@ void TY_(Report)(TidyDocImpl* doc, Node *element, Node *node, uint code, ...)
|
|||
*********************************************************************/
|
||||
|
||||
|
||||
//void TY_(ReportFileError)( TidyDocImpl* doc, ctmbstr file, uint code )
|
||||
//{
|
||||
// TY_(Report)(doc, NULL, NULL, code, file);
|
||||
//}
|
||||
|
||||
void TY_(ReportAttrError)(TidyDocImpl* doc, Node *node, AttVal *av, uint code)
|
||||
{
|
||||
TY_(Report)(doc, NULL, node, code, av);
|
||||
|
@ -729,149 +729,9 @@ void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option )
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Legacy High Level Message Writing Functions - General
|
||||
* These will be transitioned to the new reporting method.
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code)
|
||||
void TY_(ReportFileError)( TidyDocImpl* doc, ctmbstr file, uint code )
|
||||
{
|
||||
TidyMessageImpl *message = NULL;
|
||||
TidyMessageImpl *message2 = NULL;
|
||||
Node* rpt = ( element ? element : node );
|
||||
char nodedesc[256] = { 0 };
|
||||
char elemdesc[256] = { 0 };
|
||||
ctmbstr tagtype;
|
||||
|
||||
TagToString(node, nodedesc, sizeof(nodedesc));
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case INSERTING_TAG:
|
||||
case MISSING_STARTTAG:
|
||||
case TOO_MANY_ELEMENTS:
|
||||
case UNEXPECTED_ENDTAG:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyWarning, node->element );
|
||||
break;
|
||||
|
||||
case CANT_BE_NESTED:
|
||||
case NOFRAMES_CONTENT:
|
||||
case PROPRIETARY_ELEMENT:
|
||||
case USING_BR_INPLACE_OF:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyWarning, nodedesc );
|
||||
break;
|
||||
|
||||
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:
|
||||
TagToString(element, elemdesc, sizeof(elemdesc));
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, element, code, TidyWarning, elemdesc);
|
||||
break;
|
||||
|
||||
case BAD_CDATA_CONTENT:
|
||||
case CONTENT_AFTER_BODY:
|
||||
case DOCTYPE_AFTER_TAGS:
|
||||
case MALFORMED_COMMENT:
|
||||
case MALFORMED_DOCTYPE:
|
||||
case MISSING_TITLE_ELEMENT:
|
||||
case NESTED_QUOTATION:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning );
|
||||
break;
|
||||
|
||||
case REPLACING_ELEMENT:
|
||||
TagToString(element, elemdesc, sizeof(elemdesc));
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning, elemdesc, nodedesc );
|
||||
break;
|
||||
|
||||
case OBSOLETE_ELEMENT:
|
||||
case REPLACING_UNEX_ELEMENT:
|
||||
TagToString(element, elemdesc, sizeof(elemdesc));
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning, elemdesc, nodedesc );
|
||||
break;
|
||||
|
||||
case MISSING_ENDTAG_FOR:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning, element->element );
|
||||
break;
|
||||
|
||||
case MISSING_ENDTAG_BEFORE:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning, element->element, nodedesc );
|
||||
break;
|
||||
|
||||
case BAD_SUMMARY_HTML5:
|
||||
case NESTED_EMPHASIS:
|
||||
case REMOVED_HTML5:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning, nodedesc );
|
||||
break;
|
||||
|
||||
case COERCE_TO_ENDTAG:
|
||||
case NON_MATCHING_ENDTAG:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyWarning, node->element, node->element );
|
||||
break;
|
||||
|
||||
case MISSING_DOCTYPE:
|
||||
case SPACE_PRECEDING_XMLDECL:
|
||||
case XML_DECLARATION_DETECTED:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyWarning );
|
||||
break;
|
||||
|
||||
case ELEMENT_VERS_MISMATCH_WARN:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyWarning, nodedesc, HTMLVersion( doc ) );
|
||||
break;
|
||||
|
||||
case ELEMENT_VERS_MISMATCH_ERROR:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyError, nodedesc, HTMLVersion( doc ) );
|
||||
break;
|
||||
|
||||
case TOO_MANY_ELEMENTS_IN:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyWarning, node->element, node->element );
|
||||
message2 = TY_(tidyMessageCreateWithNode)(doc, node, PREVIOUS_LOCATION, TidyInfo, element->element );
|
||||
break;
|
||||
|
||||
case DISCARDING_UNEXPECTED:
|
||||
/* Force error if in a bad form, or
|
||||
Issue #166 - repeated <main> element
|
||||
*/
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, doc->badForm ? TidyError : TidyWarning, nodedesc );
|
||||
break;
|
||||
|
||||
case TAG_NOT_ALLOWED_IN:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyWarning, nodedesc, element->element );
|
||||
message2 = TY_(tidyMessageCreateWithNode)(doc, element, PREVIOUS_LOCATION, TidyInfo, element->element );
|
||||
break;
|
||||
|
||||
case ADDED_MISSING_CHARSET:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyInfo, nodedesc);
|
||||
break;
|
||||
|
||||
case DUPLICATE_FRAMESET:
|
||||
case SUSPECTED_MISSING_QUOTE:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, rpt, code, TidyError );
|
||||
break;
|
||||
|
||||
case UNKNOWN_ELEMENT:
|
||||
case UNKNOWN_ELEMENT_LOOKS_CUSTOM:
|
||||
TagToString(node, nodedesc, sizeof(nodedesc));
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyError, nodedesc );
|
||||
break;
|
||||
|
||||
case UNEXPECTED_ENDTAG_IN:
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyError, node->element, element->element );
|
||||
break;
|
||||
|
||||
case UNEXPECTED_ENDTAG_ERR: /* generated by XML docs */
|
||||
message = TY_(tidyMessageCreateWithNode)(doc, node, code, TidyError, node->element );
|
||||
break;
|
||||
}
|
||||
|
||||
messageOut( message );
|
||||
|
||||
/* is TidyInfo, but only show it if we're showing warnings! */
|
||||
if ( cfgBool(doc, TidyShowWarnings) == yes )
|
||||
messageOut( message2 );
|
||||
TY_(Report)(doc, NULL, NULL, code, file);
|
||||
}
|
||||
|
||||
|
||||
|
@ -884,13 +744,6 @@ void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code)
|
|||
*********************************************************************/
|
||||
|
||||
|
||||
void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level, uint code )
|
||||
{
|
||||
TidyMessageImpl *message = TY_(tidyMessageCreate)( doc, code, level, file);
|
||||
messageOut( message );
|
||||
}
|
||||
|
||||
|
||||
void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded)
|
||||
{
|
||||
TidyMessageImpl *message = NULL;
|
||||
|
|
|
@ -48,7 +48,6 @@ ctmbstr TY_(tidyLibraryVersion)(void);
|
|||
/** @{ */
|
||||
|
||||
void TY_(Report)(TidyDocImpl* doc, Node *element, Node *node, uint code, ...);
|
||||
void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
@ -58,6 +57,7 @@ void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code);
|
|||
|
||||
void TY_(ReportAttrError)(TidyDocImpl* doc, Node *node, AttVal *av, uint code);
|
||||
void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option );
|
||||
void TY_(ReportFileError)( TidyDocImpl* doc, ctmbstr file, uint code );
|
||||
|
||||
|
||||
/** @} */
|
||||
|
@ -65,7 +65,6 @@ void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option );
|
|||
/** @{ */
|
||||
|
||||
|
||||
void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level, uint code );
|
||||
void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded);
|
||||
void TY_(ReportEncodingWarning)(TidyDocImpl* doc, uint code, uint encoding);
|
||||
void TY_(ReportEntityError)( TidyDocImpl* doc, uint code, ctmbstr entity, int c );
|
||||
|
|
366
src/parser.c
366
src/parser.c
File diff suppressed because it is too large
Load diff
|
@ -993,7 +993,7 @@ void CheckTABLE( TidyDocImpl* doc, Node *node )
|
|||
if (HasSummary && isHTML5)
|
||||
{
|
||||
/* #210 - has summary, and is HTML5, then report obsolete */
|
||||
TY_(ReportNotice)(doc, node, node, BAD_SUMMARY_HTML5);
|
||||
TY_(Report)(doc, node, node, BAD_SUMMARY_HTML5);
|
||||
}
|
||||
else if (!HasSummary && !isHTML5)
|
||||
{
|
||||
|
|
|
@ -921,7 +921,7 @@ FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam )
|
|||
return errout;
|
||||
}
|
||||
else /* Emit message to current error sink */
|
||||
TY_(FileError)( impl, errfilnam, TidyError, FILE_CANT_OPEN );
|
||||
TY_(ReportFileError)( impl, errfilnam, FILE_CANT_OPEN );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ int tidyDocParseFile( TidyDocImpl* doc, ctmbstr filnam )
|
|||
|
||||
if ( !fin )
|
||||
{
|
||||
TY_(FileError)( doc, filnam, TidyError, FILE_NOT_FILE );
|
||||
TY_(ReportFileError)( doc, filnam, FILE_NOT_FILE );
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ int tidyDocParseFile( TidyDocImpl* doc, ctmbstr filnam )
|
|||
TY_(freeStreamIn)(in);
|
||||
}
|
||||
else /* Error message! */
|
||||
TY_(FileError)( doc, filnam, TidyError, FILE_CANT_OPEN );
|
||||
TY_(ReportFileError)( doc, filnam, FILE_CANT_OPEN );
|
||||
return status;
|
||||
#endif
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ int tidyDocSaveFile( TidyDocImpl* doc, ctmbstr filnam )
|
|||
#endif /* PRESERVFILETIMES */
|
||||
}
|
||||
if ( status < 0 ) /* Error message! */
|
||||
TY_(FileError)( doc, filnam, TidyError, FILE_CANT_OPEN );
|
||||
TY_(ReportFileError)( doc, filnam, FILE_CANT_OPEN );
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -1640,7 +1640,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
TY_(CoerceNode)(doc, node, TidyTag_ABBR, warn, no);
|
||||
} else {
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
}
|
||||
} else
|
||||
if ( nodeIsAPPLET(node) ) {
|
||||
|
@ -1651,7 +1651,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
TY_(CoerceNode)(doc, node, TidyTag_OBJECT, warn, no);
|
||||
} else {
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
}
|
||||
} else
|
||||
if ( nodeIsBASEFONT(node) ) {
|
||||
|
@ -1664,7 +1664,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
* - For now just report a warning
|
||||
*/
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
} else
|
||||
if ( nodeIsBIG(node) ) {
|
||||
/* big: CSS equivalent 'font-size:larger'
|
||||
|
@ -1686,7 +1686,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
TY_(CoerceNode)(doc, node, TidyTag_SPAN, warn, no);
|
||||
} else {
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
}
|
||||
} else
|
||||
if ( nodeIsCENTER(node) ) {
|
||||
|
@ -1697,7 +1697,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
* see: static Bool Center2Div( TidyDocImpl* doc, Node *node, Node **pnode)
|
||||
*/
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
} else
|
||||
if ( nodeIsDIR(node) ) {
|
||||
/* dir: replace by <ul>
|
||||
|
@ -1705,7 +1705,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
* Should this be CHANGED???
|
||||
*/
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
} else
|
||||
if ( nodeIsFONT(node) ) {
|
||||
/* Tidy already handles this -
|
||||
|
@ -1714,13 +1714,13 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
* done in Bool Font2Span( TidyDocImpl* doc, Node *node, Node **pnode ) (I think?)
|
||||
*/
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
} else
|
||||
if (( nodesIsFRAME(node) ) || ( nodeIsFRAMESET(node) ) || ( nodeIsNOFRAMES(node) )) {
|
||||
/* YOW: What to do here?????? Maybe <iframe>????
|
||||
*/
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
} else
|
||||
if ( nodeIsSTRIKE(node) ) {
|
||||
/* strike: CSS equivalent 'text-decoration:line-through'
|
||||
|
@ -1731,7 +1731,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
TY_(CoerceNode)(doc, node, TidyTag_SPAN, warn, no);
|
||||
} else {
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
}
|
||||
} else
|
||||
if ( nodeIsTT(node) ) {
|
||||
|
@ -1745,14 +1745,14 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
|
|||
TY_(CoerceNode)(doc, node, TidyTag_SPAN, warn, no);
|
||||
} else {
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
}
|
||||
} else
|
||||
if (TY_(nodeIsElement)(node)) {
|
||||
if (node->tag) {
|
||||
if ( (!(node->tag->versions & VERS_HTML5) && !(node->tag->versions & VERS_PROPRIETARY)) || (inRemovedInfo(node->tag->id)) ) {
|
||||
if ( !already_strict )
|
||||
TY_(ReportNotice)(doc, node, node, REMOVED_HTML5);
|
||||
TY_(Report)(doc, node, node, REMOVED_HTML5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1805,7 +1805,7 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node )
|
|||
/* Version mismatches take priority. */
|
||||
if ( check_versions && !(node->tag->versions & version) )
|
||||
{
|
||||
TY_(ReportNotice)(doc, NULL, node, tagReportType );
|
||||
TY_(Report)(doc, NULL, node, tagReportType );
|
||||
}
|
||||
/* If it's not mismatched, it could still be proprietary. */
|
||||
else if ( node->tag->versions & VERS_PROPRIETARY )
|
||||
|
@ -1825,7 +1825,7 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node )
|
|||
|
||||
if ( (htmlIs5 && !tagLooksCustom) || !htmlIs5 )
|
||||
{
|
||||
TY_(ReportNotice)(doc, NULL, node, PROPRIETARY_ELEMENT );
|
||||
TY_(Report)(doc, NULL, node, PROPRIETARY_ELEMENT );
|
||||
}
|
||||
|
||||
if ( nodeIsLAYER(node) )
|
||||
|
@ -2136,7 +2136,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
|
|||
|
||||
if ( !doc->lexer->isvoyager && doc->xmlDetected )
|
||||
{
|
||||
TY_(ReportNotice)(doc, NULL, TY_(FindXmlDecl)(doc), XML_DECLARATION_DETECTED );
|
||||
TY_(Report)(doc, NULL, TY_(FindXmlDecl)(doc), XML_DECLARATION_DETECTED );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue