Added squelch-id (TidySquelchShow) so that message ID's will be displayed in

the report output table. This can be used to show message ID's that the user
can use to filter against in the upcoming `squelch` option.
This commit is contained in:
Jim Derry 2017-10-07 18:10:46 -04:00
parent ca2f089e89
commit ab8a4249df
4 changed files with 22 additions and 1 deletions

View file

@ -636,6 +636,7 @@ typedef enum
TidyShowWarnings, /**< However errors are always shown */
TidySkipNested, /**< Skip nested tags in script and style CDATA */
TidySortAttributes, /**< Sort attributes */
TidySquelchShow, /**< Show message ID's in the error table */
TidyStrictTagsAttr, /**< Ensure tags and attributes match output HTML version */
TidyStyleTags, /**< Move sytle to head */
TidyTabSize, /**< Expand tabs to n spaces */

View file

@ -249,6 +249,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyShowWarnings, DD, "show-warnings", BL, yes, ParsePickList, &boolPicks },
{ TidySkipNested, MR, "skip-nested", BL, yes, ParsePickList, &boolPicks }, /* 1642186 - Issue #65 */
{ TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParsePickList, &sorterPicks },
{ TidySquelchShow, DD, "squelch-id", BL, no, ParsePickList, &boolPicks },
{ TidyStrictTagsAttr, MR, "strict-tags-attributes", BL, no, ParsePickList, &boolPicks }, /* 20160209 - Issue #350 */
{ TidyStyleTags, MR, "fix-style-tags", BL, yes, ParsePickList, &boolPicks },
{ TidyTabSize, PP, "tab-size", IN, 8, ParseInt, NULL },

View file

@ -1176,6 +1176,20 @@ static languageDefinition language_en = { whichPluralForm_en, {
"attribute sorting will take place after the priority attributes have "
"been output. "
},
{/* 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. */
TidySquelchShow, 0,
"This option indicates whether or not Tidy should display message ID's "
"with each of its error reports. This could be useful if you wanted to "
"use the \"squelch\" configuration option in order to filter out certain "
"report messages. "
},
{/* Important notes for translators:
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
<br/>.

View file

@ -137,7 +137,7 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc,
result->messagePrefix = tidyLocalizedString(level);
if ( line > 0 && column > 0 )
pattern = "%s%s%s"; /* pattern in there's location information */
pattern = "%s%s%s"; /* pattern if there's location information */
else
pattern = "%.0s%s%s"; /* otherwise if there isn't */
@ -154,6 +154,11 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc,
result->messagePos, result->messagePrefix,
result->message);
if ( cfgBool(doc, TidySquelchShow) == yes )
{
TY_(tmbsnprintf)(result->messageOutputDefault, sizeMessageBuf, "%s (%s)", result->messageOutputDefault, TY_(tidyErrorCodeAsKey)(code) );
TY_(tmbsnprintf)(result->messageOutput, sizeMessageBuf, "%s (%s)", result->messageOutput, TY_(tidyErrorCodeAsKey)(code) );
}
result->allowMessage = yes;