From 4dc8a2cf9ac34c6774b5dad8ee4c41f50259f6e7 Mon Sep 17 00:00:00 2001 From: Jim Derry Date: Fri, 10 Mar 2017 08:24:23 -0500 Subject: [PATCH] Bump version to 5.5.5 for this fiasco, and fix poor planning and unfortunate merge. - Sort all of the existing options and re-indent per Tidy standards. This is simply for cosmetic effect. - Allow the iterator to return all options again, even "internal" options. Things are too embedded with N_TIDY_OPTIONS, etc., to try to hide them. - Instead, simply add documentation to LibTidy users that they shouldn't use internal options. - Also added `TidyInternalCategory` to `TidyConfigCategory` without adding a new field to the struct. API users should check for this category before use. - Defined a two character macro for `TidyInternalCategory` for use in `option_defs[]`. - Changed struct `option_defs[]` to reflect the new category for affected options. - Removed string indicating * refers to internal options, since it no longer applies. - Regen'd all strings for previous point. - `tidy.c` now checks for `TidyInternalCategory` everywhere in order to suppress output. --- console/tidy.c | 32 ++-- include/tidy.h | 4 +- include/tidyenum.h | 222 +++++++++++------------- localize/translations/language_en_gb.po | 11 +- localize/translations/language_es.po | 11 +- localize/translations/language_es_mx.po | 11 +- localize/translations/language_fr.po | 11 +- localize/translations/language_zh_cn.po | 11 +- localize/translations/tidy.pot | 11 +- src/config.c | 202 ++++++++++----------- src/language_en.h | 4 +- src/language_en_gb.h | 2 +- src/language_es.h | 2 +- src/language_es_mx.h | 2 +- src/language_fr.h | 2 +- src/language_zh_cn.h | 2 +- version.txt | 4 +- 17 files changed, 260 insertions(+), 284 deletions(-) diff --git a/console/tidy.c b/console/tidy.c index caeb7e9..3ca4dfc 100644 --- a/console/tidy.c +++ b/console/tidy.c @@ -185,7 +185,7 @@ static void print3Columns( const char* fmt, uint l1, uint l2, uint l3, static const char helpfmt[] = " %-25.25s %-52.52s\n"; static const char helpul[] = "-----------------------------------------------------------------"; static const char fmt[] = "%-27.27s %-9.9s %-40.40s\n"; -static const char valfmt[] = "%-27.27s %-9.9s %-1.1s%-39.39s\n"; +static const char valfmt[] = "%-27.27s %-9.9s %-39.39s\n"; static const char ul[] = "================================================================="; /** @@ -558,7 +558,7 @@ static Bool isAutoBool( TidyOption topt ) */ static ctmbstr ConfigCategoryName( TidyConfigCategory id ) { - if (id >= TidyMarkup && id <= TidyMiscellaneous) + if (id >= TidyMarkup && id <= TidyInternalCategory) return tidyLocalizedString(id); fprintf(stderr, tidyLocalizedString(TC_STRING_FATAL_ERROR), (int)id); @@ -575,6 +575,7 @@ static ctmbstr ConfigCategoryName( TidyConfigCategory id ) typedef struct { ctmbstr name; /**< Name */ ctmbstr cat; /**< Category */ + uint catid; /**< Category ID */ ctmbstr type; /**< "String, ... */ ctmbstr vals; /**< Potential values. If NULL, use an external function */ ctmbstr def; /**< default */ @@ -596,6 +597,7 @@ void GetOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d ) d->name = tidyOptGetName( topt ); d->cat = ConfigCategoryName( tidyOptGetCategory( topt ) ); + d->catid = tidyOptGetCategory( topt ); d->vals = NULL; d->def = NULL; d->haveVals = yes; @@ -693,10 +695,6 @@ void GetOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d ) ** Array holding all options. Contains a trailing sentinel. */ typedef struct { - /* Some options aren't exposed in the API although they're available - in the enum. This struct is guaranteed to hold *all* Tidy options, - but be sure to use the public API iterators to access them! - */ TidyOption topt[N_TIDY_OPTIONS]; } AllOption_t; @@ -873,7 +871,7 @@ static void printXMLCrossRefEqConsole( TidyDoc tdoc, TidyOption topt ) **/ static void printXMLOption( TidyDoc tdoc, TidyOption topt, OptionDesc *d ) { - if ( tidyOptIsReadOnly(topt) ) + if ( tidyOptGetCategory(topt) == TidyInternalCategory ) return; printf( "