From ab8a4249df9ed9260fc4a017c5ef3d33d5c55ec1 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sat, 7 Oct 2017 18:10:46 -0400 Subject: [PATCH 01/12] 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. --- include/tidyenum.h | 1 + src/config.c | 1 + src/language_en.h | 14 ++++++++++++++ src/messageobj.c | 7 ++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/tidyenum.h b/include/tidyenum.h index 44f730b..e9e9873 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -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 */ diff --git a/src/config.c b/src/config.c index df3b558..1c2f4c7 100644 --- a/src/config.c +++ b/src/config.c @@ -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 }, diff --git a/src/language_en.h b/src/language_en.h index 7a6c3ae..3d93903 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -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 , , , , and +
. + - Entities, tags, attributes, etc., should be enclosed in . + - Option values should be enclosed in . + - It's very important that
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 , , , , and
. diff --git a/src/messageobj.c b/src/messageobj.c index ffdb916..e2fa8e9 100644 --- a/src/messageobj.c +++ b/src/messageobj.c @@ -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; From 5e668163802c6052142a2006ec8ef52eb484e251 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 10:25:09 -0400 Subject: [PATCH 02/12] Spacing consistency. --- src/attrs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/attrs.c b/src/attrs.c index c7a8add..909faa8 100644 --- a/src/attrs.c +++ b/src/attrs.c @@ -781,6 +781,7 @@ void TY_(FreeAttrPriorityList)( TidyDocImpl* doc ) } } + void TY_(DefinePriorityAttribute)(TidyDocImpl* doc, ctmbstr name) { enum { capacity = 10 }; From 626375346d66f5e1cfa3e26382b98910f0608e6f Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 10:47:03 -0400 Subject: [PATCH 03/12] Adds message squelching (muting) to Tidy, avoiding the need to specify a new option every time we might want to allow or disallow new output. Adds two new options: - `squelch-id` (default **no**) will provide tags during Tidy's output that can be used to silence warnings. For example, `MISSING_ENDTAG_OPTIONAL` will be shown after warnings of that type. Then in the future, the user can use... - `squelch` (default NULL) takes a list of message identification tags. Messages of this tag type will then be muted from output. This gives the user great control over hiding things that he or she doesn't care about seeing. However, muted errors/warnings still count toward error summaries. If we merge this, then TidyShowMetaChange and TidyWarnPropAttrs are candidates for removal (using the deprecation mechanism Tidy now has, these will continue to work, though). --- include/tidyenum.h | 5 +++ localize/translations/language_en_gb.po | 47 +++++++++++++++++++- localize/translations/language_es.po | 47 +++++++++++++++++++- localize/translations/language_es_mx.po | 47 +++++++++++++++++++- localize/translations/language_fr.po | 47 +++++++++++++++++++- localize/translations/language_pt_br.po | 47 +++++++++++++++++++- localize/translations/language_zh_cn.po | 47 +++++++++++++++++++- localize/translations/tidy.pot | 47 +++++++++++++++++++- src/config.c | 54 ++++++++++++----------- src/config.h | 6 +++ src/language_en.h | 23 +++++++++- src/message.c | 57 +++++++++++++++++++++++++ src/message.h | 34 +++++++++++++++ src/messageobj.c | 20 +++++++++ src/messageobj.h | 3 ++ src/tidy-int.h | 11 +++-- src/tidylib.c | 1 + 17 files changed, 504 insertions(+), 39 deletions(-) diff --git a/include/tidyenum.h b/include/tidyenum.h index e9e9873..1cf321e 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -255,7 +255,9 @@ extern "C" { FN(REPLACING_ELEMENT) \ FN(REPLACING_UNEX_ELEMENT) \ FN(SPACE_PRECEDING_XMLDECL) \ + FN(STRING_ARGUMENT_BAD) \ FN(STRING_MISSING_MALFORMED) \ + FN(STRING_SQUELCHING_TYPE) \ FN(STRING_UNKNOWN_OPTION) \ FN(SUSPECTED_MISSING_QUOTE) \ FN(TAG_NOT_ALLOWED_IN) \ @@ -636,6 +638,7 @@ typedef enum TidyShowWarnings, /**< However errors are always shown */ TidySkipNested, /**< Skip nested tags in script and style CDATA */ TidySortAttributes, /**< Sort attributes */ + TidySquelchReports, /**< Filter these messages from output. */ TidySquelchShow, /**< Show message ID's in the error table */ TidyStrictTagsAttr, /**< Ensure tags and attributes match output HTML version */ TidyStyleTags, /**< Move sytle to head */ @@ -1415,7 +1418,9 @@ typedef enum FOREACH_MSG_MISC(MAKE_ENUM) FOREACH_FOOTNOTE_MSG(MAKE_ENUM) FOREACH_DIALOG_MSG(MAKE_ENUM) + REPORT_MESSAGE_FIRST, FOREACH_REPORT_MSG(MAKE_ENUM) + REPORT_MESSAGE_LAST, FOREACH_ACCESS_MSG(MAKE_ENUM) #if SUPPORT_CONSOLE_APP diff --git a/localize/translations/language_en_gb.po b/localize/translations/language_en_gb.po index 1774021..7a32268 100644 --- a/localize/translations/language_en_gb.po +++ b/localize/translations/language_en_gb.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-07 16:24:04\n" +"PO-Revision-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1297,6 +1297,41 @@ msgid "" "been output. " msgstr "" +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -2535,11 +2570,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/localize/translations/language_es.po b/localize/translations/language_es.po index a72cb5a..9980091 100644 --- a/localize/translations/language_es.po +++ b/localize/translations/language_es.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-07 16:24:04\n" +"PO-Revision-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1260,6 +1260,41 @@ msgid "" "been output. " msgstr "" +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -2479,11 +2514,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/localize/translations/language_es_mx.po b/localize/translations/language_es_mx.po index 4f2ff13..a171f40 100644 --- a/localize/translations/language_es_mx.po +++ b/localize/translations/language_es_mx.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-07 16:24:04\n" +"PO-Revision-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1255,6 +1255,41 @@ msgid "" "been output. " msgstr "" +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -2474,11 +2509,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/localize/translations/language_fr.po b/localize/translations/language_fr.po index 9ba9986..14379ad 100644 --- a/localize/translations/language_fr.po +++ b/localize/translations/language_fr.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-07 16:24:04\n" +"PO-Revision-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1490,6 +1490,41 @@ msgstr "" "classement. Si la valeur est alpha, l'algorithme est un classement alphabétique " "ascendant. " +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -2919,11 +2954,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "suppression de l'espace précédant la déclaration XML" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "argument manquant ou incorrect pour l'option: %s" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/localize/translations/language_pt_br.po b/localize/translations/language_pt_br.po index e42bda3..e3c36c6 100644 --- a/localize/translations/language_pt_br.po +++ b/localize/translations/language_pt_br.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-07 16:24:04\n" +"PO-Revision-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1544,6 +1544,41 @@ msgstr "" "elemento usando o algoritmo de ordenação especificado. Se configurado para " "alpha, o algoritmo é uma ordenação alfabética ascendente. " +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -3007,11 +3042,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "removendo espaço em branco precedendo a declaração XML" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "argumento faltando ou malformado para opção: %s" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/localize/translations/language_zh_cn.po b/localize/translations/language_zh_cn.po index 435364e..c152e6a 100644 --- a/localize/translations/language_zh_cn.po +++ b/localize/translations/language_zh_cn.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-07 16:24:04\n" +"PO-Revision-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1255,6 +1255,41 @@ msgid "" "been output. " msgstr "" +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -2468,11 +2503,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/localize/translations/tidy.pot b/localize/translations/tidy.pot index b85084b..e480513 100644 --- a/localize/translations/tidy.pot +++ b/localize/translations/tidy.pot @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"POT-Creation-Date: 2017-10-07 16:24:04\n" +"POT-Creation-Date: 2017-10-08 10:46:33\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1255,6 +1255,41 @@ msgid "" "been output. " msgstr "" +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchReports" +msgid "" +"Use this option to prevent Tidy from displaying certain types of " +"report output,for example, for conditions that you wish to ignore." +"
" +"This option takes a list of one or more keys indicating the message " +"type to squelch. You can discover these message keys by using the " +"squelch-id configuration option and examining Tidy's " +"output. " +msgstr "" + +#. Important notes for translators: +#. - Use only , , , , and +#.
. +#. - Entities, tags, attributes, etc., should be enclosed in . +#. - Option values should be enclosed in . +#. - It's very important that
be self-closing! +#. - The strings "Tidy" and "HTML Tidy" are the program name and must not +#. be translated. +msgctxt "TidySquelchShow" +msgid "" +"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. " +msgstr "" + #. Important notes for translators: #. - Use only , , , , and #.
. @@ -2470,11 +2505,21 @@ msgctxt "SPACE_PRECEDING_XMLDECL" msgid "removing whitespace preceding XML Declaration" msgstr "" +#, c-format +msgctxt "STRING_ARGUMENT_BAD" +msgid "option \"%s\" given bad argument \"%s\"" +msgstr "" + #, c-format msgctxt "STRING_MISSING_MALFORMED" msgid "missing or malformed argument for option: %s" msgstr "" +#, c-format +msgctxt "STRING_SQUELCHING_TYPE" +msgid "messages of type \"%s\" will not be output" +msgstr "" + #, c-format msgctxt "STRING_UNKNOWN_OPTION" msgid "unknown option: %s" diff --git a/src/config.c b/src/config.c index 1c2f4c7..f93c1a6 100644 --- a/src/config.c +++ b/src/config.c @@ -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 }, + { TidySquelchReports, DD, "squelch", ST, 0, ParseList, NULL }, { 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 }, @@ -1166,12 +1167,16 @@ void AdjustConfig( TidyDocImpl* doc ) } -/* Coordinates Config update and Attributes data for priority attributes, as - a service to ParseList(). +/* A service to ParseList(), keeps option values nicely formatted and + coordinates additions to the internal lists. Within Tidy, this function + might be used to programmatically add individual values to items that use + this service. + @todo: see if we can apply this for other things such as tags, etc., to + simplify code. */ -void TY_(DeclarePriorityAttrib)( TidyDocImpl* doc, TidyOptionId optId, ctmbstr name ) +void TY_(DeclareListItem)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name ) { - ctmbstr prvval = cfgStr( doc, optId ); + ctmbstr prvval = cfgStr( doc, opt->id ); tmbstr catval = NULL; ctmbstr theval = name; if ( prvval ) @@ -1183,14 +1188,27 @@ void TY_(DeclarePriorityAttrib)( TidyDocImpl* doc, TidyOptionId optId, ctmbstr n theval = catval; } - TY_(DefinePriorityAttribute)( doc, name ); - SetOptionValue( doc, optId, theval ); + switch ( opt->id ) + { + case TidyPriorityAttributes: + TY_(DefinePriorityAttribute)( doc, name ); + break; + + case TidySquelchReports: + TY_(DefineSquelchedMessage)( doc, opt, name ); + break; + + default: + break; + } + + SetOptionValue( doc, opt->id, theval ); if ( catval ) TidyDocFree( doc, catval ); - } +} -/* a space or comma separated list of attribute names */ +/* a space or comma separated list of items */ Bool ParseList( TidyDocImpl* doc, const TidyOptionImpl* option ) { TidyConfigImpl* cfg = &doc->config; @@ -1236,15 +1254,7 @@ Bool ParseList( TidyDocImpl* doc, const TidyOptionImpl* option ) continue; /* there is a trailing space on the line. */ /* add attribute to array */ - switch ( option->id ) - { - case TidyPriorityAttributes: - TY_(DeclarePriorityAttrib)( doc, option->id, buf ); - break; - - default: - break; - } + TY_(DeclareListItem)( doc, option, buf ); i = 0; ++nItems; @@ -1252,15 +1262,7 @@ Bool ParseList( TidyDocImpl* doc, const TidyOptionImpl* option ) while ( c != EndOfStream ); if ( i > 0 ) - switch ( option->id ) - { - case TidyPriorityAttributes: - TY_(DeclarePriorityAttrib)( doc, option->id, buf ); - break; - - default: - break; - } + TY_(DeclareListItem)( doc, option, buf ); return ( nItems > 0 ); } diff --git a/src/config.h b/src/config.h index eff020d..a1f62ca 100644 --- a/src/config.h +++ b/src/config.h @@ -369,6 +369,12 @@ ctmbstr TY_(CharEncodingOptName)( int encoding ); void TY_(DeclareUserTag)( TidyDocImpl* doc, TidyOptionId optId, uint tagType, ctmbstr name ); +/** Coordinates Config update and list data. + ** @param doc The Tidy document. + ** @param opt The option the list item is intended for. + ** @param name The name of the new list item. + */ +void TY_(DeclareListItem)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name ); #ifdef _DEBUG diff --git a/src/language_en.h b/src/language_en.h index 3d93903..6e69f6b 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -1176,6 +1176,23 @@ static languageDefinition language_en = { whichPluralForm_en, { "attribute sorting will take place after the priority attributes have " "been output. " }, + {/* Important notes for translators: + - Use only , , , , and +
. + - Entities, tags, attributes, etc., should be enclosed in . + - Option values should be enclosed in . + - It's very important that
be self-closing! + - The strings "Tidy" and "HTML Tidy" are the program name and must not + be translated. */ + TidySquelchReports, 0, + "Use this option to prevent Tidy from displaying certain types of " + "report output,for example, for conditions that you wish to ignore." + "
" + "This option takes a list of one or more keys indicating the message " + "type to squelch. You can discover these message keys by using the " + "squelch-id configuration option and examining Tidy's " + "output. " + }, {/* Important notes for translators: - Use only , , , , and
. @@ -1187,8 +1204,8 @@ static languageDefinition language_en = { whichPluralForm_en, { 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. " + "use the squelch configuration option in order to filter " + "out certain report messages. " }, {/* Important notes for translators: - Use only , , , , and @@ -1932,7 +1949,9 @@ static languageDefinition language_en = { whichPluralForm_en, { { REPLACING_ELEMENT, 0, "replacing %s with %s" }, { REPLACING_UNEX_ELEMENT, 0, "replacing unexpected %s with %s" }, { SPACE_PRECEDING_XMLDECL, 0, "removing whitespace preceding XML Declaration" }, + { STRING_ARGUMENT_BAD, 0, "option \"%s\" given bad argument \"%s\"" }, { STRING_MISSING_MALFORMED, 0, "missing or malformed argument for option: %s" }, + { STRING_SQUELCHING_TYPE, 0, "messages of type \"%s\" will not be output" }, { STRING_UNKNOWN_OPTION, 0, "unknown option: %s" }, { SUSPECTED_MISSING_QUOTE, 0, "suspected missing quote mark for attribute value" }, { TAG_NOT_ALLOWED_IN, 0, "%s isn't allowed in <%s> elements" }, diff --git a/src/message.c b/src/message.c index 43fd510..06a6334 100644 --- a/src/message.c +++ b/src/message.c @@ -153,6 +153,9 @@ static void messageOut( TidyMessageImpl *message ) break; } + /* Suppress report messages if they've been squelched. */ + go = go & !message->squelched; + /* Suppress report messages if we've already reached the reporting limit. */ if ( message->level <= TidyFatal ) { @@ -357,10 +360,12 @@ static struct _dispatchTable { { REPLACING_ELEMENT, TidyWarning, formatStandard }, { REPLACING_UNEX_ELEMENT, TidyWarning, formatStandard }, { SPACE_PRECEDING_XMLDECL, TidyWarning, formatStandard }, + { STRING_ARGUMENT_BAD, TidyConfig, formatStandard }, { STRING_CONTENT_LOOKS, TidyInfo, formatStandard }, /* reportMarkupVersion() */ { STRING_DOCTYPE_GIVEN, TidyInfo, formatStandard }, /* reportMarkupVersion() */ { STRING_MISSING_MALFORMED, TidyConfig, formatStandard }, { STRING_NO_SYSID, TidyInfo, formatStandard }, /* reportMarkupVersion() */ + { STRING_SQUELCHING_TYPE, TidyConfig, formatStandard }, { STRING_UNKNOWN_OPTION, TidyConfig, formatStandard }, { SUSPECTED_MISSING_QUOTE, TidyWarning, formatStandard }, { TAG_NOT_ALLOWED_IN, TidyWarning, formatStandard, PREVIOUS_LOCATION }, @@ -723,6 +728,7 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin case STRING_CONTENT_LOOKS: case STRING_DOCTYPE_GIVEN: case STRING_MISSING_MALFORMED: + case STRING_SQUELCHING_TYPE: { ctmbstr str; if ( (str = va_arg( args, ctmbstr)) ) @@ -760,6 +766,7 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin } break; case OPTION_REMOVED_UNAPPLIED: + case STRING_ARGUMENT_BAD: { ctmbstr s1 = va_arg( args, ctmbstr ); ctmbstr s2 = va_arg( args, ctmbstr ); @@ -1322,6 +1329,52 @@ void TY_(ReportNumWarnings)( TidyDocImpl* doc ) } +/********************************************************************* + * Message Squelching + *********************************************************************/ + + +void TY_(FreeSquelchedMessageList)( TidyDocImpl* doc ) +{ + TidySquelchedMessages *list = &(doc->squelched); + + if ( list->list ) + TidyFree( doc->allocator, list->list ); +} + + +void TY_(DefineSquelchedMessage)(TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name) +{ + enum { capacity = 10 }; + TidySquelchedMessages *list = &(doc->squelched); + tidyStrings message = TY_(tidyErrorCodeFromKey)( name ); + + if ( message <= REPORT_MESSAGE_FIRST || message >= REPORT_MESSAGE_LAST) + TY_(Report)( doc, NULL, NULL, STRING_ARGUMENT_BAD, opt->name, name ); + + if ( !list->list ) + { + list->list = TidyAlloc(doc->allocator, sizeof(tidyStrings) * capacity ); + list->list[0] = 0; + list->capacity = capacity; + list->count = 0; + } + + if ( list->count >= list->capacity ) + { + list->capacity = list->capacity * 2; + list->list = realloc( list->list, sizeof(tidyStrings) * list->capacity + 1 ); + } + + list->list[list->count] = message; + list->count++; + list->list[list->count] = 0; + + /* Must come *after* adding to the list, in case it's squelched, too. */ + TY_(Report)( doc, NULL, NULL, STRING_SQUELCHING_TYPE, name ); +} + + /********************************************************************* * Key Discovery *********************************************************************/ @@ -1467,6 +1520,8 @@ static const TidyOptionId TidyOutCharEncodingLinks[] = { TidyCharEncoding, TidyU static const TidyOptionId TidyOutFileLinks[] = { TidyErrFile, TidyUnknownOption }; static const TidyOptionId TidyPreTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyUseCustomTags, TidyUnknownOption }; static const TidyOptionId TidySortAttributesLinks[] = { TidyPriorityAttributes, TidyUnknownOption }; +static const TidyOptionId TidySquelchLinks[] = { TidySquelchShow }; +static const TidyOptionId TidySquelchShowLinks[] = { TidySquelchReports }; static const TidyOptionId TidyUseCustomTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUnknownOption }; static const TidyOptionId TidyWrapAttValsLinks[] = { TidyWrapScriptlets, TidyLiteralAttribs, TidyUnknownOption }; static const TidyOptionId TidyWrapScriptletsLinks[] = { TidyWrapAttVals, TidyUnknownOption }; @@ -1495,6 +1550,8 @@ static const TidyOptionDoc docs_xrefs[] = { TidyOutFile, TidyOutFileLinks }, { TidyPreTags, TidyPreTagsLinks }, { TidySortAttributes, TidySortAttributesLinks }, + { TidySquelchShow, TidySquelchShowLinks }, + { TidySquelchReports, TidySquelchLinks }, { TidyUseCustomTags, TidyUseCustomTagsLinks }, { TidyWrapAttVals, TidyWrapAttValsLinks }, { TidyWrapScriptlets, TidyWrapScriptletsLinks }, diff --git a/src/message.h b/src/message.h index 4871e10..6f05e1c 100644 --- a/src/message.h +++ b/src/message.h @@ -46,6 +46,7 @@ ******************************************************************************/ #include "forward.h" +#include "config.h" /** @addtogroup internal_api */ /** @{ */ @@ -180,6 +181,39 @@ void TY_(ReportNumWarnings)( TidyDocImpl* doc ); /** @} message_reporting group */ +/***************************************************************************//** + ** @defgroup message_squelching Message Squelching + ** + ** Message types included in the `squelch` option will be be printed in + ** messageOut(). + ** + ** @{ + ******************************************************************************/ + +/** Maintains a list of messages not to display. */ +typedef struct _squelchedMessages { + tidyStrings* list; /**< A list of messages that won't be output. */ + uint count; /**< Current count of the list. */ + uint capacity; /**< Current capacity of the list. */ +} TidySquelchedMessages; + + +/** Frees the list of squelched messages. + ** @param doc The Tidy document. + */ +void TY_(FreeSquelchedMessageList)( TidyDocImpl* doc ); + +/** Adds a new message ID to the list of squelched messages. + ** @param doc The Tidy document. + ** @param name The message code as a string. + */ +void TY_(DefineSquelchedMessage)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name ); + + +/** @} */ +/** @} message_squelching group */ + + /***************************************************************************//** ** @defgroup message_keydiscovery Key Discovery ** diff --git a/src/messageobj.c b/src/messageobj.c index e2fa8e9..ff3fb62 100644 --- a/src/messageobj.c +++ b/src/messageobj.c @@ -85,6 +85,8 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc, va_list args_copy; enum { sizeMessageBuf=2048 }; ctmbstr pattern; + uint i = 0; + /* Things we know... */ @@ -189,6 +191,19 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc, result->allowMessage = result->allowMessage & doc->messageCallback( tidyImplToMessage(result) ); } + /* finally, check the document's configuration to determine whether + this message is squelched. */ + result->squelched = no; + while ( ( doc->squelched.list ) && ( doc->squelched.list[i] != 0 ) ) + { + if ( doc->squelched.list[i] == code ) + { + result->squelched = yes; + break; + } + i++; + } + return result; } @@ -297,6 +312,11 @@ TidyReportLevel TY_(getMessageLevel)( TidyMessageImpl message ) return message.level; } +Bool TY_(getMessageIsSquelched)( TidyMessageImpl message ) +{ + return message.squelched; +} + ctmbstr TY_(getMessageFormatDefault)( TidyMessageImpl message ) { return message.messageFormatDefault; diff --git a/src/messageobj.h b/src/messageobj.h index b12505d..154fae5 100644 --- a/src/messageobj.h +++ b/src/messageobj.h @@ -80,6 +80,9 @@ int TY_(getMessageColumn)( TidyMessageImpl message ); /** get the TidyReportLevel of the message. */ TidyReportLevel TY_(getMessageLevel)( TidyMessageImpl message ); +/** get whether or not the message was squelched by the configuration. */ +Bool TY_(getMessageIsSquelched)( TidyMessageImpl message ); + /** the built-in format string */ ctmbstr TY_(getMessageFormatDefault)( TidyMessageImpl message ); diff --git a/src/tidy-int.h b/src/tidy-int.h index 65cfe03..b677ff0 100644 --- a/src/tidy-int.h +++ b/src/tidy-int.h @@ -15,6 +15,7 @@ #include "attrs.h" #include "pprint.h" #include "access.h" +#include "message.h" #ifndef MAX #define MAX(a,b) (((a) > (b))?(a):(b)) @@ -40,10 +41,11 @@ struct _TidyDocImpl Lexer* lexer; /* Config + Markup Declarations */ - TidyConfigImpl config; - TidyTagImpl tags; - TidyAttribImpl attribs; - TidyAccessImpl access; + TidyConfigImpl config; + TidyTagImpl tags; + TidyAttribImpl attribs; + TidyAccessImpl access; + TidySquelchedMessages squelched; /* The Pretty Print buffer */ TidyPrintImpl pprint; @@ -104,6 +106,7 @@ struct _TidyMessageImpl int column; /* the column the message applies to */ TidyReportLevel level; /* the severity level of the message */ Bool allowMessage; /* indicates whether or not a filter rejected a message */ + Bool squelched; /* indicates whether or not a configuration squelches this message */ int argcount; /* the number of arguments */ struct printfArg* arguments; /* the arguments' values and types */ diff --git a/src/tidylib.c b/src/tidylib.c index dae71c8..1c57c41 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -139,6 +139,7 @@ void tidyDocRelease( TidyDocImpl* doc ) TY_(FreeConfig)( doc ); TY_(FreeAttrTable)( doc ); TY_(FreeAttrPriorityList)( doc ); + TY_(FreeSquelchedMessageList( doc )); TY_(FreeTags)( doc ); /*\ * Issue #186 - Now FreeNode depend on the doctype, so the lexer is needed From 0548e67fa5ff653be37777458d6d8dd99ad82bbe Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 11:19:00 -0400 Subject: [PATCH 04/12] Oops, need to return. --- src/message.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/message.c b/src/message.c index 06a6334..b420fc8 100644 --- a/src/message.c +++ b/src/message.c @@ -1350,7 +1350,10 @@ void TY_(DefineSquelchedMessage)(TidyDocImpl* doc, const TidyOptionImpl* opt, ct tidyStrings message = TY_(tidyErrorCodeFromKey)( name ); if ( message <= REPORT_MESSAGE_FIRST || message >= REPORT_MESSAGE_LAST) + { TY_(Report)( doc, NULL, NULL, STRING_ARGUMENT_BAD, opt->name, name ); + return; + } if ( !list->list ) { From 2e58434e8d8939d8c4b00d3b299d1476d524ab1a Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 11:30:29 -0400 Subject: [PATCH 05/12] Actually, we should only show labels on reports, not dialogue. --- src/messageobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/messageobj.c b/src/messageobj.c index ff3fb62..f5b055c 100644 --- a/src/messageobj.c +++ b/src/messageobj.c @@ -156,7 +156,7 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc, result->messagePos, result->messagePrefix, result->message); - if ( cfgBool(doc, TidySquelchShow) == yes ) + if ( ( cfgBool(doc, TidySquelchShow) == yes ) && level <= TidyFatal ) { TY_(tmbsnprintf)(result->messageOutputDefault, sizeMessageBuf, "%s (%s)", result->messageOutputDefault, TY_(tidyErrorCodeAsKey)(code) ); TY_(tmbsnprintf)(result->messageOutput, sizeMessageBuf, "%s (%s)", result->messageOutput, TY_(tidyErrorCodeAsKey)(code) ); From f72c3d27e1f29e16b8329b62b66d55d0aebf4bb3 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 11:40:53 -0400 Subject: [PATCH 06/12] Show full prototype in forward declaration. --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index f93c1a6..80ea034 100644 --- a/src/config.c +++ b/src/config.c @@ -304,7 +304,7 @@ static const struct { /* forward declarations */ static void AdjustConfig( TidyDocImpl* doc ); -static Bool GetPickListValue(); +static Bool GetPickListValue( ctmbstr value, PickListItems* pickList, uint *result ); void TY_(InitConfig)( TidyDocImpl* doc ) From e6f007d8babb21697f16fa6d748ee59a1a6c1006 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 11:44:45 -0400 Subject: [PATCH 07/12] Code spacing consistency. --- src/config.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 80ea034..449ed4b 100644 --- a/src/config.c +++ b/src/config.c @@ -336,6 +336,7 @@ const TidyOptionImpl* TY_(lookupOption)( ctmbstr s ) return NULL; } + const TidyOptionImpl* TY_(getOption)( TidyOptionId optId ) { if ( optId < N_TIDY_OPTIONS ) @@ -350,6 +351,7 @@ static void FreeOptionValue( TidyDocImpl* doc, const TidyOptionImpl* option, Tid TidyDocFree( doc, value->p ); } + static void CopyOptionValue( TidyDocImpl* doc, const TidyOptionImpl* option, TidyOptionValue* oldval, const TidyOptionValue* newval ) { @@ -408,6 +410,7 @@ Bool TY_(SetOptionBool)( TidyDocImpl* doc, TidyOptionId optId, Bool val ) return status; } + static void GetOptionDefault( const TidyOptionImpl* option, TidyOptionValue* dflt ) { @@ -417,6 +420,7 @@ static void GetOptionDefault( const TidyOptionImpl* option, dflt->v = option->dflt; } + static Bool OptionValueEqDefault( const TidyOptionImpl* option, const TidyOptionValue* val ) { @@ -568,7 +572,7 @@ static Bool subDeprecatedOption( TidyDocImpl* doc, ctmbstr oldName, ctmbstr oldV uint value; /* `show-body-only` used to use the autoBoolPicks */ - if ( GetPickListValue( oldValue, autoBoolPicks, &value ) ) + if ( GetPickListValue( oldValue, &autoBoolPicks, &value ) ) { if ( value == TidyNoState ) { From ad03b28318207a5239c7889280ca3b4cd05b40a2 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 11:51:19 -0400 Subject: [PATCH 08/12] Remove @todo note. --- src/config.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/config.c b/src/config.c index 449ed4b..d6fce63 100644 --- a/src/config.c +++ b/src/config.c @@ -1175,8 +1175,6 @@ void AdjustConfig( TidyDocImpl* doc ) coordinates additions to the internal lists. Within Tidy, this function might be used to programmatically add individual values to items that use this service. - @todo: see if we can apply this for other things such as tags, etc., to - simplify code. */ void TY_(DeclareListItem)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name ) { From 6f0ada7ffe4cbe1ecde0106d196b5207b0f69f98 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 11:53:36 -0400 Subject: [PATCH 09/12] Typo --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index d6fce63..ca4669f 100644 --- a/src/config.c +++ b/src/config.c @@ -549,7 +549,7 @@ static Bool isOptionDeprecated( ctmbstr optName ) } -/* Aubstitute the new option for the deprecated one. */ +/* Substitute the new option for the deprecated one. */ static Bool subDeprecatedOption( TidyDocImpl* doc, ctmbstr oldName, ctmbstr oldValue) { TidyOptionId newOptId = getOptionReplacement( oldName ); From 346ba063c98f7fdcd98343ba100344854c943ef8 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Sun, 8 Oct 2017 12:03:48 -0400 Subject: [PATCH 10/12] Expose the new property to the public API. --- include/tidy.h | 11 ++++++++++- src/tidylib.c | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/tidy.h b/include/tidy.h index 365c70d..59c5609 100644 --- a/include/tidy.h +++ b/include/tidy.h @@ -1243,7 +1243,16 @@ TIDY_EXPORT int TIDY_CALL tidyGetMessageColumn( TidyMessage tmessage ); ** message. */ TIDY_EXPORT TidyReportLevel TIDY_CALL tidyGetMessageLevel( TidyMessage tmessage ); - + + +/** Get the squelched status of the message, that is, whether or not the + ** current configuration indicated that this message should be muted. + ** @param tmessage Specify the message that you are querying. + ** @result Returns a Bool indicating that the config indicates muting this + ** message. + */ +TIDY_EXPORT Bool TIDY_CALL tidyGetMessageIsSquelched( TidyMessage tmessage ); + /** Get the default format string, which is the format string for the message ** in Tidy's default localization (en_us). ** @param tmessage Specify the message that you are querying. diff --git a/src/tidylib.c b/src/tidylib.c index 1c57c41..2bc7c08 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -715,7 +715,11 @@ TidyReportLevel TIDY_CALL tidyGetMessageLevel( TidyMessage tmessage ) return TY_(getMessageLevel)(*message); } - +Bool TIDY_CALL tidyGetMessageIsSquelched( TidyMessage tmessage ) +{ + TidyMessageImpl *message = tidyMessageToImpl(tmessage); + return TY_(getMessageIsSquelched)(*message); +} ctmbstr TIDY_CALL tidyGetMessageFormatDefault( TidyMessage tmessage ) { From 1d9194296034886548cc48904c4924fd9fb40aff Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 10 Oct 2017 08:21:14 -0400 Subject: [PATCH 11/12] Renamed the proposed `squelch` and `squelch-id` to `mute` and `mute-id`, respectively. Updated matching cases in test branch accordingly. --- include/tidy.h | 4 ++-- include/tidyenum.h | 6 ++--- localize/translations/language_en_gb.po | 14 ++++++------ localize/translations/language_es.po | 14 ++++++------ localize/translations/language_es_mx.po | 14 ++++++------ localize/translations/language_fr.po | 14 ++++++------ localize/translations/language_pt_br.po | 14 ++++++------ localize/translations/language_zh_cn.po | 14 ++++++------ localize/translations/tidy.pot | 14 ++++++------ src/config.c | 8 +++---- src/language_en.h | 12 +++++----- src/message.c | 30 ++++++++++++------------- src/message.h | 18 +++++++-------- src/messageobj.c | 16 ++++++------- src/messageobj.h | 4 ++-- src/tidy-int.h | 4 ++-- src/tidylib.c | 6 ++--- 17 files changed, 103 insertions(+), 103 deletions(-) diff --git a/include/tidy.h b/include/tidy.h index 59c5609..bbd1d6a 100644 --- a/include/tidy.h +++ b/include/tidy.h @@ -1245,13 +1245,13 @@ TIDY_EXPORT int TIDY_CALL tidyGetMessageColumn( TidyMessage tmessage ); TIDY_EXPORT TidyReportLevel TIDY_CALL tidyGetMessageLevel( TidyMessage tmessage ); -/** Get the squelched status of the message, that is, whether or not the +/** Get the muted status of the message, that is, whether or not the ** current configuration indicated that this message should be muted. ** @param tmessage Specify the message that you are querying. ** @result Returns a Bool indicating that the config indicates muting this ** message. */ -TIDY_EXPORT Bool TIDY_CALL tidyGetMessageIsSquelched( TidyMessage tmessage ); +TIDY_EXPORT Bool TIDY_CALL tidyGetMessageIsMuted( TidyMessage tmessage ); /** Get the default format string, which is the format string for the message ** in Tidy's default localization (en_us). diff --git a/include/tidyenum.h b/include/tidyenum.h index 1cf321e..a76e0ee 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -257,7 +257,7 @@ extern "C" { FN(SPACE_PRECEDING_XMLDECL) \ FN(STRING_ARGUMENT_BAD) \ FN(STRING_MISSING_MALFORMED) \ - FN(STRING_SQUELCHING_TYPE) \ + FN(STRING_MUTING_TYPE) \ FN(STRING_UNKNOWN_OPTION) \ FN(SUSPECTED_MISSING_QUOTE) \ FN(TAG_NOT_ALLOWED_IN) \ @@ -638,8 +638,8 @@ typedef enum TidyShowWarnings, /**< However errors are always shown */ TidySkipNested, /**< Skip nested tags in script and style CDATA */ TidySortAttributes, /**< Sort attributes */ - TidySquelchReports, /**< Filter these messages from output. */ - TidySquelchShow, /**< Show message ID's in the error table */ + TidyMuteReports, /**< Filter these messages from output. */ + TidyMuteShow, /**< 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 */ diff --git a/localize/translations/language_en_gb.po b/localize/translations/language_en_gb.po index 7a32268..78f3eaf 100644 --- a/localize/translations/language_en_gb.po +++ b/localize/translations/language_en_gb.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-08 10:46:33\n" +"PO-Revision-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1305,14 +1305,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1324,11 +1324,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -2581,7 +2581,7 @@ msgid "missing or malformed argument for option: %s" msgstr "" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/localize/translations/language_es.po b/localize/translations/language_es.po index 9980091..02ab42d 100644 --- a/localize/translations/language_es.po +++ b/localize/translations/language_es.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-08 10:46:33\n" +"PO-Revision-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1268,14 +1268,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1287,11 +1287,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -2525,7 +2525,7 @@ msgid "missing or malformed argument for option: %s" msgstr "" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/localize/translations/language_es_mx.po b/localize/translations/language_es_mx.po index a171f40..309e528 100644 --- a/localize/translations/language_es_mx.po +++ b/localize/translations/language_es_mx.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-08 10:46:33\n" +"PO-Revision-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1263,14 +1263,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1282,11 +1282,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -2520,7 +2520,7 @@ msgid "missing or malformed argument for option: %s" msgstr "" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/localize/translations/language_fr.po b/localize/translations/language_fr.po index 14379ad..c871841 100644 --- a/localize/translations/language_fr.po +++ b/localize/translations/language_fr.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-08 10:46:33\n" +"PO-Revision-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1498,14 +1498,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1517,11 +1517,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -2965,7 +2965,7 @@ msgid "missing or malformed argument for option: %s" msgstr "argument manquant ou incorrect pour l'option: %s" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/localize/translations/language_pt_br.po b/localize/translations/language_pt_br.po index e3c36c6..3f02fb7 100644 --- a/localize/translations/language_pt_br.po +++ b/localize/translations/language_pt_br.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-08 10:46:33\n" +"PO-Revision-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1552,14 +1552,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1571,11 +1571,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -3053,7 +3053,7 @@ msgid "missing or malformed argument for option: %s" msgstr "argumento faltando ou malformado para opção: %s" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/localize/translations/language_zh_cn.po b/localize/translations/language_zh_cn.po index c152e6a..4280129 100644 --- a/localize/translations/language_zh_cn.po +++ b/localize/translations/language_zh_cn.po @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"PO-Revision-Date: 2017-10-08 10:46:33\n" +"PO-Revision-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1263,14 +1263,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1282,11 +1282,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -2514,7 +2514,7 @@ msgid "missing or malformed argument for option: %s" msgstr "" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/localize/translations/tidy.pot b/localize/translations/tidy.pot index e480513..0cf1d0a 100644 --- a/localize/translations/tidy.pot +++ b/localize/translations/tidy.pot @@ -5,7 +5,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: HTML Tidy poconvert.rb\n" "Project-Id-Version: \n" -"POT-Creation-Date: 2017-10-08 10:46:33\n" +"POT-Creation-Date: 2017-10-10 08:20:36\n" "Last-Translator: jderry\n" "Language-Team: \n" @@ -1263,14 +1263,14 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchReports" +msgctxt "TidyMuteReports" msgid "" "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " -"type to squelch. You can discover these message keys by using the " -"squelch-id configuration option and examining Tidy's " +"type to mute. You can discover these message keys by using the " +"mute-id configuration option and examining Tidy's " "output. " msgstr "" @@ -1282,11 +1282,11 @@ msgstr "" #. - It's very important that
be self-closing! #. - The strings "Tidy" and "HTML Tidy" are the program name and must not #. be translated. -msgctxt "TidySquelchShow" +msgctxt "TidyMuteShow" msgid "" "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 " +"use the mute configuration option in order to filter " "out certain report messages. " msgstr "" @@ -2516,7 +2516,7 @@ msgid "missing or malformed argument for option: %s" msgstr "" #, c-format -msgctxt "STRING_SQUELCHING_TYPE" +msgctxt "STRING_MUTING_TYPE" msgid "messages of type \"%s\" will not be output" msgstr "" diff --git a/src/config.c b/src/config.c index ca4669f..b9ecbba 100644 --- a/src/config.c +++ b/src/config.c @@ -249,8 +249,8 @@ 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 }, - { TidySquelchReports, DD, "squelch", ST, 0, ParseList, NULL }, - { TidySquelchShow, DD, "squelch-id", BL, no, ParsePickList, &boolPicks }, + { TidyMuteReports, DD, "mute", ST, 0, ParseList, NULL }, + { TidyMuteShow, DD, "mute-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 }, @@ -1196,8 +1196,8 @@ void TY_(DeclareListItem)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr TY_(DefinePriorityAttribute)( doc, name ); break; - case TidySquelchReports: - TY_(DefineSquelchedMessage)( doc, opt, name ); + case TidyMuteReports: + TY_(DefineMutedMessage)( doc, opt, name ); break; default: diff --git a/src/language_en.h b/src/language_en.h index 6e69f6b..b9e3d5b 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -1184,13 +1184,13 @@ static languageDefinition language_en = { whichPluralForm_en, { - It's very important that
be self-closing! - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - TidySquelchReports, 0, + TidyMuteReports, 0, "Use this option to prevent Tidy from displaying certain types of " "report output,for example, for conditions that you wish to ignore." "
" "This option takes a list of one or more keys indicating the message " - "type to squelch. You can discover these message keys by using the " - "squelch-id configuration option and examining Tidy's " + "type to mute. You can discover these message keys by using the " + "mute-id configuration option and examining Tidy's " "output. " }, {/* Important notes for translators: @@ -1201,10 +1201,10 @@ static languageDefinition language_en = { whichPluralForm_en, { - It's very important that
be self-closing! - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ - TidySquelchShow, 0, + TidyMuteShow, 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 " + "use the mute configuration option in order to filter " "out certain report messages. " }, {/* Important notes for translators: @@ -1951,7 +1951,7 @@ static languageDefinition language_en = { whichPluralForm_en, { { SPACE_PRECEDING_XMLDECL, 0, "removing whitespace preceding XML Declaration" }, { STRING_ARGUMENT_BAD, 0, "option \"%s\" given bad argument \"%s\"" }, { STRING_MISSING_MALFORMED, 0, "missing or malformed argument for option: %s" }, - { STRING_SQUELCHING_TYPE, 0, "messages of type \"%s\" will not be output" }, + { STRING_MUTING_TYPE, 0, "messages of type \"%s\" will not be output" }, { STRING_UNKNOWN_OPTION, 0, "unknown option: %s" }, { SUSPECTED_MISSING_QUOTE, 0, "suspected missing quote mark for attribute value" }, { TAG_NOT_ALLOWED_IN, 0, "%s isn't allowed in <%s> elements" }, diff --git a/src/message.c b/src/message.c index b420fc8..9d8ca0f 100644 --- a/src/message.c +++ b/src/message.c @@ -153,8 +153,8 @@ static void messageOut( TidyMessageImpl *message ) break; } - /* Suppress report messages if they've been squelched. */ - go = go & !message->squelched; + /* Suppress report messages if they've been muted. */ + go = go & !message->muted; /* Suppress report messages if we've already reached the reporting limit. */ if ( message->level <= TidyFatal ) @@ -364,8 +364,8 @@ static struct _dispatchTable { { STRING_CONTENT_LOOKS, TidyInfo, formatStandard }, /* reportMarkupVersion() */ { STRING_DOCTYPE_GIVEN, TidyInfo, formatStandard }, /* reportMarkupVersion() */ { STRING_MISSING_MALFORMED, TidyConfig, formatStandard }, + { STRING_MUTING_TYPE, TidyConfig, formatStandard }, { STRING_NO_SYSID, TidyInfo, formatStandard }, /* reportMarkupVersion() */ - { STRING_SQUELCHING_TYPE, TidyConfig, formatStandard }, { STRING_UNKNOWN_OPTION, TidyConfig, formatStandard }, { SUSPECTED_MISSING_QUOTE, TidyWarning, formatStandard }, { TAG_NOT_ALLOWED_IN, TidyWarning, formatStandard, PREVIOUS_LOCATION }, @@ -728,7 +728,7 @@ TidyMessageImpl *formatStandard(TidyDocImpl* doc, Node *element, Node *node, uin case STRING_CONTENT_LOOKS: case STRING_DOCTYPE_GIVEN: case STRING_MISSING_MALFORMED: - case STRING_SQUELCHING_TYPE: + case STRING_MUTING_TYPE: { ctmbstr str; if ( (str = va_arg( args, ctmbstr)) ) @@ -1330,23 +1330,23 @@ void TY_(ReportNumWarnings)( TidyDocImpl* doc ) /********************************************************************* - * Message Squelching + * Message Muting *********************************************************************/ -void TY_(FreeSquelchedMessageList)( TidyDocImpl* doc ) +void TY_(FreeMutedMessageList)( TidyDocImpl* doc ) { - TidySquelchedMessages *list = &(doc->squelched); + TidyMutedMessages *list = &(doc->muted); if ( list->list ) TidyFree( doc->allocator, list->list ); } -void TY_(DefineSquelchedMessage)(TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name) +void TY_(DefineMutedMessage)(TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name) { enum { capacity = 10 }; - TidySquelchedMessages *list = &(doc->squelched); + TidyMutedMessages *list = &(doc->muted); tidyStrings message = TY_(tidyErrorCodeFromKey)( name ); if ( message <= REPORT_MESSAGE_FIRST || message >= REPORT_MESSAGE_LAST) @@ -1373,8 +1373,8 @@ void TY_(DefineSquelchedMessage)(TidyDocImpl* doc, const TidyOptionImpl* opt, ct list->count++; list->list[list->count] = 0; - /* Must come *after* adding to the list, in case it's squelched, too. */ - TY_(Report)( doc, NULL, NULL, STRING_SQUELCHING_TYPE, name ); + /* Must come *after* adding to the list, in case it's muted, too. */ + TY_(Report)( doc, NULL, NULL, STRING_MUTING_TYPE, name ); } @@ -1518,13 +1518,13 @@ static const TidyOptionId TidyIndentSpacesLinks[] = { TidyIndentContent, Tidy static const TidyOptionId TidyInlineTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyPreTags, TidyUseCustomTags, TidyUnknownOption }; static const TidyOptionId TidyMergeDivsLinks[] = { TidyMakeClean, TidyMergeSpans, TidyUnknownOption }; static const TidyOptionId TidyMergeSpansLinks[] = { TidyMakeClean, TidyMergeDivs, TidyUnknownOption }; +static const TidyOptionId TidyMuteLinks[] = { TidyMuteShow }; +static const TidyOptionId TidyMuteShowLinks[] = { TidyMuteReports }; static const TidyOptionId TidyNumEntitiesLinks[] = { TidyDoctype, TidyPreserveEntities, TidyUnknownOption }; static const TidyOptionId TidyOutCharEncodingLinks[] = { TidyCharEncoding, TidyUnknownOption }; static const TidyOptionId TidyOutFileLinks[] = { TidyErrFile, TidyUnknownOption }; static const TidyOptionId TidyPreTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyUseCustomTags, TidyUnknownOption }; static const TidyOptionId TidySortAttributesLinks[] = { TidyPriorityAttributes, TidyUnknownOption }; -static const TidyOptionId TidySquelchLinks[] = { TidySquelchShow }; -static const TidyOptionId TidySquelchShowLinks[] = { TidySquelchReports }; static const TidyOptionId TidyUseCustomTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUnknownOption }; static const TidyOptionId TidyWrapAttValsLinks[] = { TidyWrapScriptlets, TidyLiteralAttribs, TidyUnknownOption }; static const TidyOptionId TidyWrapScriptletsLinks[] = { TidyWrapAttVals, TidyUnknownOption }; @@ -1548,13 +1548,13 @@ static const TidyOptionDoc docs_xrefs[] = { TidyInlineTags, TidyInlineTagsLinks }, { TidyMergeDivs, TidyMergeDivsLinks }, { TidyMergeSpans, TidyMergeSpansLinks }, + { TidyMuteShow, TidyMuteShowLinks }, { TidyNumEntities, TidyNumEntitiesLinks }, { TidyOutCharEncoding, TidyOutCharEncodingLinks }, { TidyOutFile, TidyOutFileLinks }, { TidyPreTags, TidyPreTagsLinks }, { TidySortAttributes, TidySortAttributesLinks }, - { TidySquelchShow, TidySquelchShowLinks }, - { TidySquelchReports, TidySquelchLinks }, + { TidyMuteReports, TidyMuteLinks }, { TidyUseCustomTags, TidyUseCustomTagsLinks }, { TidyWrapAttVals, TidyWrapAttValsLinks }, { TidyWrapScriptlets, TidyWrapScriptletsLinks }, diff --git a/src/message.h b/src/message.h index 6f05e1c..c5191cf 100644 --- a/src/message.h +++ b/src/message.h @@ -182,36 +182,36 @@ void TY_(ReportNumWarnings)( TidyDocImpl* doc ); /***************************************************************************//** - ** @defgroup message_squelching Message Squelching + ** @defgroup message_mutinging Message Muting ** - ** Message types included in the `squelch` option will be be printed in + ** Message types included in the `mute` option will be be printed in ** messageOut(). ** ** @{ ******************************************************************************/ /** Maintains a list of messages not to display. */ -typedef struct _squelchedMessages { +typedef struct _mutedMessages { tidyStrings* list; /**< A list of messages that won't be output. */ uint count; /**< Current count of the list. */ uint capacity; /**< Current capacity of the list. */ -} TidySquelchedMessages; +} TidyMutedMessages; -/** Frees the list of squelched messages. +/** Frees the list of muted messages. ** @param doc The Tidy document. */ -void TY_(FreeSquelchedMessageList)( TidyDocImpl* doc ); +void TY_(FreeMutedMessageList)( TidyDocImpl* doc ); -/** Adds a new message ID to the list of squelched messages. +/** Adds a new message ID to the list of muted messages. ** @param doc The Tidy document. ** @param name The message code as a string. */ -void TY_(DefineSquelchedMessage)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name ); +void TY_(DefineMutedMessage)( TidyDocImpl* doc, const TidyOptionImpl* opt, ctmbstr name ); /** @} */ -/** @} message_squelching group */ +/** @} message_muting group */ /***************************************************************************//** diff --git a/src/messageobj.c b/src/messageobj.c index f5b055c..9da8e79 100644 --- a/src/messageobj.c +++ b/src/messageobj.c @@ -156,7 +156,7 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc, result->messagePos, result->messagePrefix, result->message); - if ( ( cfgBool(doc, TidySquelchShow) == yes ) && level <= TidyFatal ) + if ( ( cfgBool(doc, TidyMuteShow) == yes ) && level <= TidyFatal ) { TY_(tmbsnprintf)(result->messageOutputDefault, sizeMessageBuf, "%s (%s)", result->messageOutputDefault, TY_(tidyErrorCodeAsKey)(code) ); TY_(tmbsnprintf)(result->messageOutput, sizeMessageBuf, "%s (%s)", result->messageOutput, TY_(tidyErrorCodeAsKey)(code) ); @@ -192,13 +192,13 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc, } /* finally, check the document's configuration to determine whether - this message is squelched. */ - result->squelched = no; - while ( ( doc->squelched.list ) && ( doc->squelched.list[i] != 0 ) ) + this message is muted. */ + result->muted = no; + while ( ( doc->muted.list ) && ( doc->muted.list[i] != 0 ) ) { - if ( doc->squelched.list[i] == code ) + if ( doc->muted.list[i] == code ) { - result->squelched = yes; + result->muted = yes; break; } i++; @@ -312,9 +312,9 @@ TidyReportLevel TY_(getMessageLevel)( TidyMessageImpl message ) return message.level; } -Bool TY_(getMessageIsSquelched)( TidyMessageImpl message ) +Bool TY_(getMessageIsMuted)( TidyMessageImpl message ) { - return message.squelched; + return message.muted; } ctmbstr TY_(getMessageFormatDefault)( TidyMessageImpl message ) diff --git a/src/messageobj.h b/src/messageobj.h index 154fae5..0ee1666 100644 --- a/src/messageobj.h +++ b/src/messageobj.h @@ -80,8 +80,8 @@ int TY_(getMessageColumn)( TidyMessageImpl message ); /** get the TidyReportLevel of the message. */ TidyReportLevel TY_(getMessageLevel)( TidyMessageImpl message ); -/** get whether or not the message was squelched by the configuration. */ -Bool TY_(getMessageIsSquelched)( TidyMessageImpl message ); +/** get whether or not the message was muted by the configuration. */ +Bool TY_(getMessageIsMuted)( TidyMessageImpl message ); /** the built-in format string */ ctmbstr TY_(getMessageFormatDefault)( TidyMessageImpl message ); diff --git a/src/tidy-int.h b/src/tidy-int.h index b677ff0..9732dae 100644 --- a/src/tidy-int.h +++ b/src/tidy-int.h @@ -45,7 +45,7 @@ struct _TidyDocImpl TidyTagImpl tags; TidyAttribImpl attribs; TidyAccessImpl access; - TidySquelchedMessages squelched; + TidyMutedMessages muted; /* The Pretty Print buffer */ TidyPrintImpl pprint; @@ -106,7 +106,7 @@ struct _TidyMessageImpl int column; /* the column the message applies to */ TidyReportLevel level; /* the severity level of the message */ Bool allowMessage; /* indicates whether or not a filter rejected a message */ - Bool squelched; /* indicates whether or not a configuration squelches this message */ + Bool muted; /* indicates whether or not a configuration mutes this message */ int argcount; /* the number of arguments */ struct printfArg* arguments; /* the arguments' values and types */ diff --git a/src/tidylib.c b/src/tidylib.c index 2bc7c08..45aaf04 100644 --- a/src/tidylib.c +++ b/src/tidylib.c @@ -139,7 +139,7 @@ void tidyDocRelease( TidyDocImpl* doc ) TY_(FreeConfig)( doc ); TY_(FreeAttrTable)( doc ); TY_(FreeAttrPriorityList)( doc ); - TY_(FreeSquelchedMessageList( doc )); + TY_(FreeMutedMessageList( doc )); TY_(FreeTags)( doc ); /*\ * Issue #186 - Now FreeNode depend on the doctype, so the lexer is needed @@ -715,10 +715,10 @@ TidyReportLevel TIDY_CALL tidyGetMessageLevel( TidyMessage tmessage ) return TY_(getMessageLevel)(*message); } -Bool TIDY_CALL tidyGetMessageIsSquelched( TidyMessage tmessage ) +Bool TIDY_CALL tidyGetMessageIsMuted( TidyMessage tmessage ) { TidyMessageImpl *message = tidyMessageToImpl(tmessage); - return TY_(getMessageIsSquelched)(*message); + return TY_(getMessageIsMuted)(*message); } ctmbstr TIDY_CALL tidyGetMessageFormatDefault( TidyMessage tmessage ) From 6f51eced5e256cb0bffc4ce60a1021b050235d4a Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Tue, 10 Oct 2017 19:30:57 -0400 Subject: [PATCH 12/12] Place the last three report messages into the reports range of the enum, taking them out of the dialogue range, so that they can properly be silenced. --- include/tidyenum.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tidyenum.h b/include/tidyenum.h index a76e0ee..90d7352 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -157,12 +157,9 @@ extern "C" { ** than the short report. */ #define FOREACH_DIALOG_MSG(FN) \ -/* TidyInfo */ FN(STRING_CONTENT_LOOKS) \ -/* TidyInfo */ FN(STRING_DOCTYPE_GIVEN) \ /* TidyDialogueSummary */ FN(STRING_ERROR_COUNT) \ /* TidyDialogueSummary */ FN(STRING_NEEDS_INTERVENTION) \ /* TidyDialogueSummary */ FN(STRING_NO_ERRORS) \ -/* TidyInfo */ FN(STRING_NO_SYSID) \ /* TidyDialogueSummary */ FN(STRING_NOT_ALL_SHOWN) \ /* TidyDialogueInfo */ FN(TEXT_GENERAL_INFO_PLEA) \ /* TidyDialogueInfo */ FN(TEXT_GENERAL_INFO) @@ -255,9 +252,12 @@ extern "C" { FN(REPLACING_ELEMENT) \ FN(REPLACING_UNEX_ELEMENT) \ FN(SPACE_PRECEDING_XMLDECL) \ + FN(STRING_CONTENT_LOOKS) \ FN(STRING_ARGUMENT_BAD) \ + FN(STRING_DOCTYPE_GIVEN) \ FN(STRING_MISSING_MALFORMED) \ FN(STRING_MUTING_TYPE) \ + FN(STRING_NO_SYSID) \ FN(STRING_UNKNOWN_OPTION) \ FN(SUSPECTED_MISSING_QUOTE) \ FN(TAG_NOT_ALLOWED_IN) \