Issue #456 - add new option show-meta-change

This commit is contained in:
Geoff McLane 2017-06-09 03:11:39 +02:00
parent 97292646f6
commit b32e14a8ea
4 changed files with 10 additions and 2 deletions

View file

@ -651,6 +651,7 @@ typedef enum
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */ TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */
TidyXmlTags, /**< Treat input as XML */ TidyXmlTags, /**< Treat input as XML */
TidyMetaCharset, /**< Adds/checks/fixes meta charset in the head, based on document type */ TidyMetaCharset, /**< Adds/checks/fixes meta charset in the head, based on document type */
TidyShowMetaChange, /**< show when meta http-equiv content charset was changed - compatibility */
N_TIDY_OPTIONS /**< Must be last */ N_TIDY_OPTIONS /**< Must be last */
} TidyOptionId; } TidyOptionId;

View file

@ -2452,7 +2452,8 @@ Bool TY_(TidyMetaCharset)(TidyDocImpl* doc)
newValue = (tmbstr)TidyDocAlloc(doc, 19 + TY_(tmbstrlen)(enc) + 1); newValue = (tmbstr)TidyDocAlloc(doc, 19 + TY_(tmbstrlen)(enc) + 1);
TY_(tmbstrcpy)(newValue, "text/html; charset="); TY_(tmbstrcpy)(newValue, "text/html; charset=");
TY_(tmbstrcpy)(newValue + 19, enc); TY_(tmbstrcpy)(newValue + 19, enc);
TY_(ReportAttrError)(doc, currentNode, contentAttr, ATTRIBUTE_VALUE_REPLACED); if (cfgBool(doc, TidyShowMetaChange)) /* Issue #456 - backward compatibility only */
TY_(ReportAttrError)(doc, currentNode, contentAttr, ATTRIBUTE_VALUE_REPLACED);
TidyDocFree(doc, contentAttr->value); TidyDocFree(doc, contentAttr->value);
contentAttr->value = newValue; contentAttr->value = newValue;
charsetFound = yes; charsetFound = yes;

View file

@ -313,6 +313,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyXmlSpace, MU, "add-xml-space", BL, no, ParsePickList, &boolPicks }, { TidyXmlSpace, MU, "add-xml-space", BL, no, ParsePickList, &boolPicks },
{ TidyXmlTags, MU, "input-xml", BL, no, ParsePickList, &boolPicks }, { TidyXmlTags, MU, "input-xml", BL, no, ParsePickList, &boolPicks },
{ TidyMetaCharset, MS, "add-meta-charset", BL, no, ParsePickList, &boolPicks }, /* 20161004 - Issue #456 */ { TidyMetaCharset, MS, "add-meta-charset", BL, no, ParsePickList, &boolPicks }, /* 20161004 - Issue #456 */
{ TidyShowMetaChange, MS, "show-meta-change", BL, no, ParsePickList, &boolPicks }, /* 20170609 - Issue #456 */
{ N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL } { N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL }
}; };

View file

@ -1522,7 +1522,12 @@ static languageDefinition language_en = { whichPluralForm_en, {
be translated. */ be translated. */
TidyMetaCharset, 0, TidyMetaCharset, 0,
"This option adds a meta element and sets the charset attribute to the encoding of the document." "This option adds a meta element and sets the charset attribute to the encoding of the document."
"Set this option to 'yes' if you want this." " Set this option to <var>yes</var> if you want this."
},
{
TidyShowMetaChange, 0,
"This option shows when a meta http-equiv content charset attribute was changed to the encoding of the document."
" Set this option to <var>yes</var> if you want this."
}, },
/******************************************** /********************************************