add --show-filename option to show the input filename on output messages
This commit is contained in:
parent
fa78a324d0
commit
8d86ed24e9
|
@ -107,6 +107,7 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define FOREACH_MSG_MISC(FN) \
|
#define FOREACH_MSG_MISC(FN) \
|
||||||
/** line %d column %d */ FN(LINE_COLUMN_STRING) \
|
/** line %d column %d */ FN(LINE_COLUMN_STRING) \
|
||||||
|
/** %s: line %d column %d */ FN(FN_LINE_COLUMN_STRING) \
|
||||||
/** discarding */ FN(STRING_DISCARDING) \
|
/** discarding */ FN(STRING_DISCARDING) \
|
||||||
/** error and errors */ FN(STRING_ERROR_COUNT_ERROR) \
|
/** error and errors */ FN(STRING_ERROR_COUNT_ERROR) \
|
||||||
/** warning and warnings */ FN(STRING_ERROR_COUNT_WARNING) \
|
/** warning and warnings */ FN(STRING_ERROR_COUNT_WARNING) \
|
||||||
|
@ -635,6 +636,7 @@ typedef enum
|
||||||
TidyQuoteNbsp, /**< Output non-breaking space as entity */
|
TidyQuoteNbsp, /**< Output non-breaking space as entity */
|
||||||
TidyReplaceColor, /**< Replace hex color attribute values with names */
|
TidyReplaceColor, /**< Replace hex color attribute values with names */
|
||||||
TidyShowErrors, /**< Number of errors to put out */
|
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 */
|
TidyShowInfo, /**< If true, info-level messages are shown */
|
||||||
TidyShowMarkup, /**< If false, normal output is suppressed */
|
TidyShowMarkup, /**< If false, normal output is suppressed */
|
||||||
TidyShowMetaChange, /**< show when meta http-equiv content charset was changed - compatibility */
|
TidyShowMetaChange, /**< show when meta http-equiv content charset was changed - compatibility */
|
||||||
|
|
|
@ -245,6 +245,7 @@ static const TidyOptionImpl option_defs[] =
|
||||||
{ TidyQuoteNbsp, ME, "quote-nbsp", BL, yes, ParsePickList, &boolPicks },
|
{ TidyQuoteNbsp, ME, "quote-nbsp", BL, yes, ParsePickList, &boolPicks },
|
||||||
{ TidyReplaceColor, MX, "replace-color", BL, no, ParsePickList, &boolPicks },
|
{ TidyReplaceColor, MX, "replace-color", BL, no, ParsePickList, &boolPicks },
|
||||||
{ TidyShowErrors, DD, "show-errors", IN, 6, ParseInt, NULL },
|
{ TidyShowErrors, DD, "show-errors", IN, 6, ParseInt, NULL },
|
||||||
|
{ TidyShowFilename, DD, "show-filename", BL, no, ParsePickList, &boolPicks },
|
||||||
{ TidyShowInfo, DD, "show-info", BL, yes, ParsePickList, &boolPicks },
|
{ TidyShowInfo, DD, "show-info", BL, yes, ParsePickList, &boolPicks },
|
||||||
{ TidyShowMarkup, DD, "markup", BL, yes, ParsePickList, &boolPicks },
|
{ TidyShowMarkup, DD, "markup", BL, yes, ParsePickList, &boolPicks },
|
||||||
{ TidyShowMetaChange, DG, "show-meta-change", BL, no, ParsePickList, &boolPicks }, /* 20170609 - Issue #456 */
|
{ TidyShowMetaChange, DG, "show-meta-change", BL, no, ParsePickList, &boolPicks }, /* 20170609 - Issue #456 */
|
||||||
|
|
|
@ -1172,6 +1172,21 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
"This option specifies the number Tidy uses to determine if further errors "
|
"This option specifies the number Tidy uses to determine if further errors "
|
||||||
"should be shown. If set to <var>0</var>, then no errors are shown. "
|
"should be shown. If set to <var>0</var>, then no errors are shown. "
|
||||||
},
|
},
|
||||||
|
{/* 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. */
|
||||||
|
TidyShowFilename, 0,
|
||||||
|
"This option specifies if Tidy should show the filename in messages. eg: "
|
||||||
|
"<br/>"
|
||||||
|
" tidy -q -e --show-filename yes index.html<br/>"
|
||||||
|
" index.html: line 43 column 3 - Warning: replacing invalid UTF-8 bytes (char. code U+00A9) "
|
||||||
|
},
|
||||||
|
|
||||||
{/* 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/>.
|
||||||
|
@ -1688,6 +1703,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
||||||
** @remark enum generator FOREACH_MSG_MISC
|
** @remark enum generator FOREACH_MSG_MISC
|
||||||
********************************************/
|
********************************************/
|
||||||
{ LINE_COLUMN_STRING, 0, "line %d column %d - " },
|
{ 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" */
|
{/* For example, "discarding invalid UTF-16 surrogate pair" */
|
||||||
STRING_DISCARDING, 0, "discarding"
|
STRING_DISCARDING, 0, "discarding"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1520,6 +1520,7 @@ static const TidyOptionId TidyAsciiCharsLinks[] = { TidyMakeClean, TidyUnkn
|
||||||
static const TidyOptionId TidyBlockTagsLinks[] = { TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUseCustomTags, TidyUnknownOption };
|
static const TidyOptionId TidyBlockTagsLinks[] = { TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUseCustomTags, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyCharEncodingLinks[] = { TidyInCharEncoding, TidyOutCharEncoding, TidyUnknownOption };
|
static const TidyOptionId TidyCharEncodingLinks[] = { TidyInCharEncoding, TidyOutCharEncoding, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyDuplicateAttrsLinks[] = { TidyJoinClasses, TidyJoinStyles, 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 TidyEmptyTagsLinks[] = { TidyBlockTags, TidyInlineTags, TidyPreTags, TidyUseCustomTags, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyErrFileLinks[] = { TidyOutFile, TidyUnknownOption };
|
static const TidyOptionId TidyErrFileLinks[] = { TidyOutFile, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyInCharEncodingLinks[] = { TidyCharEncoding, 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 TidyOutCharEncodingLinks[] = { TidyCharEncoding, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyOutFileLinks[] = { TidyErrFile, TidyUnknownOption };
|
static const TidyOptionId TidyOutFileLinks[] = { TidyErrFile, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyPreTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyUseCustomTags, 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 TidySortAttributesLinks[] = { TidyPriorityAttributes, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyUseCustomTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUnknownOption };
|
static const TidyOptionId TidyUseCustomTagsLinks[] = { TidyBlockTags, TidyEmptyTags, TidyInlineTags, TidyPreTags, TidyUnknownOption };
|
||||||
static const TidyOptionId TidyWrapAttValsLinks[] = { TidyWrapScriptlets, TidyLiteralAttribs, TidyUnknownOption };
|
static const TidyOptionId TidyWrapAttValsLinks[] = { TidyWrapScriptlets, TidyLiteralAttribs, TidyUnknownOption };
|
||||||
|
@ -1550,6 +1552,7 @@ static const TidyOptionDoc docs_xrefs[] =
|
||||||
{ TidyBlockTags, TidyBlockTagsLinks },
|
{ TidyBlockTags, TidyBlockTagsLinks },
|
||||||
{ TidyCharEncoding, TidyCharEncodingLinks },
|
{ TidyCharEncoding, TidyCharEncodingLinks },
|
||||||
{ TidyDuplicateAttrs, TidyDuplicateAttrsLinks },
|
{ TidyDuplicateAttrs, TidyDuplicateAttrsLinks },
|
||||||
|
{ TidyEmacs, TidyEmacsLinks },
|
||||||
{ TidyEmptyTags, TidyEmptyTagsLinks },
|
{ TidyEmptyTags, TidyEmptyTagsLinks },
|
||||||
{ TidyErrFile, TidyErrFileLinks },
|
{ TidyErrFile, TidyErrFileLinks },
|
||||||
{ TidyInCharEncoding, TidyInCharEncodingLinks },
|
{ TidyInCharEncoding, TidyInCharEncodingLinks },
|
||||||
|
@ -1563,6 +1566,7 @@ static const TidyOptionDoc docs_xrefs[] =
|
||||||
{ TidyOutCharEncoding, TidyOutCharEncodingLinks },
|
{ TidyOutCharEncoding, TidyOutCharEncodingLinks },
|
||||||
{ TidyOutFile, TidyOutFileLinks },
|
{ TidyOutFile, TidyOutFileLinks },
|
||||||
{ TidyPreTags, TidyPreTagsLinks },
|
{ TidyPreTags, TidyPreTagsLinks },
|
||||||
|
{ TidyShowFilename, TidyShowFilenameLinks },
|
||||||
{ TidySortAttributes, TidySortAttributesLinks },
|
{ TidySortAttributes, TidySortAttributesLinks },
|
||||||
{ TidyMuteReports, TidyMuteLinks },
|
{ TidyMuteReports, TidyMuteLinks },
|
||||||
{ TidyUseCustomTags, TidyUseCustomTagsLinks },
|
{ TidyUseCustomTags, TidyUseCustomTagsLinks },
|
||||||
|
|
|
@ -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->messagePosDefault, sizeMessageBuf, "%s:%d:%d: ", cfgStr(doc, TidyEmacsFile), line, column);
|
||||||
TY_(tmbsnprintf)(result->messagePos, 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
|
else
|
||||||
{
|
{
|
||||||
/* traditional format */
|
/* traditional format */
|
||||||
|
|
Loading…
Reference in a new issue