Merge pull request #714 from htacg/issue-709

Is #709 - Improve message if 'implicit' - PR #714
This commit is contained in:
Geoff McLane 2018-04-23 19:12:59 +02:00 committed by GitHub
commit a95c82df7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,6 +1659,9 @@ void CheckName( TidyDocImpl* doc, Node *node, AttVal *attval)
if ((old = GetNodeByAnchor(doc, attval->value)) && old != node) if ((old = GetNodeByAnchor(doc, attval->value)) && old != node)
{ {
if (node->implicit) /* Is #709 - improve warning text */
TY_(ReportAttrError)(doc, node, attval, ANCHOR_DUPLICATED);
else
TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE); TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE);
} }
else else
@ -1687,6 +1690,9 @@ void CheckId( TidyDocImpl* doc, Node *node, AttVal *attval )
if ((old = GetNodeByAnchor(doc, attval->value)) && old != node) if ((old = GetNodeByAnchor(doc, attval->value)) && old != node)
{ {
if (node->implicit) /* Is #709 - improve warning text */
TY_(ReportAttrError)(doc, node, attval, ANCHOR_DUPLICATED);
else
TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE); TY_(ReportAttrError)( doc, node, attval, ANCHOR_NOT_UNIQUE);
} }
else else

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: