Merge branch 'next' into issue-395

This commit is contained in:
Geoff McLane 2017-05-27 18:20:28 +02:00
commit c61b5b7b0c
11 changed files with 2002 additions and 1063 deletions

View file

@ -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. ** @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; TidyIterator pos;
ctmbstr def;
if ( tidyOptGetType( topt ) != TidyInteger) if ( tidyOptGetType( topt ) != TidyInteger)
return no; return no;
pos = tidyOptGetPickList( topt ); pos = tidyOptGetPickList( topt );
while ( pos )
{ return tidyOptGetNextPick( topt, &pos ) != NULL;
def = tidyOptGetNextPick( topt, &pos );
if (0==strcmp(def,"yes"))
return yes;
}
return no;
} }
/** Returns the configuration category name for the specified configuration /** 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. */ /* Handle special cases first. */
switch ( optId ) 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: case TidyDoctype:
d->type = "DocType"; d->type = "DocType";
d->vals = NULL; d->vals = NULL;
@ -576,16 +560,16 @@ static void GetOption(TidyDoc tdoc, /**< The tidy document. */
d->def = sdef; d->def = sdef;
} }
break; break;
case TidyInlineTags: case TidyInlineTags:
case TidyBlockTags: case TidyBlockTags:
case TidyEmptyTags: case TidyEmptyTags:
case TidyPreTags: case TidyPreTags:
d->type = "Tag names"; d->type = "Tag Names";
d->vals = "tagX, tagY, ..."; d->vals = "tagX, tagY, ...";
d->def = NULL; d->def = NULL;
break; break;
case TidyCharEncoding: case TidyCharEncoding:
case TidyInCharEncoding: case TidyInCharEncoding:
case TidyOutCharEncoding: case TidyOutCharEncoding:
@ -602,15 +586,13 @@ static void GetOption(TidyDoc tdoc, /**< The tidy document. */
{ {
case TidyBoolean: case TidyBoolean:
d->type = "Boolean"; d->type = "Boolean";
d->vals = "y/n, yes/no, t/f, true/false, 1/0";
d->def = tidyOptGetCurrPick( tdoc, optId ); d->def = tidyOptGetCurrPick( tdoc, optId );
break; break;
case TidyInteger: case TidyInteger:
if (isAutoBool(topt)) if (hasPickList(topt))
{ {
d->type = "AutoBool"; d->type = "Enum";
d->vals = "auto, y/n, yes/no, t/f, true/false, 1/0";
d->def = tidyOptGetCurrPick( tdoc, optId ); d->def = tidyOptGetCurrPick( tdoc, optId );
} }
else else
@ -621,13 +603,13 @@ static void GetOption(TidyDoc tdoc, /**< The tidy document. */
d->vals = "0 (no wrapping), 1, 2, ..."; d->vals = "0 (no wrapping), 1, 2, ...";
else else
d->vals = "0, 1, 2, ..."; d->vals = "0, 1, 2, ...";
idef = tidyOptGetInt( tdoc, optId ); idef = tidyOptGetInt( tdoc, optId );
sprintf(d->tempdefs, "%u", idef); sprintf(d->tempdefs, "%u", idef);
d->def = d->tempdefs; d->def = d->tempdefs;
} }
break; break;
case TidyString: case TidyString:
d->type = "String"; d->type = "String";
d->vals = NULL; d->vals = NULL;

View file

@ -787,6 +787,16 @@ typedef enum
TidySortAttrAlpha /**< Sort attributes alphabetically */ TidySortAttrAlpha /**< Sort attributes alphabetically */
} TidyAttrSortStrategy; } 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 ** @name Document Tree

File diff suppressed because it is too large Load diff

View file

@ -824,15 +824,15 @@ static const Attribute* attrsLookup(TidyDocImpl* doc,
#if ATTRIBUTE_HASH_LOOKUP #if ATTRIBUTE_HASH_LOOKUP
for (p = attribs->hashtab[attrsHash(atnam)]; p && p->attr; p = p->next) 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; return p->attr;
for (np = attribute_defs; np && np->name; ++np) 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); return attrsInstall(doc, attribs, np);
#else #else
for (np = attribute_defs; np && np->name; ++np) for (np = attribute_defs; np && np->name; ++np)
if (TY_(tmbstrcmp)(atnam, np->name) == 0) if (TY_(tmbstrcasecmp)(atnam, np->name) == 0)
return np; return np;
#endif #endif

View file

@ -138,6 +138,14 @@ static PickListItems customTagsPicks = {
{ NULL } { 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 MU TidyMarkup
#define DG TidyDiagnostics #define DG TidyDiagnostics
@ -198,113 +206,113 @@ static ParseProperty ParsePickList;
/* Ensure struct order is same order as tidyenum.h:TidyOptionId! */ /* Ensure struct order is same order as tidyenum.h:TidyOptionId! */
static const TidyOptionImpl option_defs[] = static const TidyOptionImpl option_defs[] =
{ {
{ TidyUnknownOption, MS, "unknown!", IN, 0, NULL, NULL }, { TidyUnknownOption, MS, "unknown!", IN, 0, NULL, NULL },
{ TidyAccessibilityCheckLevel, DG, "accessibility-check", IN, 0, ParseAcc, &accessPicks }, { TidyAccessibilityCheckLevel, DG, "accessibility-check", IN, 0, ParseAcc, &accessPicks },
{ TidyAltText, MU, "alt-text", ST, 0, ParseString, NULL }, { TidyAltText, MU, "alt-text", ST, 0, ParseString, NULL },
{ TidyAnchorAsName, MU, "anchor-as-name", BL, yes, ParsePickList, &boolPicks }, { TidyAnchorAsName, MU, "anchor-as-name", BL, yes, ParsePickList, &boolPicks },
{ TidyAsciiChars, CE, "ascii-chars", BL, no, ParsePickList, &boolPicks }, { TidyAsciiChars, CE, "ascii-chars", BL, no, ParsePickList, &boolPicks },
{ TidyBlockTags, MU, "new-blocklevel-tags", ST, 0, ParseTagNames, NULL }, { TidyBlockTags, MU, "new-blocklevel-tags", ST, 0, ParseTagNames, NULL },
{ TidyBodyOnly, MU, "show-body-only", IN, no, ParsePickList, &autoBoolPicks }, { TidyBodyOnly, MU, "show-body-only", IN, no, ParsePickList, &autoBoolPicks },
{ TidyBreakBeforeBR, PP, "break-before-br", BL, no, ParsePickList, &boolPicks }, { TidyBreakBeforeBR, PP, "break-before-br", BL, no, ParsePickList, &boolPicks },
{ TidyCharEncoding, CE, "char-encoding", IN, UTF8, ParseCharEnc, &charEncPicks }, { TidyCharEncoding, CE, "char-encoding", IN, UTF8, ParseCharEnc, &charEncPicks },
{ TidyCoerceEndTags, MU, "coerce-endtags", BL, yes, ParsePickList, &boolPicks }, { TidyCoerceEndTags, MU, "coerce-endtags", BL, yes, ParsePickList, &boolPicks },
{ TidyCSSPrefix, MU, "css-prefix", ST, 0, ParseCSS1Selector, NULL }, { TidyCSSPrefix, MU, "css-prefix", ST, 0, ParseCSS1Selector, NULL },
{ TidyCustomTags, IR, "new-custom-tags", ST, 0, ParseTagNames, NULL }, /* 20170309 - Issue #119 */ { TidyCustomTags, IR, "new-custom-tags", ST, 0, ParseTagNames, NULL }, /* 20170309 - Issue #119 */
{ TidyDecorateInferredUL, MU, "decorate-inferred-ul", BL, no, ParsePickList, &boolPicks }, { TidyDecorateInferredUL, MU, "decorate-inferred-ul", BL, no, ParsePickList, &boolPicks },
{ TidyDoctype, MU, "doctype", ST, 0, ParseDocType, &doctypePicks }, { TidyDoctype, MU, "doctype", ST, 0, ParseDocType, &doctypePicks },
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
{ TidyDoctypeMode, IR, "doctype-mode", IN, TidyDoctypeAuto, NULL, &doctypePicks }, { TidyDoctypeMode, IR, "doctype-mode", IN, TidyDoctypeAuto, NULL, &doctypePicks },
#endif #endif
{ TidyDropEmptyElems, MU, "drop-empty-elements", BL, yes, ParsePickList, &boolPicks }, { TidyDropEmptyElems, MU, "drop-empty-elements", BL, yes, ParsePickList, &boolPicks },
{ TidyDropEmptyParas, MU, "drop-empty-paras", BL, yes, ParsePickList, &boolPicks }, { TidyDropEmptyParas, MU, "drop-empty-paras", BL, yes, ParsePickList, &boolPicks },
{ TidyDropPropAttrs, MU, "drop-proprietary-attributes", BL, no, ParsePickList, &boolPicks }, { TidyDropPropAttrs, MU, "drop-proprietary-attributes", BL, no, ParsePickList, &boolPicks },
{ TidyDuplicateAttrs, MU, "repeated-attributes", IN, TidyKeepLast, ParsePickList, &repeatAttrPicks }, { TidyDuplicateAttrs, MU, "repeated-attributes", IN, TidyKeepLast, ParsePickList, &repeatAttrPicks },
{ TidyEmacs, MS, "gnu-emacs", BL, no, ParsePickList, &boolPicks }, { TidyEmacs, MS, "gnu-emacs", BL, no, ParsePickList, &boolPicks },
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
{ TidyEmacsFile, IR, "gnu-emacs-file", ST, 0, ParseString, NULL }, { TidyEmacsFile, IR, "gnu-emacs-file", ST, 0, ParseString, NULL },
#endif #endif
{ TidyEmptyTags, MU, "new-empty-tags", ST, 0, ParseTagNames, NULL }, { TidyEmptyTags, MU, "new-empty-tags", ST, 0, ParseTagNames, NULL },
{ TidyEncloseBlockText, MU, "enclose-block-text", BL, no, ParsePickList, &boolPicks }, { TidyEncloseBlockText, MU, "enclose-block-text", BL, no, ParsePickList, &boolPicks },
{ TidyEncloseBodyText, MU, "enclose-text", BL, no, ParsePickList, &boolPicks }, { TidyEncloseBodyText, MU, "enclose-text", BL, no, ParsePickList, &boolPicks },
{ TidyErrFile, MS, "error-file", ST, 0, ParseString, NULL }, { TidyErrFile, MS, "error-file", ST, 0, ParseString, NULL },
{ TidyEscapeCdata, MU, "escape-cdata", BL, no, ParsePickList, &boolPicks }, { TidyEscapeCdata, MU, "escape-cdata", BL, no, ParsePickList, &boolPicks },
{ TidyEscapeScripts, PP, "escape-scripts", BL, yes, ParsePickList, &boolPicks }, /* 20160227 - Issue #348 */ { TidyEscapeScripts, PP, "escape-scripts", BL, yes, ParsePickList, &boolPicks }, /* 20160227 - Issue #348 */
{ TidyFixBackslash, MU, "fix-backslash", BL, yes, ParsePickList, &boolPicks }, { TidyFixBackslash, MU, "fix-backslash", BL, yes, ParsePickList, &boolPicks },
{ TidyFixComments, MU, "fix-bad-comments", BL, yes, ParsePickList, &boolPicks }, { TidyFixComments, MU, "fix-bad-comments", BL, yes, ParsePickList, &boolPicks },
{ TidyFixUri, MU, "fix-uri", BL, yes, ParsePickList, &boolPicks }, { TidyFixUri, MU, "fix-uri", BL, yes, ParsePickList, &boolPicks },
{ TidyForceOutput, MS, "force-output", BL, no, ParsePickList, &boolPicks }, { TidyForceOutput, MS, "force-output", BL, no, ParsePickList, &boolPicks },
{ TidyGDocClean, MU, "gdoc", BL, no, ParsePickList, &boolPicks }, { TidyGDocClean, MU, "gdoc", BL, no, ParsePickList, &boolPicks },
{ TidyHideComments, MU, "hide-comments", BL, no, ParsePickList, &boolPicks }, { TidyHideComments, MU, "hide-comments", BL, no, ParsePickList, &boolPicks },
{ TidyHtmlOut, MU, "output-html", BL, no, ParsePickList, &boolPicks }, { TidyHtmlOut, MU, "output-html", BL, no, ParsePickList, &boolPicks },
{ TidyInCharEncoding, CE, "input-encoding", IN, UTF8, ParseCharEnc, &charEncPicks }, { TidyInCharEncoding, CE, "input-encoding", IN, UTF8, ParseCharEnc, &charEncPicks },
{ TidyIndentAttributes, PP, "indent-attributes", BL, no, ParsePickList, &boolPicks }, { TidyIndentAttributes, PP, "indent-attributes", BL, no, ParsePickList, &boolPicks },
{ TidyIndentCdata, MU, "indent-cdata", BL, no, ParsePickList, &boolPicks }, { TidyIndentCdata, MU, "indent-cdata", BL, no, ParsePickList, &boolPicks },
{ TidyIndentContent, PP, "indent", IN, TidyNoState, ParsePickList, &autoBoolPicks }, { TidyIndentContent, PP, "indent", IN, TidyNoState, ParsePickList, &autoBoolPicks },
{ TidyIndentSpaces, PP, "indent-spaces", IN, 2, ParseInt, NULL }, { TidyIndentSpaces, PP, "indent-spaces", IN, 2, ParseInt, NULL },
{ TidyInlineTags, MU, "new-inline-tags", ST, 0, ParseTagNames, NULL }, { TidyInlineTags, MU, "new-inline-tags", ST, 0, ParseTagNames, NULL },
{ TidyJoinClasses, MU, "join-classes", BL, no, ParsePickList, &boolPicks }, { TidyJoinClasses, MU, "join-classes", BL, no, ParsePickList, &boolPicks },
{ TidyJoinStyles, MU, "join-styles", BL, yes, ParsePickList, &boolPicks }, { TidyJoinStyles, MU, "join-styles", BL, yes, ParsePickList, &boolPicks },
{ TidyKeepFileTimes, MS, "keep-time", BL, no, ParsePickList, &boolPicks }, { TidyKeepFileTimes, MS, "keep-time", BL, no, ParsePickList, &boolPicks },
{ TidyLiteralAttribs, MU, "literal-attributes", BL, no, ParsePickList, &boolPicks }, { TidyLiteralAttribs, MU, "literal-attributes", BL, no, ParsePickList, &boolPicks },
{ TidyLogicalEmphasis, MU, "logical-emphasis", BL, no, ParsePickList, &boolPicks }, { TidyLogicalEmphasis, MU, "logical-emphasis", BL, no, ParsePickList, &boolPicks },
{ TidyLowerLiterals, MU, "lower-literals", BL, yes, ParsePickList, &boolPicks }, { TidyLowerLiterals, MU, "lower-literals", BL, yes, ParsePickList, &boolPicks },
{ TidyMakeBare, MU, "bare", BL, no, ParsePickList, &boolPicks }, { TidyMakeBare, MU, "bare", BL, no, ParsePickList, &boolPicks },
{ TidyMakeClean, MU, "clean", BL, no, ParsePickList, &boolPicks }, { TidyMakeClean, MU, "clean", BL, no, ParsePickList, &boolPicks },
{ TidyMark, MS, "tidy-mark", BL, yes, ParsePickList, &boolPicks }, { TidyMark, MS, "tidy-mark", BL, yes, ParsePickList, &boolPicks },
{ TidyMergeDivs, MU, "merge-divs", IN, TidyAutoState, ParsePickList, &autoBoolPicks }, { TidyMergeDivs, MU, "merge-divs", IN, TidyAutoState, ParsePickList, &autoBoolPicks },
{ TidyMergeEmphasis, MU, "merge-emphasis", BL, yes, ParsePickList, &boolPicks }, { TidyMergeEmphasis, MU, "merge-emphasis", BL, yes, ParsePickList, &boolPicks },
{ TidyMergeSpans, MU, "merge-spans", IN, TidyAutoState, ParsePickList, &autoBoolPicks }, { TidyMergeSpans, MU, "merge-spans", IN, TidyAutoState, ParsePickList, &autoBoolPicks },
#if SUPPORT_ASIAN_ENCODINGS #if SUPPORT_ASIAN_ENCODINGS
{ TidyNCR, MU, "ncr", BL, yes, ParsePickList, &boolPicks }, { TidyNCR, MU, "ncr", BL, yes, ParsePickList, &boolPicks },
#endif #endif
{ TidyNewline, CE, "newline", IN, DLF, ParsePickList, &newlinePicks }, { TidyNewline, CE, "newline", IN, DLF, ParsePickList, &newlinePicks },
{ TidyNumEntities, MU, "numeric-entities", BL, no, ParsePickList, &boolPicks }, { TidyNumEntities, MU, "numeric-entities", BL, no, ParsePickList, &boolPicks },
{ TidyOmitOptionalTags, MU, "omit-optional-tags", BL, no, ParsePickList, &boolPicks }, { TidyOmitOptionalTags, MU, "omit-optional-tags", BL, no, ParsePickList, &boolPicks },
{ TidyOutCharEncoding, CE, "output-encoding", IN, UTF8, ParseCharEnc, &charEncPicks }, { TidyOutCharEncoding, CE, "output-encoding", IN, UTF8, ParseCharEnc, &charEncPicks },
{ TidyOutFile, MS, "output-file", ST, 0, ParseString, NULL }, { TidyOutFile, MS, "output-file", ST, 0, ParseString, NULL },
#if SUPPORT_UTF16_ENCODINGS #if SUPPORT_UTF16_ENCODINGS
{ TidyOutputBOM, CE, "output-bom", IN, TidyAutoState, ParsePickList, &autoBoolPicks }, { TidyOutputBOM, CE, "output-bom", IN, TidyAutoState, ParsePickList, &autoBoolPicks },
#endif #endif
{ TidyPPrintTabs, PP, "indent-with-tabs", BL, no, ParseTabs, &boolPicks }, /* 20150515 - Issue #108 */ { TidyPPrintTabs, PP, "indent-with-tabs", BL, no, ParseTabs, &boolPicks }, /* 20150515 - Issue #108 */
{ TidyPreserveEntities, MU, "preserve-entities", BL, no, ParsePickList, &boolPicks }, { TidyPreserveEntities, MU, "preserve-entities", BL, no, ParsePickList, &boolPicks },
{ TidyPreTags, MU, "new-pre-tags", ST, 0, ParseTagNames, NULL }, { TidyPreTags, MU, "new-pre-tags", ST, 0, ParseTagNames, NULL },
#if SUPPORT_ASIAN_ENCODINGS #if SUPPORT_ASIAN_ENCODINGS
{ TidyPunctWrap, PP, "punctuation-wrap", BL, no, ParsePickList, &boolPicks }, { TidyPunctWrap, PP, "punctuation-wrap", BL, no, ParsePickList, &boolPicks },
#endif #endif
{ TidyQuiet, MS, "quiet", BL, no, ParsePickList, &boolPicks }, { TidyQuiet, MS, "quiet", BL, no, ParsePickList, &boolPicks },
{ TidyQuoteAmpersand, MU, "quote-ampersand", BL, yes, ParsePickList, &boolPicks }, { TidyQuoteAmpersand, MU, "quote-ampersand", BL, yes, ParsePickList, &boolPicks },
{ TidyQuoteMarks, MU, "quote-marks", BL, no, ParsePickList, &boolPicks }, { TidyQuoteMarks, MU, "quote-marks", BL, no, ParsePickList, &boolPicks },
{ TidyQuoteNbsp, MU, "quote-nbsp", BL, yes, ParsePickList, &boolPicks }, { TidyQuoteNbsp, MU, "quote-nbsp", BL, yes, ParsePickList, &boolPicks },
{ TidyReplaceColor, MU, "replace-color", BL, no, ParsePickList, &boolPicks }, { TidyReplaceColor, MU, "replace-color", BL, no, ParsePickList, &boolPicks },
{ TidyShowErrors, DG, "show-errors", IN, 6, ParseInt, NULL }, { TidyShowErrors, DG, "show-errors", IN, 6, ParseInt, NULL },
{ TidyShowInfo, DG, "show-info", BL, yes, ParsePickList, &boolPicks }, { TidyShowInfo, DG, "show-info", BL, yes, ParsePickList, &boolPicks },
{ TidyShowMarkup, PP, "markup", BL, yes, ParsePickList, &boolPicks }, { TidyShowMarkup, PP, "markup", BL, yes, ParsePickList, &boolPicks },
{ TidyShowWarnings, DG, "show-warnings", BL, yes, ParsePickList, &boolPicks }, { TidyShowWarnings, DG, "show-warnings", BL, yes, ParsePickList, &boolPicks },
{ TidySkipNested, MU, "skip-nested", BL, yes, ParsePickList, &boolPicks }, /* 1642186 - Issue #65 */ { TidySkipNested, MU, "skip-nested", BL, yes, ParsePickList, &boolPicks }, /* 1642186 - Issue #65 */
{ TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParsePickList, &sorterPicks }, { TidySortAttributes, PP, "sort-attributes", IN, TidySortAttrNone,ParsePickList, &sorterPicks },
{ TidyStrictTagsAttr, MU, "strict-tags-attributes", BL, no, ParsePickList, &boolPicks }, /* 20160209 - Issue #350 */ { TidyStrictTagsAttr, MU, "strict-tags-attributes", BL, no, ParsePickList, &boolPicks }, /* 20160209 - Issue #350 */
{ TidyTabSize, PP, "tab-size", IN, 8, ParseInt, NULL }, { 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 }, { TidyUpperCaseTags, MU, "uppercase-tags", BL, no, ParsePickList, &boolPicks },
{ TidyUseCustomTags, MU, "custom-tags", IN, TidyCustomNo, ParsePickList, &customTagsPicks }, /* 20170309 - Issue #119 */ { TidyUseCustomTags, MU, "custom-tags", IN, TidyCustomNo, ParsePickList, &customTagsPicks }, /* 20170309 - Issue #119 */
{ TidyVertSpace, PP, "vertical-space", IN, no, ParsePickList, &autoBoolPicks }, /* #228 - tri option */ { TidyVertSpace, PP, "vertical-space", IN, no, ParsePickList, &autoBoolPicks }, /* #228 - tri option */
{ TidyWarnPropAttrs, MU, "warn-proprietary-attributes", BL, yes, ParsePickList, &boolPicks }, { TidyWarnPropAttrs, MU, "warn-proprietary-attributes", BL, yes, ParsePickList, &boolPicks },
{ TidyWord2000, MU, "word-2000", BL, no, ParsePickList, &boolPicks }, { TidyWord2000, MU, "word-2000", BL, no, ParsePickList, &boolPicks },
{ TidyWrapAsp, PP, "wrap-asp", BL, yes, ParsePickList, &boolPicks }, { TidyWrapAsp, PP, "wrap-asp", BL, yes, ParsePickList, &boolPicks },
{ TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParsePickList, &boolPicks }, { TidyWrapAttVals, PP, "wrap-attributes", BL, no, ParsePickList, &boolPicks },
{ TidyWrapJste, PP, "wrap-jste", BL, yes, ParsePickList, &boolPicks }, { TidyWrapJste, PP, "wrap-jste", BL, yes, ParsePickList, &boolPicks },
{ TidyWrapLen, PP, "wrap", IN, 68, ParseInt, NULL }, { TidyWrapLen, PP, "wrap", IN, 68, ParseInt, NULL },
{ TidyWrapPhp, PP, "wrap-php", BL, yes, ParsePickList, &boolPicks }, { TidyWrapPhp, PP, "wrap-php", BL, yes, ParsePickList, &boolPicks },
{ TidyWrapScriptlets, PP, "wrap-script-literals", BL, no, ParsePickList, &boolPicks }, { TidyWrapScriptlets, PP, "wrap-script-literals", BL, no, ParsePickList, &boolPicks },
{ TidyWrapSection, PP, "wrap-sections", BL, yes, ParsePickList, &boolPicks }, { TidyWrapSection, PP, "wrap-sections", BL, yes, ParsePickList, &boolPicks },
{ TidyWriteBack, MS, "write-back", BL, no, ParsePickList, &boolPicks }, { TidyWriteBack, MS, "write-back", BL, no, ParsePickList, &boolPicks },
{ TidyXhtmlOut, MU, "output-xhtml", BL, no, ParsePickList, &boolPicks }, { TidyXhtmlOut, MU, "output-xhtml", BL, no, ParsePickList, &boolPicks },
{ TidyXmlDecl, MU, "add-xml-decl", BL, no, ParsePickList, &boolPicks }, { TidyXmlDecl, MU, "add-xml-decl", BL, no, ParsePickList, &boolPicks },
{ TidyXmlOut, MU, "output-xml", BL, no, ParsePickList, &boolPicks }, { TidyXmlOut, MU, "output-xml", BL, no, ParsePickList, &boolPicks },
{ TidyXmlPIs, MU, "assume-xml-procins", BL, no, ParsePickList, &boolPicks }, { TidyXmlPIs, MU, "assume-xml-procins", BL, no, ParsePickList, &boolPicks },
{ 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 },
{ N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL } { N_TIDY_OPTIONS, XX, NULL, XY, 0, NULL, NULL }
}; };
@ -1026,7 +1034,7 @@ void AdjustConfig( TidyDocImpl* doc )
{ {
TY_(SetOptionBool)( doc, TidyXmlOut, yes ); TY_(SetOptionBool)( doc, TidyXmlOut, yes );
TY_(SetOptionBool)( doc, TidyUpperCaseTags, no ); TY_(SetOptionBool)( doc, TidyUpperCaseTags, no );
TY_(SetOptionBool)( doc, TidyUpperCaseAttrs, no ); TY_(SetOptionInt)( doc, TidyUpperCaseAttrs, no );
/* TY_(SetOptionBool)( doc, TidyXmlPIs, yes ); */ /* TY_(SetOptionBool)( doc, TidyXmlPIs, yes ); */
} }

View file

@ -1202,8 +1202,12 @@ static languageDefinition language_en = { whichPluralForm_en, {
"This option specifies if Tidy should output attribute names in upper " "This option specifies if Tidy should output attribute names in upper "
"case. " "case. "
"<br/>" "<br/>"
"The default is <var>no</var>, which results in lower case attribute " "When set to <var>no</var>, attribute names will be written in lower "
"names, except for XML input, where the original case is preserved. " "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: {/* 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

File diff suppressed because it is too large Load diff

View file

@ -3742,8 +3742,11 @@ static tmbstr ParseAttribute( TidyDocImpl* doc, Bool *isempty,
/* what should be done about non-namechar characters? */ /* what should be done about non-namechar characters? */
/* currently these are incorporated into the attr name */ /* currently these are incorporated into the attr name */
if ( !cfgBool(doc, TidyXmlTags) && TY_(IsUpper)(c) ) if ( cfg(doc, TidyUpperCaseAttrs) != TidyUppercasePreserve )
c = TY_(ToLower)(c); {
if ( !cfgBool(doc, TidyXmlTags) && TY_(IsUpper)(c) )
c = TY_(ToLower)(c);
}
TY_(AddCharToLexer)( lexer, c ); TY_(AddCharToLexer)( lexer, c );
lastc = c; lastc = c;

View file

@ -4833,7 +4833,7 @@ void TY_(ParseDocument)(TidyDocImpl* doc)
if ( !htmlOut ) if ( !htmlOut )
{ {
TY_(SetOptionBool)( doc, TidyUpperCaseTags, no ); TY_(SetOptionBool)( doc, TidyUpperCaseTags, no );
TY_(SetOptionBool)( doc, TidyUpperCaseAttrs, no ); TY_(SetOptionInt)( doc, TidyUpperCaseAttrs, no );
} }
} }
} }

View file

@ -1238,7 +1238,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
Bool xmlOut = cfgBool( doc, TidyXmlOut ); Bool xmlOut = cfgBool( doc, TidyXmlOut );
Bool xhtmlOut = cfgBool( doc, TidyXhtmlOut ); Bool xhtmlOut = cfgBool( doc, TidyXhtmlOut );
Bool wrapAttrs = cfgBool( doc, TidyWrapAttVals ); Bool wrapAttrs = cfgBool( doc, TidyWrapAttVals );
Bool ucAttrs = cfgBool( doc, TidyUpperCaseAttrs ); uint ucAttrs = cfg( doc, TidyUpperCaseAttrs );
Bool indAttrs = cfgBool( doc, TidyIndentAttributes ); Bool indAttrs = cfgBool( doc, TidyIndentAttributes );
uint xtra = AttrIndent( doc, node, attr ); uint xtra = AttrIndent( doc, node, attr );
Bool first = AttrNoIndentFirst( /*doc,*/ node, attr ); Bool first = AttrNoIndentFirst( /*doc,*/ node, attr );
@ -1287,7 +1287,7 @@ static void PPrintAttribute( TidyDocImpl* doc, uint indent,
if (c > 0x7F) if (c > 0x7F)
name += TY_(GetUTF8)(name, &c); name += TY_(GetUTF8)(name, &c);
else if (ucAttrs) else if (ucAttrs == TidyUppercaseYes)
c = TY_(ToUpper)(c); c = TY_(ToUpper)(c);
AddChar(pprint, c); AddChar(pprint, c);
@ -1734,8 +1734,8 @@ static void PPrintXmlDecl( TidyDocImpl* doc, uint indent, Node *node )
saveWrap = WrapOff( doc ); saveWrap = WrapOff( doc );
/* no case translation for XML declaration pseudo attributes */ /* no case translation for XML declaration pseudo attributes */
ucAttrs = cfgBool(doc, TidyUpperCaseAttrs); ucAttrs = cfg(doc, TidyUpperCaseAttrs);
TY_(SetOptionBool)(doc, TidyUpperCaseAttrs, no); TY_(SetOptionInt)(doc, TidyUpperCaseAttrs, no);
AddString( pprint, "<?xml" ); AddString( pprint, "<?xml" );
@ -1749,7 +1749,7 @@ static void PPrintXmlDecl( TidyDocImpl* doc, uint indent, Node *node )
PPrintAttribute( doc, indent, node, att ); PPrintAttribute( doc, indent, node, att );
/* restore old config value */ /* restore old config value */
TY_(SetOptionBool)(doc, TidyUpperCaseAttrs, ucAttrs); TY_(SetOptionInt)(doc, TidyUpperCaseAttrs, ucAttrs);
if ( node->end <= 0 || doc->lexer->lexbuf[node->end - 1] != '?' ) if ( node->end <= 0 || doc->lexer->lexbuf[node->end - 1] != '?' )
AddChar( pprint, '?' ); AddChar( pprint, '?' );
@ -1935,6 +1935,8 @@ static Bool TY_(nodeIsTextLike)( Node *node )
return yes; return yes;
if ( node->type == AspTag ) if ( node->type == AspTag )
return yes; return yes;
if (node->type == PhpTag)
return yes; /* Issue #392 */
/* add other text like nodes... */ /* add other text like nodes... */
return no; return no;
} }

View file

@ -1,2 +1,2 @@
5.5.24 5.5.28
2017.05.13 2017.05.27