Transitioned formatCustomTagDetected to the general formatter.

This commit is contained in:
Jim Derry 2017-09-04 11:44:54 -04:00
parent e3893eb8b3
commit 18754c701d
1 changed files with 23 additions and 35 deletions

View File

@ -236,7 +236,6 @@ typedef TidyMessageImpl*(messageFormatter)(TidyDocImpl* doc, Node *element, Node
/* Forward declarations of messageFormatter functions. */
static messageFormatter formatAttributeReport;
static messageFormatter formatCustomTagDetected;
static messageFormatter formatStandard;
static messageFormatter formatStandardDynamic;
@ -270,7 +269,7 @@ static struct _dispatchTable {
{ CANT_BE_NESTED, TidyWarning, formatStandard },
{ COERCE_TO_ENDTAG, TidyWarning, formatStandard },
{ CONTENT_AFTER_BODY, TidyWarning, formatStandard },
{ CUSTOM_TAG_DETECTED, TidyInfo, formatCustomTagDetected },
{ CUSTOM_TAG_DETECTED, TidyInfo, formatStandard },
{ DISCARDING_UNEXPECTED, 0, formatStandardDynamic },
{ DOCTYPE_AFTER_TAGS, TidyWarning, formatStandard },
{ DUPLICATE_FRAMESET, TidyError, formatStandard },
@ -442,39 +441,6 @@ TidyMessageImpl *formatAttributeReport(TidyDocImpl* doc, Node *element, Node *no
}
/* Provides special formatting for the CUSTOM_TAG_DETECTED report. */
TidyMessageImpl *formatCustomTagDetected(TidyDocImpl* doc, Node *element, Node *node, uint code, uint level, va_list args)
{
char elemdesc[256] = { 0 };
ctmbstr tagtype;
TagToString(element, elemdesc, sizeof(elemdesc));
switch ( code )
{
case CUSTOM_TAG_DETECTED:
switch ( cfg( doc, TidyUseCustomTags ) )
{
case TidyCustomBlocklevel:
tagtype = tidyLocalizedString( TIDYCUSTOMBLOCKLEVEL_STRING );
break;
case TidyCustomEmpty:
tagtype = tidyLocalizedString( TIDYCUSTOMEMPTY_STRING );
break;
case TidyCustomInline:
tagtype = tidyLocalizedString( TIDYCUSTOMINLINE_STRING );
break;
case TidyCustomPre:
default:
tagtype = tidyLocalizedString( TIDYCUSTOMPRE_STRING );
break;
}
}
return TY_(tidyMessageCreateWithNode)(doc, element, code, TidyInfo, elemdesc, tagtype );
}
/* Provides general formatting for the majority of Tidy's reports. Because most
** reports use the same basic data derived from the element and node, this
** formatter covers the vast majority of Tidy's report messages. Note that this
@ -493,6 +459,28 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin
switch ( code )
{
case CUSTOM_TAG_DETECTED:
{
ctmbstr tagtype;
switch ( cfg( doc, TidyUseCustomTags ) )
{
case TidyCustomBlocklevel:
tagtype = tidyLocalizedString( TIDYCUSTOMBLOCKLEVEL_STRING );
break;
case TidyCustomEmpty:
tagtype = tidyLocalizedString( TIDYCUSTOMEMPTY_STRING );
break;
case TidyCustomInline:
tagtype = tidyLocalizedString( TIDYCUSTOMINLINE_STRING );
break;
case TidyCustomPre:
default:
tagtype = tidyLocalizedString( TIDYCUSTOMPRE_STRING );
break;
}
return TY_(tidyMessageCreateWithNode)(doc, element, code, TidyInfo, elemdesc, tagtype );
}
case FILE_CANT_OPEN:
case FILE_CANT_OPEN_CFG:
case FILE_NOT_FILE: