From fa78a324d0800597d0d70c821dd88704717aff09 Mon Sep 17 00:00:00 2001 From: Lee Date: Fri, 13 Apr 2018 10:01:39 -0400 Subject: [PATCH 1/3] update --gnu-emacs option documentation --- src/language_en.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/language_en.h b/src/language_en.h index 7ec8964..89ce073 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -363,8 +363,15 @@ static languageDefinition language_en = { whichPluralForm_en, { - The strings "Tidy" and "HTML Tidy" are the program name and must not be translated. */ TidyEmacs, 0, - "This option specifies if Tidy should change the format for reporting " - "errors and warnings to a format that is more easily parsed by GNU Emacs. " + "This option specifies that Tidy should change the format for reporting " + "errors and warnings to a format that is more easily parsed by GNU Emacs " + "or some other program. It changes them from the default " + "
" + " line <line number> column <column number> - (Error|Warning): <message> " + "
" + "to a form which includes the input filename: " + "
" + " <filename>:<line number>:<column number>: (Error|Warning): <message> " }, {/* Important notes for translators: - Use only , , , , and From 8d86ed24e9d91e7b4cb6c714ffaec0cb84dade44 Mon Sep 17 00:00:00 2001 From: ler762 Date: Fri, 13 Apr 2018 10:25:01 -0400 Subject: [PATCH 2/3] add --show-filename option to show the input filename on output messages --- include/tidyenum.h | 2 ++ src/config.c | 1 + src/language_en.h | 16 ++++++++++++++++ src/message.c | 4 ++++ src/messageobj.c | 8 ++++++++ 5 files changed, 31 insertions(+) diff --git a/include/tidyenum.h b/include/tidyenum.h index 949d464..bb84340 100644 --- a/include/tidyenum.h +++ b/include/tidyenum.h @@ -107,6 +107,7 @@ extern "C" { */ #define FOREACH_MSG_MISC(FN) \ /** line %d column %d */ FN(LINE_COLUMN_STRING) \ +/** %s: line %d column %d */ FN(FN_LINE_COLUMN_STRING) \ /** discarding */ FN(STRING_DISCARDING) \ /** error and errors */ FN(STRING_ERROR_COUNT_ERROR) \ /** warning and warnings */ FN(STRING_ERROR_COUNT_WARNING) \ @@ -635,6 +636,7 @@ typedef enum TidyQuoteNbsp, /**< Output non-breaking space as entity */ TidyReplaceColor, /**< Replace hex color attribute values with names */ TidyShowErrors, /**< Number of errors to put out */ + TidyShowFilename, /**< If true, the input filename is displayed with the error messages */ TidyShowInfo, /**< If true, info-level messages are shown */ TidyShowMarkup, /**< If false, normal output is suppressed */ TidyShowMetaChange, /**< show when meta http-equiv content charset was changed - compatibility */ diff --git a/src/config.c b/src/config.c index f2c4cb6..9235663 100644 --- a/src/config.c +++ b/src/config.c @@ -245,6 +245,7 @@ static const TidyOptionImpl option_defs[] = { TidyQuoteNbsp, ME, "quote-nbsp", BL, yes, ParsePickList, &boolPicks }, { TidyReplaceColor, MX, "replace-color", BL, no, ParsePickList, &boolPicks }, { TidyShowErrors, DD, "show-errors", IN, 6, ParseInt, NULL }, + { TidyShowFilename, DD, "show-filename", BL, no, ParsePickList, &boolPicks }, { TidyShowInfo, DD, "show-info", BL, yes, ParsePickList, &boolPicks }, { TidyShowMarkup, DD, "markup", BL, yes, ParsePickList, &boolPicks }, { TidyShowMetaChange, DG, "show-meta-change", BL, no, ParsePickList, &boolPicks }, /* 20170609 - Issue #456 */ diff --git a/src/language_en.h b/src/language_en.h index 89ce073..3e733d5 100644 --- a/src/language_en.h +++ b/src/language_en.h @@ -1172,6 +1172,21 @@ static languageDefinition language_en = { whichPluralForm_en, { "This option specifies the number Tidy uses to determine if further errors " "should be shown. If set to 0, then no errors are shown. " }, + {/* 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. */ + TidyShowFilename, 0, + "This option specifies if Tidy should show the filename in messages. eg: " + "
" + " tidy -q -e --show-filename yes index.html
" + " index.html: line 43 column 3 - Warning: replacing invalid UTF-8 bytes (char. code U+00A9) " + }, + {/* Important notes for translators: - Use only , , , , and
. @@ -1688,6 +1703,7 @@ static languageDefinition language_en = { whichPluralForm_en, { ** @remark enum generator FOREACH_MSG_MISC ********************************************/ { LINE_COLUMN_STRING, 0, "line %d column %d - " }, + { FN_LINE_COLUMN_STRING, 0, "%s: line %d column %d - " }, {/* For example, "discarding invalid UTF-16 surrogate pair" */ STRING_DISCARDING, 0, "discarding" }, diff --git a/src/message.c b/src/message.c index eb097de..064ef8a 100644 --- a/src/message.c +++ b/src/message.c @@ -1520,6 +1520,7 @@ static const TidyOptionId TidyAsciiCharsLinks[] = { TidyMakeClean, TidyUnkn static const TidyOptionId TidyBlockTagsLinks[] = { TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUseCustomTags, TidyUnknownOption }; static const TidyOptionId TidyCharEncodingLinks[] = { TidyInCharEncoding, TidyOutCharEncoding, TidyUnknownOption }; static const TidyOptionId TidyDuplicateAttrsLinks[] = { TidyJoinClasses, TidyJoinStyles, TidyUnknownOption }; +static const TidyOptionId TidyEmacsLinks[] = { TidyShowFilename, TidyUnknownOption }; static const TidyOptionId TidyEmptyTagsLinks[] = { TidyBlockTags, TidyInlineTags, TidyPreTags, TidyUseCustomTags, TidyUnknownOption }; static const TidyOptionId TidyErrFileLinks[] = { TidyOutFile, TidyUnknownOption }; static const TidyOptionId TidyInCharEncodingLinks[] = { TidyCharEncoding, TidyUnknownOption }; @@ -1534,6 +1535,7 @@ static const TidyOptionId TidyNumEntitiesLinks[] = { TidyDoctype, TidyPreser static const TidyOptionId TidyOutCharEncodingLinks[] = { TidyCharEncoding, TidyUnknownOption }; static const TidyOptionId TidyOutFileLinks[] = { TidyErrFile, TidyUnknownOption }; static const TidyOptionId TidyPreTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyUseCustomTags, TidyUnknownOption }; +static const TidyOptionId TidyShowFilenameLinks[] = { TidyEmacs, TidyUnknownOption }; static const TidyOptionId TidySortAttributesLinks[] = { TidyPriorityAttributes, TidyUnknownOption }; static const TidyOptionId TidyUseCustomTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUnknownOption }; static const TidyOptionId TidyWrapAttValsLinks[] = { TidyWrapScriptlets, TidyLiteralAttribs, TidyUnknownOption }; @@ -1550,6 +1552,7 @@ static const TidyOptionDoc docs_xrefs[] = { TidyBlockTags, TidyBlockTagsLinks }, { TidyCharEncoding, TidyCharEncodingLinks }, { TidyDuplicateAttrs, TidyDuplicateAttrsLinks }, + { TidyEmacs, TidyEmacsLinks }, { TidyEmptyTags, TidyEmptyTagsLinks }, { TidyErrFile, TidyErrFileLinks }, { TidyInCharEncoding, TidyInCharEncodingLinks }, @@ -1563,6 +1566,7 @@ static const TidyOptionDoc docs_xrefs[] = { TidyOutCharEncoding, TidyOutCharEncodingLinks }, { TidyOutFile, TidyOutFileLinks }, { TidyPreTags, TidyPreTagsLinks }, + { TidyShowFilename, TidyShowFilenameLinks }, { TidySortAttributes, TidySortAttributesLinks }, { TidyMuteReports, TidyMuteLinks }, { TidyUseCustomTags, TidyUseCustomTagsLinks }, diff --git a/src/messageobj.c b/src/messageobj.c index 9d9cee2..e6aee29 100644 --- a/src/messageobj.c +++ b/src/messageobj.c @@ -127,6 +127,14 @@ static TidyMessageImpl *tidyMessageCreateInitV( TidyDocImpl *doc, TY_(tmbsnprintf)(result->messagePosDefault, sizeMessageBuf, "%s:%d:%d: ", cfgStr(doc, TidyEmacsFile), line, column); TY_(tmbsnprintf)(result->messagePos, sizeMessageBuf, "%s:%d:%d: ", cfgStr(doc, TidyEmacsFile), line, column); } + else if ( cfgBool(doc, TidyShowFilename) && cfgStr(doc, TidyEmacsFile) ) + { + /* Include filename in output */ + TY_(tmbsnprintf)(result->messagePosDefault, sizeMessageBuf, tidyDefaultString(FN_LINE_COLUMN_STRING), + cfgStr(doc, TidyEmacsFile), line, column); + TY_(tmbsnprintf)(result->messagePos, sizeMessageBuf, tidyLocalizedString(FN_LINE_COLUMN_STRING), + cfgStr(doc, TidyEmacsFile), line, column); + } else { /* traditional format */ From ac287d56bd88bd78fa4ee98f44f37840d2cfc493 Mon Sep 17 00:00:00 2001 From: ler762 Date: Fri, 13 Apr 2018 11:29:55 -0400 Subject: [PATCH 3/3] fix spelling mistake --- README/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README/CONTRIBUTING.md b/README/CONTRIBUTING.md index 788eb18..0055127 100644 --- a/README/CONTRIBUTING.md +++ b/README/CONTRIBUTING.md @@ -40,7 +40,7 @@ Concerning the “Tidy Code Style,” checkout [CODESTYLE.md](CODESTYLE.md), but ### Using Git appropriately 1. Fork the repository to your GitHub account. - 2. Optionally create a **topical branch**, a branch whose name is succint but explains what you're doing, such as "feature/add-new-lines". + 2. Optionally create a **topical branch**, a branch whose name is succinct but explains what you're doing, such as "feature/add-new-lines". 3. Make your changes, committing at logical breaks. 4. Push your work to your personal account. 5. [Create a pull request](https://help.github.com/articles/using-pull-requests).