Crate tidy_sys

source ·
Expand description

tidy-sys

Rust bindings for the HTML Tidy library.

Documentation

Note About Vendored Dependencies

The source code for Tidy is vendored in this repository for ease of use, under the vendor/ directory. Otherwise this is an unassociated project.

Also note that Tidy has its own license; this crate’s license is for files excluding the vendor/ directory.

Requirements

This crate will build the Tidy library from source and generate bindings depending on the target platform. Some external tools are required:

  • CMake (Tidy uses CMake as the build system)
  • A C compiler (to compile Tidy)
  • Clang (as bindgen needs it)

The Default Build Configuration

Tidy will be built with:

  • -DNDEBUG, regardless of the rust profile (not setting it causes Tidy to debug-log to stderr uncontrollably)
  • CMake profile always set to Release as other values cause problems with Visual Studio generators
  • Optimization level matching the rust build’s opt-level (overwritten with CFLAGS and TIDY_SYS_CFLAGS)

Setting Build Options

This crate respects the standard environment variables used by C compilers and related tools, such as CC, CFLAGS, LD etc.

In addition, you can set the TIDY_SYS_CFLAGS environment variable; the values will be appended to CFLAGS while building Tidy.

Crate Features

Currently there’s only one feature, by default disabled:

  • localization: Enable multi-language support in Tidy (sets the SUPPORT_LOCALIZATIONS option to on with CMake).

Structs

Enums

  • Known HTML attributes
  • Mode controlling treatment of sorting attributes @remark This enum’s starting value is guaranteed to remain stable.
  • Categories of Tidy configuration options, which are used mostly by user interfaces to sort Tidy options into related groups.
  • Mode controlling treatment of doctype @remark This enum’s starting value is guaranteed to remain stable.
  • Mode controlling treatment of duplicate Attributes @remark This enum’s starting value is guaranteed to remain stable.
  • TidyEncodingOptions option values specify the input and/or output encoding. @remark This enum’s starting value is guaranteed to remain stable.
  • Indicates the data type of a format string parameter used when Tidy emits reports and dialogue as part of the messaging callback functions. See messageobj.h for more information on this API.
  • TidyNewline option values to control output line endings. @remark This enum’s starting value is guaranteed to remain stable.
  • Node types
  • Option IDs are used used to get and/or set configuration option values and retrieve their descriptions.
  • A Tidy configuration option can have one of these data types.
  • Message severity level, used throughout LibTidy to indicate the severity or status of a message
  • Known HTML element types
  • AutoBool values used by ParseBool, ParseTriState, ParseIndent, ParseBOM @remark This enum’s starting value is guaranteed to remain stable.
  • Mode controlling capitalization of things, such as attributes. @remark This enum’s starting value is guaranteed to remain stable.
  • Values used by ParseUseCustomTags, which describes how Autonomous Custom tags (ACT’s) found by Tidy are treated.
  • The enumeration contains a list of every possible string that Tidy and the console application can output, except for strings from the following enumerations:

Constants

Functions

  • Given a tidyLocaleMapItem, return the POSIX name. @param item An instance of tidyLocaleMapItem to query. @result Returns a string with the POSIX name of the mapping.
  • Given a tidyLocaleMapItem, return the Windows name. @param item An instance of tidyLocaleMapItem to query. @result Returns a string with the Windows name of the mapping.
  • Initiates an iterator for a list of message codes available in Tidy. This iterator allows you to iterate through all of the code. In orde to iterate through the codes, initiate the iterator with this function, and then use getNextErrorCode() to retrieve the first and subsequent codes. For example: @code{.c} TidyIterator itMessage = getErrorCodeList(); while ( itMessage ) { uint code = getNextErrorCode( &itMessage ); // do something with the code, such as lookup a string. } @endcode @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Initiates an iterator for a list of Tidy’s installed languages. This iterator allows you to iterate through this list. In order to iterate through the list, initiate the iterator with this function, and then use use getNextInstalledLanguage() to retrieve the first and subsequent strings. For example: @code{.c} TidyIterator itList = getInstalledLanguageList(); while ( itList ) { printf(“%s”, getNextInstalledLanguage( &itList )); } @endcode @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Given a valid TidyIterator initiated with getErrorCodeList(), returns an instance of the opaque type TidyMessageArgument, which serves as a token against which the remaining argument API functions may be used to query information. @param iter The TidyIterator (initiated with getErrorCodeList()) token. @result Returns a message code.
  • Given a valid TidyIterator initiated with getInstalledLanguageList(), returns a string representing a language name that is installed in Tidy. @param iter The TidyIterator (initiated with getInstalledLanguageList()) token. @result Returns a string indicating the installed language.
  • Given a valid TidyIterator initiated with getStringKeyList(), returns an unsigned integer representing the next key value. @remark These are provided for documentation generation purposes, and probably aren’t of much use to the average LibTidy implementor. @param iter The TidyIterator (initiated with getStringKeyList()) token. @result Returns a message code.
  • Given a valid TidyIterator initiated with getWindowsLanguageList(), returns a pointer to a tidyLocaleMapItem, which can be further interrogated with TidyLangWindowsName() or TidyLangPosixName(). @param iter The TidyIterator (initiated with getWindowsLanguageList()) token. @result Returns a pointer to a tidyLocaleMapItem.
  • Initiates an iterator for a list of string key codes available in Tidy. This iterator allows you to iterate through all of the codes. In order to iterate through the codes, initiate the iterator with this function, and then use getNextStringKey() to retrieve the first and subsequent codes. For example: @code{.c} TidyIterator itKey = getErrorCodeList(); while ( itKey ) { uint code = getNextStringKey( &itKey ); // do something with the code, such as lookup a string. } @endcode @remark These are provided for documentation generation purposes, and probably aren’t of much use to the average LibTidy implementor. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Initiates an iterator for a list of Tidy’s Windows<->POSIX locale mappings. This iterator allows you to iterate through this list. In order to iterate through the list, initiate the iterator with this function, and then use getNextWindowsLanguage() to retrieve the first and subsequent codes. For example: @code{.c} TidyIterator itList = getWindowsLanguageList(); while ( itList ) { tidyLocaleMapItem *item = getNextWindowsLanguage( &itList ); // do something such as get the TidyLangWindowsName(item). } @endcode @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Indicates the number of TidyAccess messages that were generated. @param tdoc An instance of a TidyDoc to query. @result Returns the number of TidyAccess messages that were generated.
  • Discard an attribute.
  • Get the first attribute. @param tnod The node for which to get attributes. @result Returns an instance of TidyAttr.
  • Get an instance of TidyAttr by specifying an attribute ID. @result Returns a TidyAttr instance.
  • Get the attribute ID given a tidy attribute. @param tattr The attribute to query. @result Returns the TidyAttrId of the given attribute.
  • Indicates whether or not a given attribute is an event attribute. @param tattr The attribute to query. @result Returns a bool indicating whether or not the attribute is an event.
  • Get the name of a TidyAttr instance. @param tattr The tidy attribute to query. @result Returns a string indicating the name of the attribute.
  • Get the next attribute. @param tattr The current attribute, so the next one can be returned. @result Returns and instance of TidyAttr.
  • Get the value of a TidyAttr instance. @param tattr The tidy attribute to query. @result Returns a string indicating the value of the attribute.
  • Free current buffer, allocate given amount, reset input pointer, use the default allocator
  • Free current buffer, allocate given amount, reset input pointer, use the given custom allocator
  • Append bytes to buffer. Expand if necessary.
  • Attach to existing buffer
  • Expand buffer to given size. Chunk size is minimum growth. Pass 0 for default of 256 bytes.
  • Set buffer bytes to 0
  • Detach from buffer. Caller must free.
  • At end of buffer?
  • Free current contents and zero out
  • Get byte from front of buffer. Increment input offset.
  • Initialize data structure using the default allocator
  • Initialize data structure using the given custom allocator
  • Get byte from end of buffer
  • Append one byte to buffer. Expand if necessary.
  • Put a byte back into the buffer. Decrement input offset.
  • Execute configured cleanup and repair operations on parsed markup. @param tdoc The tidy document to use. @result An integer representing the status.
  • Indicates the number of configuration error messages that were generated. @param tdoc An instance of a TidyDoc to query. @result Returns the number of configuration error messages that were generated.
  • The primary creation of a document instance. Instances of a TidyDoc are used throughout the API as a token to represent a particular document. You must create at least one TidyDoc instance to initialize the library and begin interaction with the API. When done using a TidyDoc instance, be sure to tidyRelease(myTidyDoc); in order to free related memory. @result Returns a TidyDoc instance.
  • Create a document supplying your own, custom TidyAllocator instead of using the built-in default. See the @ref Memory module if you want to create and use your own allocator. @param allocator The allocator to use for creating the document. @result Returns a TidyDoc instance.
  • Provides a string given messageType in the default localization (which is en). @param messageType The message type. @result Returns the desired string.
  • Indicates whether or not the input document was XML. If TidyXml tags is true, or there was an XML declaration in the input document, then this function will return yes. @param tdoc An instance of a TidyDoc to query. @result Returns yes if the input document was XML.
  • Gets the version of HTML that was output, as an integer, times 100. For example, HTML5 will return 500; HTML4.0.1 will return 401. @param tdoc An instance of a TidyDoc to query. @result Returns the HTML version number (x100).
  • Indicates whether the output document is or isn’t XHTML. @param tdoc An instance of a TidyDoc to query. @result Returns yes if the document is an XHTML type.
  • Remove the indicated node. @result Returns the next tidy node.
  • Given a message code, return the text key that represents it. @param code The error code to lookup. @result The string representing the error code.
  • Given a text key representing a message code, return the uint that represents it.
  • Indicates the number of TidyError messages that were generated. For any value greater than 0, output is suppressed unless TidyForceOutput is set. @param tdoc An instance of a TidyDoc to query. @result Returns the number of TidyError messages that were generated.
  • Write more complete information about errors to current error sink. @param tdoc An instance of a TidyDoc to query.
  • Determine whether or not a particular file exists. On Unix systems, the use of the tilde to represent the user’s home directory is supported. @result Returns yes or no, indicating whether or not the file exists.
  • Write more general information about markup to current error sink. @param tdoc An instance of a TidyDoc to query.
  • Returns the data previously stored with tidySetAppData(). @param tdoc document where data has been stored. @result The pointer to the data block previously stored.
  • Returns the format specifier of the given message argument. The memory for this string is cleared upon termination of the callback, so do be sure to make your own copy. @result Returns the format specifier string of the given argument.
  • Returns the TidyFormatParameterType of the given message argument. @result Returns the type of parameter of type TidyFormatParameterType.
  • Returns the double value of the given message argument. An assertion will be generated if the argument type is not a double. @result Returns the double value of the given argument.
  • Returns the integer value of the given message argument. An assertion will be generated if the argument type is not an integer. @result Returns the integer value of the given argument.
  • Returns the string value of the given message argument. An assertion will be generated if the argument type is not a string. @result Returns the string value of the given argument.
  • Returns the unsigned integer value of the given message argument. An assertion will be generated if the argument type is not an unsigned int. @result Returns the unsigned integer value of the given argument.
  • Get the BODY node. @param tdoc The document to query. @result Returns a tidy node.
  • Helper: get next byte from input source. @param source A pointer to your input source. @result Returns a byte as an unsigned integer.
  • Get the child of the indicated node. @param tnod The node to query. @result Returns a tidy node.
  • Get the file path to use for reports when TidyEmacs is being used. This function provides a proper interface for using the hidden, internal-only TidyEmacsFile configuration option. @param tdoc The tidy document for which you want to fetch the file path. @result Returns a string indicating the file path.
  • Get the HEAD node. @param tdoc The document to query. @result Returns a tidy node.
  • Get the HTML node. @param tdoc The document to query. @result Returns a tidy node.
  • Gets the current language used by Tidy. @result Returns a string indicating the currently set language.
  • Get the message with the format string already completed, in Tidy’s current localization. @param tmessage Specify the message that you are querying. @result Returns the message in the current localization.
  • Initiates an iterator for a list of arguments related to a given message. This iterator allows you to iterate through all of the arguments, if any. In order to iterate through the arguments, initiate the iterator with this function, and then use tidyGetNextMessageArgument() to retrieve the first and subsequent arguments. For example: @code{.c} TidyIterator itArg = tidyGetMessageArguments( tmessage ); while ( itArg ) { TidyMessageArgument my_arg = tidyGetNextMessageArgument( tmessage, &itArg ); // do something with my_arg, such as inspect its value or format } @endcode @param tmessage The message about whose arguments you wish to query. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Get the message code. @param tmessage Specify the message that you are querying. @result Returns a code representing the message. This code can be used directly with the localized strings API; however we never make any guarantees about the value of these codes. For code stability don’t store this value in your own application. Instead use the enum field or use the message key string value.
  • Get the column the message applies to. @param tmessage Specify the message that you are querying. @result Returns the column number, if any, that generated the message.
  • Get the message with the format string already completed, in Tidy’s default localization. @param tmessage Specify the message that you are querying. @result Returns the message in the default localization.
  • Get the tidy document this message comes from. @param tmessage Specify the message that you are querying. @result Returns the TidyDoc that generated the message.
  • Get the localized format string. If a localized version of the format string doesn’t exist, then the default version will be returned. @param tmessage Specify the message that you are querying. @result Returns the localized format string of the message.
  • Get the default format string, which is the format string for the message in Tidy’s default localization (en_us). @param tmessage Specify the message that you are querying. @result Returns the default localization format string of the message.
  • Get the muted status of the message, that is, whether or not the current configuration indicated that this message should be muted. @param tmessage Specify the message that you are querying. @result Returns a Bool indicating that the config indicates muting this message.
  • Get the message key string. @param tmessage Specify the message that you are querying. @result Returns a string representing the message. This string is intended to be stable by the LibTidy API, and is suitable for use as a key in your own applications.
  • Get the TidyReportLevel of the message. @param tmessage Specify the message that you are querying. @result Returns a TidyReportLevel indicating the severity or status of the message.
  • Get the line number the message applies to. @param tmessage Specify the message that you are querying. @result Returns the line number, if any, that generated the message.
  • Get the complete message as Tidy would emit it in the current localization. @param tmessage Specify the message that you are querying. @result Returns the complete message just as Tidy would display it on the console.
  • Get the complete message as Tidy would emit it in the default localization. @param tmessage Specify the message that you are querying. @result Returns the complete message just as Tidy would display it on the console.
  • Get the position part part of the message in the current language. @param tmessage Specify the message that you are querying. @result Returns the positional part of a string as Tidy would display it in the console application.
  • Get the position part part of the message in the default language. @param tmessage Specify the message that you are querying. @result Returns the positional part of a string as Tidy would display it in the console application.
  • Get the prefix part of a message in the current language. @param tmessage Specify the message that you are querying. @result Returns the message prefix part of a string as Tidy would display it in the console application.
  • Get the prefix part of a message in the default language. @param tmessage Specify the message that you are querying. @result Returns the message prefix part of a string as Tidy would display it in the console application.
  • Get the next sibling node. @param tnod The node to query. @result Returns a tidy node.
  • Given a valid TidyIterator initiated with tidyGetMessageArguments(), returns an instance of the opaque type TidyMessageArgument, which serves as a token against which the remaining argument API functions may be used to query information. @result Returns an instance of TidyMessageArgument.
  • Given a valid TidyIterator initiated with tidyGetOptionList(), returns the instance of the next TidyOption. @note This function will return internal-only option types including TidyInternalCategory; you should never use these. Always ensure that you use tidyOptGetCategory() before assuming that an option is okay to use in your application. @result An instance of TidyOption.
  • Retrieves an instance of TidyOption given a valid TidyOptionId. @result An instance of TidyOption matching the provided TidyOptionId.
  • Returns an instance of TidyOption by providing the name of a Tidy configuration option. @result The TidyOption of the given optname.
  • Initiates an iterator for a list of TidyOption instances, which allows you to iterate through all of the available options. In order to iterate through the available options, initiate the iterator with this function, and then use tidyGetNextOption() to retrieve the first and subsequent options. For example: @code{.c} TidyIterator itOpt = tidyGetOptionList( tdoc ); while ( itOpt ) { TidyOption opt = tidyGetNextOption( tdoc, &itOpt ); // Use other API to query or set set option values } @endcode @param tdoc An instance of a TidyDoc to query. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Get the parent of the indicated node. @param tnod The node to query. @result Returns a tidy node.
  • Get the previous sibling node. @param tnod The node to query. @result Returns a tidy node.
  • Get the root node. @param tdoc The document to query. @result Returns a tidy node.
  • Initialize a buffer input source
  • Initialize a buffer output sink
  • Facilitates user defined sinks by providing an entry point to marshal pointers-to-functions. This is needed by .NET, and possibly other language bindings. @result Returns a bool indicating success or failure.
  • Facilitates user defined source by providing an entry point to marshal pointers-to-functions. This is needed by .NET, and possibly other language bindings. @result Returns a bool indicating success or failure.
  • Helper: check if input source at end. @param source The input source. @result Returns a bool indicating whether or not the source is at EOF.
  • Get the version number for the current library. @result The string representing the version number.
  • Load an ASCII Tidy configuration file and set the configuration per its contents. Reports config option errors, which can be filtered. @result Returns 0 upon success, or any other value if there was an option error.
  • Load a Tidy configuration file with the specified character encoding, and set the configuration per its contents. Reports config option errors, which can be filtered. @result Returns 0 upon success, or any other value if there was an option error.
  • Provides a string given messageType in the current localization for the single case. @param messageType The message type. @result Returns the desired string.
  • Provides a string given messageType in the current localization for quantity. Some strings have one or more plural forms, and this function will ensure that the correct singular or plural form is returned for the specified quantity. @result Returns the desired string.
  • Get the column location of the node. @param tnod The node to query. @result Returns the column location of the node.
  • Get the tag ID of the node. @param tnod The node to query. @result Returns the tag ID of the node as TidyTagId.
  • Get the name of the node. @param tnod The node to query. @result Returns a string indicating the name of the node.
  • Gets the text of a node and places it into the given TidyBuffer. The text will be terminated with a TidyNewline. If you want the raw utf-8 stream see tidyNodeGetValue(). @result Returns a bool indicating success or not.
  • Get the type of node. @param tnod The node to query. @result Returns the type of node as TidyNodeType.
  • Get the value of the node. This copies the unescaped value of this node into the given TidyBuffer at UTF-8. @result Returns a bool indicating success or not.
  • Indicates whether or not the node has text. @result Returns the type of node as TidyNodeType.
  • Indicates whether or not a node represents and HTML header element, such as h1, h2, etc. @param tnod The node to query. @result Returns a bool indicating whether or not the node is an HTML header.
  • Indicates whether or not the node is a propriety type. @result Returns a bool indicating whether or not the node is a proprietary type.
  • Indicates whether or not a node is a text node. @param tnod The node to query. @result Returns a bool indicating whether or not the node is a text node.
  • Get the line number where the node occurs. @param tnod The node to query. @result Returns the line number.
  • Copy current configuration settings from one document to another. Note that the destination document’s existing settings will be stored as that document’s snapshot prior to having its option values overwritten by the source document’s settings. @result Returns a bool indicating success or failure.
  • Any settings different than default? @param tdoc The tidy document to check. @result Returns a bool indicating whether or not a difference exists.
  • Any settings different than snapshot? @param tdoc The tidy document to check. @result Returns a bool indicating whether or not a difference exists.
  • Get current option value as a Boolean flag. @result Returns a bool indicating the value.
  • Get category of given Option @param opt An instance of a TidyOption to query. @result The TidyConfigCategory of the specified option.
  • Get the current pick list value for the option ID, which can be useful for enum types. @result Returns a string indicating the current value of the specified option.
  • Initiates an iterator for a list of user-declared tags, including autonomous custom tags detected in the document if @ref TidyUseCustomTags is not set to no. This iterator allows you to iterate through all of the custom tags. In order to iterate through the tags, initiate the iterator with this function, and then use tidyOptGetNextDeclTag() to retrieve the first and subsequent tags. For example: @code{.c} TidyIterator itTag = tidyOptGetDeclTagList( tdoc ); while ( itTag ) { printf(“%s”, tidyOptGetNextDeclTag( tdoc, TidyBlockTags, &itTag )); } @endcode @param tdoc An instance of a TidyDoc to query. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Get default value of given Option as a string @param opt An instance of a TidyOption to query. @result A string indicating the default value of the specified option.
  • Get default value of given Option as a Boolean value @param opt An instance of a TidyOption to query. @result A boolean indicating the default value of the specified option.
  • Get default value of given Option as an unsigned integer @param opt An instance of a TidyOption to query. @result An unsigned integer indicating the default value of the specified option.
  • Get the description of the specified option. @result Returns a string containing a description of the given option.
  • Initiates an iterator for a list of options related to a given option. This iterator allows you to iterate through all of the related options, if any. In order to iterate through the options, initiate the iterator with this function, and then use tidyOptGetNextDocLinks() to retrieve the first and subsequent options. For example: @code{.c} TidyIterator itOpt = tidyOptGetDocLinksList( tdoc, TidyJoinStyles ); while ( itOpt ) { TidyOption my_option = tidyOptGetNextDocLinks( tdoc, &itOpt ); // do something with my_option } @endcode @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Get character encoding name. Used with @ref TidyCharEncoding, @ref TidyOutCharEncoding, and @ref TidyInCharEncoding. @result The encoding name as a string for the specified option.
  • Get ID of given Option @param opt An instance of a TidyOption to query. @result The TidyOptionId of the given option.
  • Returns the TidyOptionId (enum value) by providing the name of a Tidy configuration option. @param optnam The name of the option ID to retrieve. @result The TidyOptionId of the given optname.
  • Get current option value as an integer. @result Returns the integer value of the specified option.
  • Initiates an iterator for a list of muted messages. This iterator allows you to iterate through all of the priority attributes defined with the mute configuration option. In order to iterate through the list, initiate with this function, and then use tidyOptGetNextMutedMessage() to retrieve the first and subsequent attributes. For example: @code{.c} TidyIterator itAttr = tidyOptGetMutedMessageList( tdoc ); while ( itAttr ) { printf(“%s”, tidyOptGetNextMutedMessage( tdoc, &itAttr )); } @endcode @param tdoc An instance of a TidyDoc to query. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Get name of given Option @param opt An instance of a TidyOption to query. @result The name of the given option.
  • Given a valid TidyIterator initiated with tidyOptGetDeclTagList(), returns a string representing a user-declared or autonomous custom tag. @remark Specifying optId limits the scope of the tags to one of @ref TidyInlineTags, @ref TidyBlockTags, @ref TidyEmptyTags, or @ref TidyPreTags. Note that autonomous custom tags (if used) are added to one of these option types, depending on the value of @ref TidyUseCustomTags. @result A string containing the next tag.
  • Given a valid TidyIterator initiated with tidyOptGetDocLinksList(), returns a TidyOption instance. @result Returns in instance of TidyOption.
  • Given a valid TidyIterator initiated with tidyOptGetMutedMessageList(), returns a string representing a muted message. @result A string containing the next tag.
  • Given a valid TidyIterator initiated with tidyOptGetPickList(), returns a string representing a possible option value. @result A string containing the next pick-list option value.
  • Given a valid TidyIterator initiated with tidyOptGetPriorityAttrList(), returns a string representing a priority attribute. @result A string containing the next tag.
  • Initiates an iterator for a list of TidyOption pick-list values, which allows you iterate through all of the available option values. In order to iterate through the available values, initiate the iterator with this function, and then use tidyOptGetNextPick() to retrieve the first and subsequent option values. For example: @code{.c} TidyIterator itOpt = tidyOptGetPickList( opt ); while ( itOpt ) { printf(“%s”, tidyOptGetNextPick( opt, &itOpt )); } @endcode @param opt An instance of a TidyOption to query. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Initiates an iterator for a list of priority attributes. This iterator allows you to iterate through all of the priority attributes defined with the priority-attributes configuration option. In order to iterate through the attributes, initiate the iterator with this function, and then use tidyOptGetNextPriorityAttr() to retrieve the first and subsequent attributes. For example: @code{.c} TidyIterator itAttr = tidyOptGetPriorityAttrList( tdoc ); while ( itAttr ) { printf(“%s”, tidyOptGetNextPriorityAttr( tdoc, &itAttr )); } @endcode @param tdoc An instance of a TidyDoc to query. @result Returns a TidyIterator, which is a token used to represent the current position in a list within LibTidy.
  • Get datatype of given Option @param opt An instance of a TidyOption to query. @result The TidyOptionType of the given option.
  • Get the current value of the option ID for the given document. @remark The optId must have a @ref TidyOptionType of @ref TidyString!
  • Is Option read-only? Some options (mainly internal use only options) are read-only. @deprecated This is no longer a valid test for the public API; instead you should test an option’s availability using tidyOptGetCategory() against TidyInternalCategory. This API will be removed! @param opt An instance of a TidyOption to query. @result Returns yes or no depending on whether or not the specified option is read-only.
  • Set named option value as a string, regardless of the @ref TidyOptionType. @remark This is good setter if you are unsure of the type. @result Returns a bool indicating success or failure.
  • Reset all options to their default values. @param tdoc The tidy document for which to reset all values. @result Returns a bool indicating success or failure.
  • Reset option to default value by ID. @result Returns a bool indicating success or failure.
  • Apply a snapshot of config settings to a document. @param tdoc The tidy document for which to apply a snapshot. @result Returns a bool indicating success or failure.
  • Save current settings to named file. Only writes non-default values. @result An integer representing the status.
  • Save current settings to given output sink. Only non-default values are written. @result An integer representing the status.
  • Set option value as a Boolean flag. @result Returns a bool indicating success or failure.
  • Set option value as an integer. @result Returns a bool indicating success or failure.
  • Set the option value as a string. @remark The optId must have a @ref TidyOptionType of @ref TidyString! @result Returns a bool indicating success or failure.
  • Take a snapshot of current config settings. These settings are stored within the tidy document. Note, however, that snapshots do not reliably survive the tidyParseXXX() process, as Tidy uses the snapshot mechanism in order to store the current configuration right at the beginning of the parsing process. @param tdoc The tidy document for which to take a snapshot. @result Returns a bool indicating success or failure.
  • Indicates that an option takes a list of items. @param opt An instance of a TidyOption to query. @result A bool indicating whether or not the option accepts a list.
  • Parse markup in given buffer. @result Returns the highest of 2 indicating that errors were present in the document, 1 indicating warnings, and 0 in the case of everything being okay.
  • Parse markup in named file. @result Returns the highest of 2 indicating that errors were present in the document, 1 indicating warnings, and 0 in the case of everything being okay.
  • Parse markup in given generic input source. @result Returns the highest of 2 indicating that errors were present in the document, 1 indicating warnings, and 0 in the case of everything being okay.
  • Parse markup from the standard input. @param tdoc The tidy document to use for parsing. @result Returns the highest of 2 indicating that errors were present in the document, 1 indicating warnings, and 0 in the case of everything being okay.
  • Parse markup in given string. Note that the supplied string is of type ctmbstr based on char and therefore doesn’t support the use of UTF-16 strings. Use tidyParseBuffer() if parsing multibyte strings. @result Returns the highest of 2 indicating that errors were present in the document, 1 indicating warnings, and 0 in the case of everything being okay.
  • Get the platform for which Tidy was built. @result The string representing the version number.
  • Helper: send a byte to output.
  • Free all memory and release the TidyDoc. The TidyDoc can not be used after this call. @param tdoc The TidyDoc to free.
  • Get the release date for the current library. @result The string representing the release date.
  • Reports the document type into the output sink. @param tdoc The tidy document to use. @result An integer representing the status.
  • Reports the document type and diagnostic statistics on parsed and repaired markup. You must call tidyCleanAndRepair() before using this function. @param tdoc The tidy document to use. @result An integer representing the status.
  • Save the tidy document to given TidyBuffer object. @result An integer representing the status.
  • Save the tidy document to the named file. @result An integer representing the status.
  • Save to given generic output sink. @result An integer representing the status.
  • Save the tidy document to standard output (FILE*). @param tdoc The tidy document to save. @result An integer representing the status.
  • Save the tidy document to an application buffer. If TidyShowMarkup and the document has no errors, or TidyForceOutput, then the current document (per the current configuration) will be pretty printed to this application buffer. The document byte length (not character length) will be placed into *buflen. The document will not be null terminated. If the buffer is not big enough, ENOMEM will be returned, else the actual document status. @result An integer representing the status.
  • Allows the host application to store a chunk of data with each TidyDoc instance. This can be useful for callbacks, such as saving a reference to self within the document.
  • Set the input/output character encoding for parsing markup. Valid values include ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5, and shiftjis. These values are not case sensitive. @note This is the same as using TidySetInCharEncoding() and TidySetOutCharEncoding() to set the same value. @result Returns 0 upon success, or a system standard error number EINVAL.
  • Applications using TidyLib may want to augment command-line and configuration file options. Setting this callback allows a LibTidy application developer to examine command-line and configuration file options after LibTidy has examined them and failed to recognize them. @result Returns yes upon success.
  • Applications using TidyLib may want to be informed when changes to options are made. Temporary changes made internally by Tidy are not reported, but permanent changes made by Tidy (such as indent-spaces or output-encoding) will be reported. @note This callback is not currently implemented. @result Returns yes upon success.
  • Set the file path to use for reports when TidyEmacs is being used. This function provides a proper interface for using the hidden, internal-only TidyEmacsFile configuration option.
  • Set error sink to given buffer. @result Returns 0 upon success or a standard error number.
  • Set error sink to named file. @result Returns a file handle.
  • Set error sink to given generic sink. @result Returns 0 upon success or a standard error number.
  • Give Tidy a free() replacement
  • Set the input encoding for parsing markup. Valid values include ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5, and shiftjis. These values are not case sensitive. @result Returns 0 upon success, or a system standard error number EINVAL.
  • Tells Tidy to use a different language for output. @param languageCode A Windows or POSIX language code, and must match a TIDY_LANGUAGE for an installed language. @result Indicates that a setting was applied, but not necessarily the specific request, i.e., true indicates a language and/or region was applied. If es_mx is requested but not installed, and es is installed, then es will be selected and this function will return true. However the opposite is not true; if es is requested but not present, Tidy will not try to select from the es_XX variants.
  • Give Tidy a malloc() replacement
  • This function informs Tidy to use the specified callback to send reports.
  • Applications using TidyLib may want to augment command-line and configuration file options. Setting this callback allows a LibTidy application developer to examine command-line and configuration file options after LibTidy has examined them and failed to recognize them. Note that this is deprecated and you should instead migrate to tidySetConfigCallback(). @result Returns yes upon success.
  • Set the input encoding for writing markup. Valid values include ascii, latin1, raw, utf8, iso2022, mac, win1252, utf16le, utf16be, utf16, big5, and shiftjis. These values are not case sensitive. @result Returns 0 upon success, or a system standard error number EINVAL.
  • Give Tidy an “out of memory” handler
  • This function informs Tidy to use the specified callback for tracking the pretty-printing process progress.
  • Give Tidy a realloc() replacement
  • This function informs Tidy to use the specified callback to send reports.
  • This function informs Tidy to use the specified callback to send reports.
  • Get status of current document. @param tdoc An instance of a TidyDoc to query. @result Returns the highest of 2 indicating that errors were present in the document, 1 indicating warnings, and 0 in the case of everything being okay.
  • Helper: unget byte back to input source.
  • Indicates the number of TidyWarning messages that were generated. @param tdoc An instance of a TidyDoc to query. @result Returns the number of TidyWarning messages that were generated.

Type Aliases

  • Tidy’s built-in default allocator.
  • //** @defgroup Memory Memory Allocation
  • @name Forward declarations and typedefs. @{
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetConfigCallback(). Your callback function will be provided with the following parameters. @param tdoc The document instance for which the callback was invoked. @param option The option name that was provided. @param value The option value that was provided @return Your callback function will return yes if it handles the provided option, or no if it does not. In the latter case, Tidy will issue an unknown configuration option error.
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetConfigChangeCallback(). Your callback function will be provided with the following parameters. @param tdoc The document instance for which the callback was invoked. @param option The option that will be changed.
  • Input Callback: is end of input?
  • Callback for free replacement
  • Input Callback: get next byte of input
  • This type defines an input source capable of delivering raw bytes of input.
  • Callback for malloc replacement
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetMessageCallback(). Your callback function will be provided with the following parameters. @param tmessage An opaque type used as a token against which other API calls can be made. @return Your callback function will return yes if Tidy should include the report in its own output sink, or no if Tidy should suppress it.
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetOptionCallback(). Your callback function will be provided with the following parameters. Note that this is deprecated and you should instead migrate to tidySetConfigCallback(). @param option The option name that was provided. @param value The option value that was provided @return Your callback function will return yes if it handles the provided option, or no if it does not. In the latter case, Tidy will issue an unknown configuration option error.
  • This type defines an output destination capable of accepting raw bytes of output
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetMessageCallback(). Your callback function will be provided with the following parameters. @param tdoc Indicates the source tidy document. @param line Indicates the line in the source document at this point in the process. @param col Indicates the column in the source document at this point in the process. @param destLine Indicates the line number in the output document at this point in the process.
  • Callback for out of memory panic state
  • Output callback: send a byte to output
  • Callback for realloc replacement
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetReportCallback(). Your callback function will be provided with the following parameters. @param tdoc Indicates the tidy document the message comes from. @param lvl Specifies the TidyReportLevel of the message. @param line Indicates the line number in the source document the message applies to. @param col Indicates the column in the source document the message applies to. @param code Specifies the message code representing the message. Note that this code is a string value that the API promises to hold constant, as opposed to an enum value that can change at any time. Although this is intended so that you can look up your own application’s strings, you can retrieve Tidy’s format string with this code by using tidyErrorCodeFromKey() and then the tidyLocalizedString() family of functions. @param args Is a va_list of arguments used to fill Tidy’s message format string. @return Your callback function will return yes if Tidy should include the report in its own output sink, or no if Tidy should suppress it.
  • This typedef represents the required signature for your provided callback function should you wish to register one with tidySetReportFilter(). Your callback function will be provided with the following parameters. @param tdoc Indicates the tidy document the message comes from. @param lvl Specifies the TidyReportLevel of the message. @param line Indicates the line number in the source document the message applies to. @param col Indicates the column in the source document the message applies to. @param mssg Specifies the complete message as Tidy would emit it. @return Your callback function will return yes if Tidy should include the report in its own output sink, or no if Tidy should suppress it.
  • Input Callback: unget a byte of input