Add a flag to warn on proprietary attributes
This change adds the TidyWarnPropAttrs flag (default=on) that emits a warning every proprietary attribute it finds.
This commit is contained in:
parent
d8839485a4
commit
a19d271f47
|
@ -632,6 +632,7 @@ typedef enum
|
||||||
TidyUpperCaseTags, /**< Output tags in upper not lower case */
|
TidyUpperCaseTags, /**< Output tags in upper not lower case */
|
||||||
TidyUseCustomTags, /**< Enable Tidy to use autonomous custom tags */
|
TidyUseCustomTags, /**< Enable Tidy to use autonomous custom tags */
|
||||||
TidyVertSpace, /**< degree to which markup is spread out vertically */
|
TidyVertSpace, /**< degree to which markup is spread out vertically */
|
||||||
|
TidyWarnPropAttrs, /**< Warns on proprietary attributes */
|
||||||
TidyWord2000, /**< Draconian cleaning for Word2000 */
|
TidyWord2000, /**< Draconian cleaning for Word2000 */
|
||||||
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
|
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
|
||||||
TidyWrapAttVals, /**< Wrap within attribute values */
|
TidyWrapAttVals, /**< Wrap within attribute values */
|
||||||
|
|
|
@ -322,6 +322,7 @@ static const TidyOptionImpl option_defs[] =
|
||||||
{ TidyUpperCaseTags, MU, "uppercase-tags", BL, no, ParseBool, boolPicks },
|
{ TidyUpperCaseTags, MU, "uppercase-tags", BL, no, ParseBool, boolPicks },
|
||||||
{ TidyUseCustomTags, MU, "custom-tags", IN, TidyCustomNo, ParseUseCustomTags,customTagsPicks }, /* 20170309 - Issue #119 */
|
{ TidyUseCustomTags, MU, "custom-tags", IN, TidyCustomNo, ParseUseCustomTags,customTagsPicks }, /* 20170309 - Issue #119 */
|
||||||
{ TidyVertSpace, PP, "vertical-space", IN, no, ParseAutoBool, autoBoolPicks }, /* #228 - tri option */
|
{ TidyVertSpace, PP, "vertical-space", IN, no, ParseAutoBool, autoBoolPicks }, /* #228 - tri option */
|
||||||
|
{ TidyWarnPropAttrs, MU, "warn-proprietary-attributes", BL, yes, ParseBool, boolPicks },
|
||||||
{ TidyWord2000, MU, "word-2000", BL, no, ParseBool, boolPicks },
|
{ TidyWord2000, MU, "word-2000", BL, no, ParseBool, boolPicks },
|
||||||
{ TidyWrapAsp, PP, "wrap-asp", BL, yes, ParseBool, boolPicks },
|
{ TidyWrapAsp, PP, "wrap-asp", BL, yes, ParseBool, boolPicks },
|
||||||
{ TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParseBool, boolPicks },
|
{ TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParseBool, boolPicks },
|
||||||
|
|
|
@ -1296,6 +1296,17 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
"If set to <var>auto</var> Tidy will eliminate nearly all newline "
|
"If set to <var>auto</var> Tidy will eliminate nearly all newline "
|
||||||
"characters."
|
"characters."
|
||||||
},
|
},
|
||||||
|
{/* Important notes for translators:
|
||||||
|
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
|
||||||
|
<br/>.
|
||||||
|
- Entities, tags, attributes, etc., should be enclosed in <code></code>.
|
||||||
|
- Option values should be enclosed in <var></var>.
|
||||||
|
- It's very important that <br/> be self-closing!
|
||||||
|
- The strings "Tidy" and "HTML Tidy" are the program name and must not
|
||||||
|
be translated. */
|
||||||
|
TidyWarnPropAttrs, 0,
|
||||||
|
"This option specifies if Tidy should warn on proprietary attributes."
|
||||||
|
},
|
||||||
{/* Important notes for translators:
|
{/* Important notes for translators:
|
||||||
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
|
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
|
||||||
<br/>.
|
<br/>.
|
||||||
|
|
|
@ -1823,7 +1823,10 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node )
|
||||||
attrIsMismatched = check_versions ? TY_(AttributeIsMismatched)(node, attval, doc) : no;
|
attrIsMismatched = check_versions ? TY_(AttributeIsMismatched)(node, attval, doc) : no;
|
||||||
/* Let the PROPRIETARY_ATTRIBUTE warning have precedence. */
|
/* Let the PROPRIETARY_ATTRIBUTE warning have precedence. */
|
||||||
if ( attrIsProprietary )
|
if ( attrIsProprietary )
|
||||||
TY_(ReportAttrError)(doc, node, attval, PROPRIETARY_ATTRIBUTE);
|
{
|
||||||
|
if ( cfgBool(doc, TidyWarnPropAttrs) )
|
||||||
|
TY_(ReportAttrError)(doc, node, attval, PROPRIETARY_ATTRIBUTE);
|
||||||
|
}
|
||||||
else if ( attrIsMismatched )
|
else if ( attrIsMismatched )
|
||||||
{
|
{
|
||||||
TY_(ReportAttrError)(doc, node, attval, attrReportType);
|
TY_(ReportAttrError)(doc, node, attval, attrReportType);
|
||||||
|
|
Loading…
Reference in a new issue