Skip to content

Commit b32e14a

Browse files
committed
Issue #456 - add new option show-meta-change
1 parent 9729264 commit b32e14a

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

include/tidyenum.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ typedef enum
651651
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */
652652
TidyXmlTags, /**< Treat input as XML */
653653
TidyMetaCharset, /**< Adds/checks/fixes meta charset in the head, based on document type */
654+
TidyShowMetaChange, /**< show when meta http-equiv content charset was changed - compatibility */
654655
N_TIDY_OPTIONS /**< Must be last */
655656
} TidyOptionId;
656657

src/clean.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2452,7 +2452,8 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
24522452
newValue = (tmbstr)TidyDocAlloc(doc, 19 + TY_(tmbstrlen)(enc) + 1);
24532453
TY_(tmbstrcpy)(newValue, "text/html; charset=");
24542454
TY_(tmbstrcpy)(newValue + 19, enc);
2455-
TY_(ReportAttrError)(doc, currentNode, contentAttr, ATTRIBUTE_VALUE_REPLACED);
2455+
if (cfgBool(doc, TidyShowMetaChange)) /* Issue #456 - backward compatibility only */
2456+
TY_(ReportAttrError)(doc, currentNode, contentAttr, ATTRIBUTE_VALUE_REPLACED);
24562457
TidyDocFree(doc, contentAttr->value);
24572458
contentAttr->value = newValue;
24582459
charsetFound = yes;

src/config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ static const TidyOptionImpl option_defs[] =
313313
{ TidyXmlSpace, MU, "add-xml-space", BL, no, ParsePickList, &boolPicks },
314314
{ TidyXmlTags, MU, "input-xml", BL, no, ParsePickList, &boolPicks },
315315
{ TidyMetaCharset, MS, "add-meta-charset", BL, no, ParsePickList, &boolPicks }, /* 20161004 - Issue #456 */
316+
{ TidyShowMetaChange, MS, "show-meta-change", BL, no, ParsePickList, &boolPicks }, /* 20170609 - Issue #456 */
316317
{ N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL }
317318
};
318319

src/language_en.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,12 @@ static languageDefinition language_en = { whichPluralForm_en, {
15221522
be translated. */
15231523
TidyMetaCharset, 0,
15241524
"This option adds a meta element and sets the charset attribute to the encoding of the document."
1525-
"Set this option to 'yes' if you want this."
1525+
" Set this option to <var>yes</var> if you want this."
1526+
},
1527+
{
1528+
TidyShowMetaChange, 0,
1529+
"This option shows when a meta http-equiv content charset attribute was changed to the encoding of the document."
1530+
" Set this option to <var>yes</var> if you want this."
15261531
},
15271532

15281533
/********************************************

0 commit comments

Comments
 (0)