Merge branch 'next' into issue-395
This commit is contained in:
commit
c61b5b7b0c
|
@ -473,26 +473,20 @@ static tmbstr get_escaped_name( ctmbstr name )
|
|||
*/
|
||||
|
||||
|
||||
/** Utility to determine if an option is an AutoBool.
|
||||
/** Utility to determine if an option has a picklist.
|
||||
** @param topt The option to check.
|
||||
** @result Returns a Bool indicating whether the option is an Autobool or not.
|
||||
** @result Returns a Bool indicating whether the option has a picklist or not.
|
||||
*/
|
||||
static Bool isAutoBool( TidyOption topt )
|
||||
static Bool hasPickList( TidyOption topt )
|
||||
{
|
||||
TidyIterator pos;
|
||||
ctmbstr def;
|
||||
|
||||
if ( tidyOptGetType( topt ) != TidyInteger)
|
||||
return no;
|
||||
|
||||
pos = tidyOptGetPickList( topt );
|
||||
while ( pos )
|
||||
{
|
||||
def = tidyOptGetNextPick( topt, &pos );
|
||||
if (0==strcmp(def,"yes"))
|
||||
return yes;
|
||||
}
|
||||
return no;
|
||||
|
||||
return tidyOptGetNextPick( topt, &pos ) != NULL;
|
||||
}
|
||||
|
||||
/** Returns the configuration category name for the specified configuration
|
||||
|
@ -555,16 +549,6 @@ static void GetOption(TidyDoc tdoc, /**< The tidy document. */
|
|||
/* Handle special cases first. */
|
||||
switch ( optId )
|
||||
{
|
||||
case TidyDuplicateAttrs:
|
||||
case TidySortAttributes:
|
||||
case TidyNewline:
|
||||
case TidyAccessibilityCheckLevel:
|
||||
case TidyUseCustomTags:
|
||||
d->type = "enum";
|
||||
d->vals = NULL;
|
||||
d->def = tidyOptGetCurrPick( tdoc, optId );
|
||||
break;
|
||||
|
||||
case TidyDoctype:
|
||||
d->type = "DocType";
|
||||
d->vals = NULL;
|
||||
|
@ -581,7 +565,7 @@ static void GetOption(TidyDoc tdoc, /**< The tidy document. */
|
|||
case TidyBlockTags:
|
||||
case TidyEmptyTags:
|
||||
case TidyPreTags:
|
||||
d->type = "Tag names";
|
||||
d->type = "Tag Names";
|
||||
d->vals = "tagX, tagY, ...";
|
||||
d->def = NULL;
|
||||
break;
|
||||
|
@ -602,15 +586,13 @@ static void GetOption(TidyDoc tdoc, /**< The tidy document. */
|
|||
{
|
||||
case TidyBoolean:
|
||||
d->type = "Boolean";
|
||||
d->vals = "y/n, yes/no, t/f, true/false, 1/0";
|
||||
d->def = tidyOptGetCurrPick( tdoc, optId );
|
||||
break;
|
||||
|
||||
case TidyInteger:
|
||||
if (isAutoBool(topt))
|
||||
if (hasPickList(topt))
|
||||
{
|
||||
d->type = "AutoBool";
|
||||
d->vals = "auto, y/n, yes/no, t/f, true/false, 1/0";
|
||||
d->type = "Enum";
|
||||
d->def = tidyOptGetCurrPick( tdoc, optId );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -787,6 +787,16 @@ typedef enum
|
|||
TidySortAttrAlpha /**< Sort attributes alphabetically */
|
||||
} TidyAttrSortStrategy;
|
||||
|
||||
/** Mode controlling capitalization of things, such as attributes.
|
||||
** @remark This enum's starting value is guaranteed to remain stable.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
TidyUppercaseNo = 0, /**< Don't uppercase. */
|
||||
TidyUppercaseYes, /**< Do uppercase. */
|
||||
TidyUppercasePreserve /**< Preserve case. */
|
||||
} TidyUppercase;
|
||||
|
||||
|
||||
/** @}
|
||||
** @name Document Tree
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -824,15 +824,15 @@ static const Attribute* attrsLookup(TidyDocImpl* doc,
|
|||
|
||||
#if ATTRIBUTE_HASH_LOOKUP
|
||||
for (p = attribs->hashtab[attrsHash(atnam)]; p && p->attr; p = p->next)
|
||||
if (TY_(tmbstrcmp)(atnam, p->attr->name) == 0)
|
||||
if (TY_(tmbstrcasecmp)(atnam, p->attr->name) == 0)
|
||||
return p->attr;
|
||||
|
||||
for (np = attribute_defs; np && np->name; ++np)
|
||||
if (TY_(tmbstrcmp)(atnam, np->name) == 0)
|
||||
if (TY_(tmbstrcasecmp)(atnam, np->name) == 0)
|
||||
return attrsInstall(doc, attribs, np);
|
||||
#else
|
||||
for (np = attribute_defs; np && np->name; ++np)
|
||||
if (TY_(tmbstrcmp)(atnam, np->name) == 0)
|
||||
if (TY_(tmbstrcasecmp)(atnam, np->name) == 0)
|
||||
return np;
|
||||
#endif
|
||||
|
||||
|
|
12
src/config.c
12
src/config.c
|
@ -138,6 +138,14 @@ static PickListItems customTagsPicks = {
|
|||
{ NULL }
|
||||
};
|
||||
|
||||
static PickListItems attributeCasePicks = {
|
||||
{ "no", TidyUppercaseNo, { "0", "n", "f", "no", "false", NULL } },
|
||||
{ "yes", TidyUppercaseYes, { "1", "y", "t", "yes", "true", NULL } },
|
||||
{ "preserve", TidyUppercasePreserve, { "preserve", NULL } },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define MU TidyMarkup
|
||||
#define DG TidyDiagnostics
|
||||
|
@ -284,7 +292,7 @@ static const TidyOptionImpl option_defs[] =
|
|||
{ TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParsePickList, &sorterPicks },
|
||||
{ TidyStrictTagsAttr, MU, "strict-tags-attributes", BL, no, ParsePickList, &boolPicks }, /* 20160209 - Issue #350 */
|
||||
{ TidyTabSize, PP, "tab-size", IN, 8, ParseInt, NULL },
|
||||
{ TidyUpperCaseAttrs, MU, "uppercase-attributes", BL, no, ParsePickList, &boolPicks },
|
||||
{ TidyUpperCaseAttrs, MU, "uppercase-attributes", IN, TidyUppercaseNo, ParsePickList, &attributeCasePicks },
|
||||
{ TidyUpperCaseTags, MU, "uppercase-tags", BL, no, ParsePickList, &boolPicks },
|
||||
{ TidyUseCustomTags, MU, "custom-tags", IN, TidyCustomNo, ParsePickList, &customTagsPicks }, /* 20170309 - Issue #119 */
|
||||
{ TidyVertSpace, PP, "vertical-space", IN, no, ParsePickList, &autoBoolPicks }, /* #228 - tri option */
|
||||
|
@ -1026,7 +1034,7 @@ void AdjustConfig( TidyDocImpl* doc )
|
|||
{
|
||||
TY_(SetOptionBool)( doc, TidyXmlOut, yes );
|
||||
TY_(SetOptionBool)( doc, TidyUpperCaseTags, no );
|
||||
TY_(SetOptionBool)( doc, TidyUpperCaseAttrs, no );
|
||||
TY_(SetOptionInt)( doc, TidyUpperCaseAttrs, no );
|
||||
/* TY_(SetOptionBool)( doc, TidyXmlPIs, yes ); */
|
||||
}
|
||||
|
||||
|
|
|
@ -1202,8 +1202,12 @@ static languageDefinition language_en = { whichPluralForm_en, {
|
|||
"This option specifies if Tidy should output attribute names in upper "
|
||||
"case. "
|
||||
"<br/>"
|
||||
"The default is <var>no</var>, which results in lower case attribute "
|
||||
"names, except for XML input, where the original case is preserved. "
|
||||
"When set to <var>no</var>, attribute names will be written in lower "
|
||||
"case. Specifying <var>yes</var> will output attribute names in upper "
|
||||
"case, and <var>preserve</var> can used to leave attribute names "
|
||||
"untouched. "
|
||||
"<br/>"
|
||||
"When using XML input, the original case is always preserved. "
|
||||
},
|
||||
{/* Important notes for translators:
|
||||
- Use only <code></code>, <var></var>, <em></em>, <strong></strong>, and
|
||||
|
|
1288
src/language_fr.h
1288
src/language_fr.h
File diff suppressed because it is too large
Load diff
|
@ -3742,8 +3742,11 @@ static tmbstr ParseAttribute( TidyDocImpl* doc, Bool *isempty,
|
|||
/* what should be done about non-namechar characters? */
|
||||
/* currently these are incorporated into the attr name */
|
||||
|
||||
if ( cfg(doc, TidyUpperCaseAttrs) != TidyUppercasePreserve )
|
||||
{
|
||||
if ( !cfgBool(doc, TidyXmlTags) && TY_(IsUpper)(c) )
|
||||
c = TY_(ToLower)(c);
|
||||
}
|
||||
|
||||
TY_(AddCharToLexer)( lexer, c );
|
||||
lastc = c;
|
||||
|
|
|
@ -4833,7 +4833,7 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
|
|||
if ( !htmlOut )
|
||||
{
|
||||
TY_(SetOptionBool)( doc, TidyUpperCaseTags, no );
|
||||
TY_(SetOptionBool)( doc, TidyUpperCaseAttrs, no );
|
||||
TY_(SetOptionInt)( doc, TidyUpperCaseAttrs, no );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
src/pprint.c
12
src/pprint.c
|
@ -1238,7 +1238,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
|
|||
Bool xmlOut = cfgBool( doc, TidyXmlOut );
|
||||
Bool xhtmlOut = cfgBool( doc, TidyXhtmlOut );
|
||||
Bool wrapAttrs = cfgBool( doc, TidyWrapAttVals );
|
||||
Bool ucAttrs = cfgBool( doc, TidyUpperCaseAttrs );
|
||||
uint ucAttrs = cfg( doc, TidyUpperCaseAttrs );
|
||||
Bool indAttrs = cfgBool( doc, TidyIndentAttributes );
|
||||
uint xtra = AttrIndent( doc, node, attr );
|
||||
Bool first = AttrNoIndentFirst( /*doc,*/ node, attr );
|
||||
|
@ -1287,7 +1287,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
|
|||
|
||||
if (c > 0x7F)
|
||||
name += TY_(GetUTF8)(name, &c);
|
||||
else if (ucAttrs)
|
||||
else if (ucAttrs == TidyUppercaseYes)
|
||||
c = TY_(ToUpper)(c);
|
||||
|
||||
AddChar(pprint, c);
|
||||
|
@ -1734,8 +1734,8 @@ static void PPrintXmlDecl( TidyDocImpl* doc, uint indent, Node *node )
|
|||
saveWrap = WrapOff( doc );
|
||||
|
||||
/* no case translation for XML declaration pseudo attributes */
|
||||
ucAttrs = cfgBool(doc, TidyUpperCaseAttrs);
|
||||
TY_(SetOptionBool)(doc, TidyUpperCaseAttrs, no);
|
||||
ucAttrs = cfg(doc, TidyUpperCaseAttrs);
|
||||
TY_(SetOptionInt)(doc, TidyUpperCaseAttrs, no);
|
||||
|
||||
AddString( pprint, "<?xml" );
|
||||
|
||||
|
@ -1749,7 +1749,7 @@ static void PPrintXmlDecl( TidyDocImpl* doc, uint indent, Node *node )
|
|||
PPrintAttribute( doc, indent, node, att );
|
||||
|
||||
/* restore old config value */
|
||||
TY_(SetOptionBool)(doc, TidyUpperCaseAttrs, ucAttrs);
|
||||
TY_(SetOptionInt)(doc, TidyUpperCaseAttrs, ucAttrs);
|
||||
|
||||
if ( node->end <= 0 || doc->lexer->lexbuf[node->end - 1] != '?' )
|
||||
AddChar( pprint, '?' );
|
||||
|
@ -1935,6 +1935,8 @@ static Bool TY_(nodeIsTextLike)( Node *node )
|
|||
return yes;
|
||||
if ( node->type == AspTag )
|
||||
return yes;
|
||||
if (node->type == PhpTag)
|
||||
return yes; /* Issue #392 */
|
||||
/* add other text like nodes... */
|
||||
return no;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
5.5.24
|
||||
2017.05.13
|
||||
5.5.28
|
||||
2017.05.27
|
||||
|
|
Loading…
Reference in a new issue