HTML Tidy  5.7.0
The HTACG Tidy HTML Project
Configuration Options

Detailed Description

This module organizes all of Tidy's configuration options, including picklist management, option setting and retrieval, option file utilities, and so on.

Data Structures

struct  TidyOptionImpl
 This structure defines the internal representation of a Tidy option. More...
 
struct  PickListItem
 Structs of this type contain information needed in order to present picklists, relate picklist entries to public enum values, and parse strings that are accepted in order to assign the value. More...
 
struct  TidyConfigImpl
 This type is used to define a structure for keeping track of the values for each option. More...
 
struct  TidyOptionDoc
 Used to build a table of documentation cross-references. More...
 
union  TidyOptionValue
 Stored option values can be one of two internal types. More...
 

Macros

#define cfg(doc, id)    ((doc)->config.value[ (id) ].v)
 Access the raw, non-string uint value of the given option ID. More...
 
#define cfgAutoBool(doc, id)    ((TidyTriState) cfg(doc, id))
 Access the TidyTriState value of the given option ID. More...
 
#define cfgBool(doc, id)    ((Bool) cfg(doc, id))
 Access the Bool value of the given option ID. More...
 
#define cfgStr(doc, id)    ((ctmbstr) (doc)->config.value[ (id) ].p)
 Access the string value of the given option ID. More...
 
#define TIDY_PL_SIZE   16
 Determines the maximum number of items in an option's picklist. More...
 

Typedefs

typedef BoolParseProperty) (TidyDocImpl *doc, const TidyOptionImpl *opt)
 This typedef describes a function that is used for parsing the input given for a particular Tidy option. More...
 
typedef const PickListItem PickListItems[TIDY_PL_SIZE]
 An array of PickListItems, fixed in size for in-code declarations. More...
 

Functions

Bool TY_❪AdjustCharEncoding❫ (TidyDocImpl *doc, int encoding)
 Ensure that char encodings are self consistent. More...
 
void TY_❪AdjustConfig❫ (TidyDocImpl *doc)
 Ensure that the configuration options are self consistent. More...
 
int TY_❪CharEncodingId❫ (TidyDocImpl *doc, ctmbstr charenc)
 Returns the character encoding ID for the given character encoding string. More...
 
ctmbstr TY_❪CharEncodingName❫ (int encoding)
 Returns the full name of the encoding for the given ID. More...
 
ctmbstr TY_❪CharEncodingOptName❫ (int encoding)
 Returns the Tidy command line option name of the encoding for the given ID. More...
 
Bool TY_❪ConfigDiffThanDefault❫ (TidyDocImpl *doc)
 Indicates whether or not the current configuration is completely default. More...
 
Bool TY_❪ConfigDiffThanSnapshot❫ (TidyDocImpl *doc)
 Indicates whether or not the current configuration is different from the stored snapshot. More...
 
void TY_❪CopyConfig❫ (TidyDocImpl *docTo, TidyDocImpl *docFrom)
 Copies the configuration from one document to another. More...
 
void TY_❪DeclareListItem❫ (TidyDocImpl *doc, const TidyOptionImpl *opt, ctmbstr name)
 Coordinates Config update and list data. More...
 
void TY_❪FreeConfig❫ (TidyDocImpl *doc)
 Frees the configuration memory for the given Tidy document. More...
 
ctmbstr TY_❪getNextOptionPick❫ (const TidyOptionImpl *option, TidyIterator *iter)
 Gets the next picklist possibility provided by the iterator. More...
 
const TidyOptionImpl * TY_❪getNextOption❫ (TidyDocImpl *doc, TidyIterator *iter)
 Gets the next option provided by the iterator. More...
 
const Bool TY_❪getOptionIsList❫ (TidyOptionId optId)
 Given an option ID, indicates whether or not the option is a list. More...
 
TidyIterator TY_❪getOptionList❫ (TidyDocImpl *doc)
 Initiates an iterator to cycle through all of the available options. More...
 
TidyIterator TY_❪getOptionPickList❫ (const TidyOptionImpl *option)
 Initiates an iterator to cycle through all of the available picklist possibilities. More...
 
const TidyOptionImpl * TY_❪getOption❫ (TidyOptionId optId)
 Given an option ID, return an instance of an option. More...
 
ctmbstr TY_❪GetPickListLabelForPick❫ (TidyOptionId optId, uint pick)
 Gets the picklist label for a given value. More...
 
void TY_❪InitConfig❫ (TidyDocImpl *doc)
 Initialize the configuration for the given Tidy document. More...
 
const TidyOptionImpl * TY_❪lookupOption❫ (ctmbstr optnam)
 Given an option name, return an instance of an option. More...
 
const TidyOptionDocTY_❪OptGetDocDesc❫ (TidyOptionId optId)
 Returns the cross-reference information structure for optID, which is used for generating documentation. More...
 
int TY_❪ParseConfigFileEnc❫ (TidyDocImpl *doc, ctmbstr cfgfil, ctmbstr charenc)
 Attempts to parse the given config file into the document, using the provided encoding. More...
 
int TY_❪ParseConfigFile❫ (TidyDocImpl *doc, ctmbstr cfgfil)
 Attempts to parse the given config file into the document. More...
 
Bool TY_❪ParseConfigOption❫ (TidyDocImpl *doc, ctmbstr optnam, ctmbstr optVal)
 Attempts to parse the provided value for the given option name. More...
 
Bool TY_❪ParseConfigValue❫ (TidyDocImpl *doc, TidyOptionId optId, ctmbstr optVal)
 Attempts to parse the provided value for the given option id. More...
 
void TY_❪ResetConfigToDefault❫ (TidyDocImpl *doc)
 Resets all options in the document to their default values. More...
 
void TY_❪ResetConfigToSnapshot❫ (TidyDocImpl *doc)
 Restores all of the configuration values to their snapshotted values. More...
 
Bool TY_❪ResetOptionToDefault❫ (TidyDocImpl *doc, TidyOptionId optId)
 Resets the given option to its default value. More...
 
int TY_❪SaveConfigFile❫ (TidyDocImpl *doc, ctmbstr cfgfil)
 Saves the current configuration for options not having default values into the specified file. More...
 
int TY_❪SaveConfigSink❫ (TidyDocImpl *doc, TidyOutputSink *sink)
 Writes the current configuration for options not having default values into the specified sink. More...
 
Bool TY_❪SetOptionBool❫ (TidyDocImpl *doc, TidyOptionId optId, Bool val)
 Sets the bool value for the given option Id. More...
 
Bool TY_❪SetOptionInt❫ (TidyDocImpl *doc, TidyOptionId optId, ulong val)
 Sets the integer value for the given option Id. More...
 
void TY_❪TakeConfigSnapshot❫ (TidyDocImpl *doc)
 Stores a snapshot of all of the configuration values that can be restored later. More...
 

Data Structure Documentation

struct _tidy_option

This structure defines the internal representation of a Tidy option.

The TidyOptionImpl type implements the _tidy_option structure.

Data Fields
TidyConfigCategory category The category of the option.
ulong dflt Default value for TidyInteger and TidyBoolean.
TidyOptionId id The unique identifier for this option.
ctmbstr name The name of the option.
ParseProperty * parser Function to parse input; read-only if NULL.
ctmbstr pdflt Default value for TidyString.
PickListItems * pickList The picklist of possible values for this option.
TidyOptionType type The date type for the option.
struct PickListItem

Structs of this type contain information needed in order to present picklists, relate picklist entries to public enum values, and parse strings that are accepted in order to assign the value.

Data Fields
ctmbstr inputs[10] String values that can select this value.
ctmbstr label PickList label for this item.
const int value The option value represented by this label.
struct TidyConfigImpl

This type is used to define a structure for keeping track of the values for each option.

Data Fields
uint c Current char in input stream for reading options.
StreamIn * cfgIn Current input source for reading options.
uint defined_tags Tracks user-defined tags.
TidyOptionValue snapshot[N_TIDY_OPTIONS+1] Snapshot of values to be restored later.
TidyOptionValue value[N_TIDY_OPTIONS+1] Current config values.
struct TidyOptionDoc

Used to build a table of documentation cross-references.

Data Fields
TidyOptionId const * links Cross references.

Last element must be 'TidyUnknownOption'.

TidyOptionId opt Identifier.
union TidyOptionValue

Stored option values can be one of two internal types.

Data Fields
char * p Value for TidyString.
ulong v Value for TidyInteger and TidyBoolean.

Macro Definition Documentation

#define cfg (   doc,
  id 
)    ((doc)->config.value[ (id) ].v)

Access the raw, non-string uint value of the given option ID.

#define cfgAutoBool (   doc,
  id 
)    ((TidyTriState) cfg(doc, id))

Access the TidyTriState value of the given option ID.

#define cfgBool (   doc,
  id 
)    ((Bool) cfg(doc, id))

Access the Bool value of the given option ID.

#define cfgStr (   doc,
  id 
)    ((ctmbstr) (doc)->config.value[ (id) ].p)

Access the string value of the given option ID.

#define TIDY_PL_SIZE   16

Determines the maximum number of items in an option's picklist.

PickLists may have up to 16 items. For some reason, this limit has been hard-coded into Tidy for some time. Feel free to increase this as needed.

Typedef Documentation

typedef Bool( ParseProperty) (TidyDocImpl *doc, const TidyOptionImpl *opt)

This typedef describes a function that is used for parsing the input given for a particular Tidy option.

typedef const PickListItem PickListItems[TIDY_PL_SIZE]

An array of PickListItems, fixed in size for in-code declarations.

Arrays must be populated in 0 to 10 order, as the option value is assigned based on this index and not on the structures' value field. It remains a best practice, however, to assign a public enum value with the proper index value.

Function Documentation

Bool TY_❪AdjustCharEncoding❫ ( TidyDocImpl *  doc,
int  encoding 
)

Ensure that char encodings are self consistent.

Parameters
docThe Tidy document to adjust.
encodingThe encoding being applied.
Returns
A bool indicating success or failure.
void TY_❪AdjustConfig❫ ( TidyDocImpl *  doc)

Ensure that the configuration options are self consistent.

Parameters
docThe Tidy document to adjust.
int TY_❪CharEncodingId❫ ( TidyDocImpl *  doc,
ctmbstr  charenc 
)

Returns the character encoding ID for the given character encoding string.

Parameters
docThe Tidy document.
charencThe name of the character encoding.
Returns
The Id of the character encoding.
ctmbstr TY_❪CharEncodingName❫ ( int  encoding)

Returns the full name of the encoding for the given ID.

Parameters
encodingThe Id of the encoding.
Returns
The name of the character encoding.
ctmbstr TY_❪CharEncodingOptName❫ ( int  encoding)

Returns the Tidy command line option name of the encoding for the given ID.

Parameters
encodingThe Id of the encoding.
Returns
The Tidy command line option representing the encoding.
Bool TY_❪ConfigDiffThanDefault❫ ( TidyDocImpl *  doc)

Indicates whether or not the current configuration is completely default.

Parameters
docThe Tidy document.
Returns
The result.
Bool TY_❪ConfigDiffThanSnapshot❫ ( TidyDocImpl *  doc)

Indicates whether or not the current configuration is different from the stored snapshot.

Parameters
docThe Tidy document.
Returns
The result.
void TY_❪CopyConfig❫ ( TidyDocImpl *  docTo,
TidyDocImpl *  docFrom 
)

Copies the configuration from one document to another.

Parameters
docToThe destination Tidy document.
docFromThe source Tidy document.
void TY_❪DeclareListItem❫ ( TidyDocImpl *  doc,
const TidyOptionImpl *  opt,
ctmbstr  name 
)

Coordinates Config update and list data.

Parameters
docThe Tidy document.
optThe option the list item is intended for.
nameThe name of the new list item.
void TY_❪FreeConfig❫ ( TidyDocImpl *  doc)

Frees the configuration memory for the given Tidy document.

Parameters
docThe Tidy document.
ctmbstr TY_❪getNextOptionPick❫ ( const TidyOptionImpl *  option,
TidyIterator *  iter 
)

Gets the next picklist possibility provided by the iterator.

Parameters
optionThe instance of the option for which to iterate a picklist.
iterThe iterator token initialized by TY_(getOptionPickList)().
Returns
The next picklist entry.
const TidyOptionImpl* TY_❪getNextOption❫ ( TidyDocImpl *  doc,
TidyIterator *  iter 
)

Gets the next option provided by the iterator.

Parameters
docThe Tidy document to get options.
iterThe iterator token initialized by TY_(getOptionList)().
Returns
The instance of the next option.
const Bool TY_❪getOptionIsList❫ ( TidyOptionId  optId)

Given an option ID, indicates whether or not the option is a list.

Parameters
optIdThe option ID to check.
Returns
Returns yes if the option value is a list.
TidyIterator TY_❪getOptionList❫ ( TidyDocImpl *  doc)

Initiates an iterator to cycle through all of the available options.

Parameters
docThe Tidy document to get options.
Returns
An iterator token to be used with TY_(getNextOption)().
TidyIterator TY_❪getOptionPickList❫ ( const TidyOptionImpl *  option)

Initiates an iterator to cycle through all of the available picklist possibilities.

Parameters
optionAn instance of an option for which to iterate a picklist.
Returns
An interator token to be used with TY_(getNextOptionPick)().
const TidyOptionImpl* TY_❪getOption❫ ( TidyOptionId  optId)

Given an option ID, return an instance of an option.

Parameters
optIdThe option ID to retrieve.
Returns
The instance of the requested option.
ctmbstr TY_❪GetPickListLabelForPick❫ ( TidyOptionId  optId,
uint  pick 
)

Gets the picklist label for a given value.

Parameters
optIdthe option id having a picklist to check.
pickthe picklist item to retrieve.
Returns
The label for the pick.
void TY_❪InitConfig❫ ( TidyDocImpl *  doc)

Initialize the configuration for the given Tidy document.

Parameters
docThe Tidy document.
const TidyOptionImpl* TY_❪lookupOption❫ ( ctmbstr  optnam)

Given an option name, return an instance of an option.

Parameters
optnamThe option name to retrieve.
Returns
The instance of the requested option.
const TidyOptionDoc* TY_❪OptGetDocDesc❫ ( TidyOptionId  optId)

Returns the cross-reference information structure for optID, which is used for generating documentation.

Parameters
optIdThe option ID to get cross-reference information for.
Returns
Cross reference information.
int TY_❪ParseConfigFileEnc❫ ( TidyDocImpl *  doc,
ctmbstr  cfgfil,
ctmbstr  charenc 
)

Attempts to parse the given config file into the document, using the provided encoding.

Parameters
docThe Tidy document.
cfgfilThe file to load.
charencThe name of the encoding to use for reading the file.
Returns
a file system error code.
int TY_❪ParseConfigFile❫ ( TidyDocImpl *  doc,
ctmbstr  cfgfil 
)

Attempts to parse the given config file into the document.

Parameters
docThe Tidy document.
cfgfilThe file to load.
Returns
a file system error code.
Bool TY_❪ParseConfigOption❫ ( TidyDocImpl *  doc,
ctmbstr  optnam,
ctmbstr  optVal 
)

Attempts to parse the provided value for the given option name.

Returns false if unknown option, missing parameter, or the option doesn't use the parameter.

Parameters
docThe Tidy document.
optnamThe name of the option to be set.
optValThe string value to attempt to parse.
Returns
Success or failure.
Bool TY_❪ParseConfigValue❫ ( TidyDocImpl *  doc,
TidyOptionId  optId,
ctmbstr  optVal 
)

Attempts to parse the provided value for the given option id.

Returns false if unknown option, missing parameter, or the option doesn't use the parameter.

Parameters
docThe Tidy document.
optIdThe ID of the option to be set.
optValThe string value to attempt to parse.
Returns
Success or failure.
void TY_❪ResetConfigToDefault❫ ( TidyDocImpl *  doc)

Resets all options in the document to their default values.

Parameters
docThe Tidy document.
void TY_❪ResetConfigToSnapshot❫ ( TidyDocImpl *  doc)

Restores all of the configuration values to their snapshotted values.

Parameters
docThe Tidy document.
Bool TY_❪ResetOptionToDefault❫ ( TidyDocImpl *  doc,
TidyOptionId  optId 
)

Resets the given option to its default value.

Parameters
docThe Tidy document.
optIdThe option ID to set.
Returns
Success or failure.
int TY_❪SaveConfigFile❫ ( TidyDocImpl *  doc,
ctmbstr  cfgfil 
)

Saves the current configuration for options not having default values into the specified file.

Parameters
docThe Tidy document.
cfgfilThe file to save.
Returns
a file system error code.
int TY_❪SaveConfigSink❫ ( TidyDocImpl *  doc,
TidyOutputSink sink 
)

Writes the current configuration for options not having default values into the specified sink.

Parameters
docThe Tidy document.
sinkThe sink to save into.
Returns
a file system error code.
Bool TY_❪SetOptionBool❫ ( TidyDocImpl *  doc,
TidyOptionId  optId,
Bool  val 
)

Sets the bool value for the given option Id.

Parameters
docThe Tidy document.
optIdThe option ID to set.
valThe value to set.
Returns
Success or failure.
Bool TY_❪SetOptionInt❫ ( TidyDocImpl *  doc,
TidyOptionId  optId,
ulong  val 
)

Sets the integer value for the given option Id.

Parameters
docThe Tidy document.
optIdThe option ID to set.
valThe value to set.
Returns
Success or failure.
void TY_❪TakeConfigSnapshot❫ ( TidyDocImpl *  doc)

Stores a snapshot of all of the configuration values that can be restored later.

Parameters
docThe Tidy document.