- Addresses #320
- Different error output depending on whether or not the `alt-text` option was given a value.
This commit is contained in:
parent
db4f6473ed
commit
933fc3d236
|
@ -68,6 +68,7 @@ static struct _msgfmt
|
|||
|
||||
/* attribute name */
|
||||
{ INSERTING_ATTRIBUTE, "%s inserting \"%s\" attribute" }, /* Warning in CheckLINK, Error otherwise */
|
||||
{ INSERTING_AUTO_ATTRIBUTE, "%s inserting \"%s\" attribute using value \"%s\"" }, /* Error */
|
||||
{ MISSING_ATTR_VALUE, "%s attribute \"%s\" lacks value" }, /* Warning in CheckUrl, Error otherwise */
|
||||
{ UNKNOWN_ATTRIBUTE, "%s unknown attribute \"%s\"" }, /* Error */
|
||||
{ PROPRIETARY_ATTRIBUTE, "%s proprietary attribute \"%s\"" }, /* Error */
|
||||
|
@ -400,9 +401,11 @@ static const TidyOptionDoc option_docs[] =
|
|||
},
|
||||
{TidyAltText,
|
||||
"This option specifies the default <code>alt=</code> text Tidy uses for "
|
||||
"<code><img></code> attributes. "
|
||||
"<code><img></code> attributes when the <code>alt=</code> attribute "
|
||||
"is missing. "
|
||||
"<br/>"
|
||||
"Use with care, as this feature suppresses further accessibility warnings. "
|
||||
"Use with care, as it is your responsibility to make your documents accessible "
|
||||
"to people who cannot see the images. "
|
||||
},
|
||||
{TidyXmlPIs,
|
||||
"This option specifies if Tidy should change the parsing of processing "
|
||||
|
@ -1549,6 +1552,7 @@ void TY_(ReportAttrError)(TidyDocImpl* doc, Node *node, AttVal *av, uint code)
|
|||
case BAD_ATTRIBUTE_VALUE:
|
||||
case BAD_ATTRIBUTE_VALUE_REPLACED:
|
||||
case INVALID_ATTRIBUTE:
|
||||
case INSERTING_AUTO_ATTRIBUTE:
|
||||
messageNode(doc, TidyWarning, node, fmt, tagdesc, name, value);
|
||||
break;
|
||||
|
||||
|
|
|
@ -120,25 +120,26 @@ void TY_(ReportFatal)(TidyDocImpl* doc, Node* element, Node* node, uint code);
|
|||
|
||||
#define UNKNOWN_ATTRIBUTE 48
|
||||
#define INSERTING_ATTRIBUTE 49
|
||||
#define MISSING_ATTR_VALUE 50
|
||||
#define BAD_ATTRIBUTE_VALUE 51
|
||||
#define UNEXPECTED_GT 52
|
||||
#define PROPRIETARY_ATTRIBUTE 53
|
||||
#define PROPRIETARY_ATTR_VALUE 54
|
||||
#define REPEATED_ATTRIBUTE 55
|
||||
#define MISSING_IMAGEMAP 56
|
||||
#define XML_ATTRIBUTE_VALUE 57
|
||||
#define UNEXPECTED_QUOTEMARK 58
|
||||
#define MISSING_QUOTEMARK 59
|
||||
#define ID_NAME_MISMATCH 60
|
||||
#define INSERTING_AUTO_ATTRIBUTE 50
|
||||
#define MISSING_ATTR_VALUE 51
|
||||
#define BAD_ATTRIBUTE_VALUE 52
|
||||
#define UNEXPECTED_GT 53
|
||||
#define PROPRIETARY_ATTRIBUTE 54
|
||||
#define PROPRIETARY_ATTR_VALUE 55
|
||||
#define REPEATED_ATTRIBUTE 56
|
||||
#define MISSING_IMAGEMAP 57
|
||||
#define XML_ATTRIBUTE_VALUE 58
|
||||
#define UNEXPECTED_QUOTEMARK 59
|
||||
#define MISSING_QUOTEMARK 60
|
||||
#define ID_NAME_MISMATCH 61
|
||||
|
||||
#define BACKSLASH_IN_URI 61
|
||||
#define FIXED_BACKSLASH 62
|
||||
#define ILLEGAL_URI_REFERENCE 63
|
||||
#define ESCAPED_ILLEGAL_URI 64
|
||||
#define BACKSLASH_IN_URI 62
|
||||
#define FIXED_BACKSLASH 63
|
||||
#define ILLEGAL_URI_REFERENCE 64
|
||||
#define ESCAPED_ILLEGAL_URI 65
|
||||
|
||||
#define NEWLINE_IN_URI 65
|
||||
#define ANCHOR_NOT_UNIQUE 66
|
||||
#define NEWLINE_IN_URI 66
|
||||
#define ANCHOR_NOT_UNIQUE 67
|
||||
|
||||
#define JOINING_ATTRIBUTE 68
|
||||
#define UNEXPECTED_EQUALSIGN 69
|
||||
|
|
|
@ -852,14 +852,16 @@ void CheckIMG( TidyDocImpl* doc, Node *node )
|
|||
|
||||
if ( !HasAlt )
|
||||
{
|
||||
if ( cfg(doc, TidyAccessibilityCheckLevel) == 0 )
|
||||
if ( cfg(doc, TidyAccessibilityCheckLevel) == 0 && !cfgStr(doc, TidyAltText) )
|
||||
{
|
||||
doc->badAccess |= BA_MISSING_IMAGE_ALT;
|
||||
TY_(ReportMissingAttr)( doc, node, "alt" );
|
||||
}
|
||||
|
||||
if ( cfgStr(doc, TidyAltText) )
|
||||
TY_(AddAttribute)( doc, node, "alt", cfgStr(doc, TidyAltText) );
|
||||
if ( cfgStr(doc, TidyAltText) ) {
|
||||
AttVal *attval = TY_(AddAttribute)( doc, node, "alt", cfgStr(doc, TidyAltText) );
|
||||
TY_(ReportAttrError)( doc, node, attval, INSERTING_AUTO_ATTRIBUTE);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !HasSrc && !HasDataFld )
|
||||
|
|
Loading…
Reference in a new issue