Is #709 - Improve message if 'implict'

This commit is contained in:
Geoff McLane 2018-04-06 14:48:26 +02:00
parent 0c182bbfa1
commit d85cc8c23d
4 changed files with 12 additions and 2 deletions

View file

@ -171,6 +171,7 @@ extern "C" {
#define FOREACH_REPORT_MSG(FN) \ #define FOREACH_REPORT_MSG(FN) \
FN(ADDED_MISSING_CHARSET) \ FN(ADDED_MISSING_CHARSET) \
FN(ANCHOR_NOT_UNIQUE) \ FN(ANCHOR_NOT_UNIQUE) \
FN(ANCHOR_DUPLICATED) \
FN(APOS_UNDEFINED) \ FN(APOS_UNDEFINED) \
FN(ATTR_VALUE_NOT_LCASE) \ FN(ATTR_VALUE_NOT_LCASE) \
FN(ATTRIBUTE_IS_NOT_ALLOWED) \ FN(ATTRIBUTE_IS_NOT_ALLOWED) \

View file

@ -1659,7 +1659,10 @@ void CheckName( TidyDocImpl* doc, Node *node, AttVal *attval)
if ((old = GetNodeByAnchor(doc, attval->value)) && old != node) if ((old = GetNodeByAnchor(doc, attval->value)) && old != node)
{ {
TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE); if (node->implicit) /* Is #709 - improve warning text */
TY_(ReportAttrError)(doc, node, attval, ANCHOR_DUPLICATED);
else
TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE);
} }
else else
AddAnchor( doc, attval->value, node ); AddAnchor( doc, attval->value, node );
@ -1687,7 +1690,10 @@ void CheckId( TidyDocImpl* doc, Node *node, AttVal *attval )
if ((old = GetNodeByAnchor(doc, attval->value)) && old != node) if ((old = GetNodeByAnchor(doc, attval->value)) && old != node)
{ {
TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE); if (node->implicit) /* Is #709 - improve warning text */
TY_(ReportAttrError)(doc, node, attval, ANCHOR_DUPLICATED);
else
TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE);
} }
else else
AddAnchor( doc, attval->value, node ); AddAnchor( doc, attval->value, node );

View file

@ -1924,6 +1924,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
********************************************/ ********************************************/
{ ADDED_MISSING_CHARSET, 0, "Added appropriate missing <meta charset=...> to %s" }, { ADDED_MISSING_CHARSET, 0, "Added appropriate missing <meta charset=...> to %s" },
{ ANCHOR_NOT_UNIQUE, 0, "%s anchor \"%s\" already defined" }, { ANCHOR_NOT_UNIQUE, 0, "%s anchor \"%s\" already defined" },
{ ANCHOR_DUPLICATED, 0, "Implicit %s anchor \"%s\" duplicated by Tidy." },
{ APOS_UNDEFINED, 0, "named entity &apos; only defined in XML/XHTML" }, { APOS_UNDEFINED, 0, "named entity &apos; only defined in XML/XHTML" },
{ ATTR_VALUE_NOT_LCASE, 0, "%s attribute value \"%s\" must be lower case for XHTML" }, { ATTR_VALUE_NOT_LCASE, 0, "%s attribute value \"%s\" must be lower case for XHTML" },
{ ATTRIBUTE_IS_NOT_ALLOWED, 0, "%s attribute \"is\" not allowed for autonomous custom tags." }, { ATTRIBUTE_IS_NOT_ALLOWED, 0, "%s attribute \"is\" not allowed for autonomous custom tags." },

View file

@ -261,6 +261,7 @@ static struct _dispatchTable {
} dispatchTable[] = { } dispatchTable[] = {
{ ADDED_MISSING_CHARSET, TidyInfo, formatStandard }, { ADDED_MISSING_CHARSET, TidyInfo, formatStandard },
{ ANCHOR_NOT_UNIQUE, TidyWarning, formatAttributeReport }, { ANCHOR_NOT_UNIQUE, TidyWarning, formatAttributeReport },
{ ANCHOR_DUPLICATED, TidyWarning, formatAttributeReport },
{ APOS_UNDEFINED, TidyWarning, formatStandard }, { APOS_UNDEFINED, TidyWarning, formatStandard },
{ ATTR_VALUE_NOT_LCASE, TidyWarning, formatAttributeReport }, { ATTR_VALUE_NOT_LCASE, TidyWarning, formatAttributeReport },
{ ATTRIBUTE_VALUE_REPLACED, TidyInfo, formatAttributeReport }, { ATTRIBUTE_VALUE_REPLACED, TidyInfo, formatAttributeReport },
@ -583,6 +584,7 @@ TidyMessageImpl *formatAttributeReport(TidyDocImpl* doc, Node *element, Node *no
return TY_(tidyMessageCreateWithNode)(doc, node, code, level, tagdesc, name, HTMLVersion(doc)); return TY_(tidyMessageCreateWithNode)(doc, node, code, level, tagdesc, name, HTMLVersion(doc));
case ANCHOR_NOT_UNIQUE: case ANCHOR_NOT_UNIQUE:
case ANCHOR_DUPLICATED:
case ATTR_VALUE_NOT_LCASE: case ATTR_VALUE_NOT_LCASE:
case PROPRIETARY_ATTR_VALUE: case PROPRIETARY_ATTR_VALUE:
case XML_ID_SYNTAX: case XML_ID_SYNTAX: