Introduced auto behavior to the fix-bad-comments option so that yes or

`no` could be applied automatically per the document type. This is the new
default.
This commit is contained in:
Jim Derry 2017-09-25 15:26:03 -04:00
parent c74e47adbb
commit df3bde38ec
4 changed files with 27 additions and 8 deletions

View file

@ -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-09-24 18:12:27\n"
"POT-Creation-Date: 2017-09-25 15:18:12\n"
"Last-Translator: jderry\n"
"Language-Team: \n"
@ -466,7 +466,9 @@ msgid ""
"This option specifies if Tidy should replace unexpected hyphens with "
"<code>=</code> characters when it comes across adjacent hyphens. "
"<br/>"
"The default is <var>no</var>. "
"The default is <var>auto</var> will which will act as <var>no</var> "
"for HTML5 document types, and <var>yes</var> for all other document "
"types. "
"<br/>"
"HTML has abandonded SGML comment syntax, and allows adjacent hypens "
"for all versions of HTML, although XML and XHTML do not. If you plan "

View file

@ -59,9 +59,9 @@ static PickListItems boolPicks = {
};
static PickListItems autoBoolPicks = {
{ "no", TidyNoState, { "0", "n", "f", "no", "false", NULL } },
{ "yes", TidyYesState, { "1", "y", "t", "yes", "true", NULL } },
{ "auto", TidyYesState, { "auto", NULL } },
{ "no", TidyNoState, { "0", "n", "f", "no", "false", NULL } },
{ "yes", TidyYesState, { "1", "y", "t", "yes", "true", NULL } },
{ "auto", TidyAutoState, { "auto", NULL } },
{ NULL }
};
@ -241,7 +241,7 @@ static const TidyOptionImpl option_defs[] =
{ TidyEscapeCdata, MU, "escape-cdata", BL, no, ParsePickList, &boolPicks },
{ TidyEscapeScripts, PP, "escape-scripts", BL, yes, ParsePickList, &boolPicks }, /* 20160227 - Issue #348 */
{ TidyFixBackslash, MU, "fix-backslash", BL, yes, ParsePickList, &boolPicks },
{ TidyFixComments, MU, "fix-bad-comments", BL, no, ParsePickList, &boolPicks },
{ TidyFixComments, MU, "fix-bad-comments", IN, TidyAutoState, ParsePickList, &autoBoolPicks },
{ TidyFixUri, MU, "fix-uri", BL, yes, ParsePickList, &boolPicks },
{ TidyForceOutput, MS, "force-output", BL, no, ParsePickList, &boolPicks },
{ TidyGDocClean, MU, "gdoc", BL, no, ParsePickList, &boolPicks },

View file

@ -476,7 +476,9 @@ static languageDefinition language_en = { whichPluralForm_en, {
"This option specifies if Tidy should replace unexpected hyphens with "
"<code>=</code> characters when it comes across adjacent hyphens. "
"<br/>"
"The default is <var>no</var>. "
"The default is <var>auto</var> will which will act as <var>no</var> "
"for HTML5 document types, and <var>yes</var> for all other document "
"types. "
"<br/>"
"HTML has abandonded SGML comment syntax, and allows adjacent hypens "
"for all versions of HTML, although XML and XHTML do not. If you plan "

View file

@ -2613,7 +2613,22 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
Bool isempty = no;
AttVal *attributes = NULL;
Node *node;
Bool fixComments = cfgBool(doc, TidyFixComments);
Bool fixComments;
switch ( cfgAutoBool(doc, TidyFixComments) )
{
case TidyYesState:
fixComments = yes;
break;
case TidyNoState:
fixComments = no;
break;
default:
fixComments = (TY_(HTMLVersion)(doc) & HT50) == 0;
break;
}
/* Lexer->token must be set on return. Nullify it for safety. */
lexer->token = NULL;