Skip to content

Commit aeb9a24

Browse files
committed
Refactor Picklists and Option Parsers
This PR refactors how picklists and option parsers are implemented in LibTidy, making is vastly easier to implement new picklists in the future, as well as modify some of the existing picklists such that they have more logical names. Picklist arrays are now arrays of structures that include the possible strings capable of setting a particular option value, and a new parser has been written to work with these structures. In addition, several of the existing parsers were removed, as they are now redundant, and a couple of the remaining parsers were refactored to take advantage of the new parser. In effect, this means that: - New parsers don't have to be written in the majority of cases where new options are added that exceed yes/no/auto. - Some of the existing options can have more meaningful names than yes/no/auto, in a backward compatible way. For example, vertical-spacing "auto" currently in no way reflects "auto" when used.
1 parent 590a030 commit aeb9a24

File tree

4 files changed

+383
-455
lines changed

4 files changed

+383
-455
lines changed

include/tidyenum.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,36 @@ typedef enum
724724
TidyCR /**< Use Macintosh style: CR */
725725
} TidyLineEnding;
726726

727+
728+
/** TidyEncodingOptions option values specify the input and/or output encoding.
729+
** @remark This enum's starting value is guaranteed to remain stable.
730+
*/
731+
typedef enum
732+
{
733+
TidyEncRaw = 0,
734+
TidyEncAscii,
735+
TidyEncLatin0,
736+
TidyEncLatin1,
737+
TidyEncUtf8,
738+
#ifndef NO_NATIVE_ISO2022_SUPPORT
739+
TidyEncIso2022,
740+
#endif
741+
TidyEncMac,
742+
TidyEncWin1252,
743+
TidyEncIbm858,
744+
745+
#if SUPPORT_UTF16_ENCODINGS
746+
TidyEncUtf16le,
747+
TidyEncUtf16be,
748+
TidyEncUtf16,
749+
#endif
750+
751+
#if SUPPORT_ASIAN_ENCODINGS
752+
TidyEncBig5,
753+
TidyEncShiftjis
754+
#endif
755+
} TidyEncodingOptions;
756+
727757

728758
/** Mode controlling treatment of doctype
729759
** @remark This enum's starting value is guaranteed to remain stable.

0 commit comments

Comments
 (0)