2011-11-17 02:44:16 +00:00
|
|
|
#ifndef __TIDYENUM_H__
|
|
|
|
#define __TIDYENUM_H__
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
/*********************************************************************
|
|
|
|
* Separated public enumerations header
|
|
|
|
*
|
|
|
|
* Simplifies enum re-use in various wrappers, e.g. SWIG, generated
|
|
|
|
* wrappers, and COM IDL files.
|
|
|
|
*
|
|
|
|
* This file also contains macros to generate additional enums for
|
|
|
|
* use in Tidy's language localizations. See detailed information in
|
|
|
|
* comments.
|
|
|
|
*
|
|
|
|
* Enumeration use: LibTidy does *not* guarantee the integer value
|
|
|
|
* of any enumeration label, including the starting integer value.
|
|
|
|
* Always use enums by label in your code, and never by value.
|
|
|
|
*
|
|
|
|
* Enums that have starting values have starting values for a good
|
|
|
|
* reason, mainly to prevent message overlap, because many of these
|
|
|
|
* enums are used for string retrieval.
|
|
|
|
*
|
|
|
|
* (c) 1998-2017 (W3C) MIT, ERCIM, Keio University, HTACG
|
|
|
|
* See tidy.h for the full copyright notice.
|
|
|
|
*
|
|
|
|
* Created 2001-05-20 by Charles Reitzel
|
|
|
|
* Updated 2002-07-01 by Charles Reitzel - 1st Implementation
|
|
|
|
* Further modifications: consult git log.
|
|
|
|
*********************************************************************/
|
2011-11-17 02:44:16 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Enumerate configuration options
|
|
|
|
*/
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
/** Categories of Tidy configuration options. They are used principally
|
|
|
|
** by the console application to generate documentation, and also have
|
|
|
|
** associated localized strings to describe them.
|
2011-11-17 02:44:16 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
2017-02-13 19:29:47 +00:00
|
|
|
TidyMarkup = 300, /**< Markup options: (X)HTML version, etc */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyDiagnostics, /**< Diagnostics */
|
|
|
|
TidyPrettyPrint, /**< Output layout */
|
|
|
|
TidyEncoding, /**< Character encodings */
|
2017-03-09 21:04:03 +00:00
|
|
|
TidyMiscellaneous, /**< File handling, message format, etc. */
|
|
|
|
TidyInternalCategory /**< Option is internal only. */
|
2011-11-17 02:44:16 +00:00
|
|
|
} TidyConfigCategory;
|
|
|
|
|
|
|
|
|
|
|
|
/** Option IDs Used to get/set option values.
|
2016-01-15 04:06:15 +00:00
|
|
|
|
|
|
|
These TidyOptionId are used throughout libtidy, and also
|
|
|
|
have associated localized strings to describe them.
|
2017-03-08 15:29:41 +00:00
|
|
|
|
|
|
|
Ensure struct order is same order as config.c:option_defs structure!
|
2011-11-17 02:44:16 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyUnknownOption = 0, /**< Unknown option! */
|
2017-03-08 15:29:41 +00:00
|
|
|
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyAccessibilityCheckLevel, /**< Accessibility check level */
|
|
|
|
TidyAltText, /**< Default text for alt attribute */
|
|
|
|
TidyAnchorAsName, /**< Define anchors as name attributes */
|
|
|
|
TidyAsciiChars, /**< Convert quotes and dashes to nearest ASCII char */
|
|
|
|
TidyBlockTags, /**< Declared block tags */
|
|
|
|
TidyBodyOnly, /**< Output BODY content only */
|
|
|
|
TidyBreakBeforeBR, /**< Output newline before <br> or not? */
|
|
|
|
TidyCharEncoding, /**< In/out character encoding */
|
|
|
|
TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */
|
|
|
|
TidyCSSPrefix, /**< CSS class naming for clean option */
|
2017-03-18 15:20:56 +00:00
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
|
|
TidyCustomTags, /**< Internal use ONLY */
|
|
|
|
#endif
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyDecorateInferredUL, /**< Mark inferred UL elements with no indent CSS */
|
|
|
|
TidyDoctype, /**< User specified doctype */
|
2017-03-08 15:29:41 +00:00
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyDoctypeMode, /**< Internal use ONLY */
|
|
|
|
#endif
|
|
|
|
TidyDropEmptyElems, /**< Discard empty elements */
|
|
|
|
TidyDropEmptyParas, /**< Discard empty p elements */
|
|
|
|
TidyDropFontTags, /**< Discard presentation tags */
|
|
|
|
TidyDropPropAttrs, /**< Discard proprietary attributes */
|
|
|
|
TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */
|
|
|
|
TidyEmacs, /**< If true, format error output for GNU Emacs */
|
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
|
|
TidyEmacsFile, /**< Internal use ONLY */
|
|
|
|
#endif
|
|
|
|
TidyEmptyTags, /**< Declared empty tags */
|
|
|
|
TidyEncloseBlockText, /**< If yes text in blocks is wrapped in P's */
|
|
|
|
TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */
|
|
|
|
TidyErrFile, /**< File name to write errors to */
|
|
|
|
TidyEscapeCdata, /**< Replace <![CDATA[]]> sections with escaped text */
|
|
|
|
TidyEscapeScripts, /**< Escape items that look like closing tags in script tags */
|
|
|
|
TidyFixBackslash, /**< Fix URLs by replacing \ with / */
|
|
|
|
TidyFixComments, /**< Fix comments with adjacent hyphens */
|
|
|
|
TidyFixUri, /**< Applies URI encoding if necessary */
|
|
|
|
TidyForceOutput, /**< Output document even if errors were found */
|
|
|
|
TidyGDocClean, /**< Clean up HTML exported from Google Docs */
|
|
|
|
TidyHideComments, /**< Hides all (real) comments in output */
|
|
|
|
TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */
|
|
|
|
TidyHtmlOut, /**< Output plain HTML, even for XHTML input.*/
|
|
|
|
TidyInCharEncoding, /**< Input character encoding (if different) */
|
|
|
|
TidyIndentAttributes, /**< Newline+indent before each attribute */
|
|
|
|
TidyIndentCdata, /**< Indent <!CDATA[ ... ]]> section */
|
|
|
|
TidyIndentContent, /**< Indent content of appropriate tags */
|
|
|
|
TidyIndentSpaces, /**< Indentation n spaces/tabs */
|
|
|
|
TidyInlineTags, /**< Declared inline tags */
|
|
|
|
TidyJoinClasses, /**< Join multiple class attributes */
|
|
|
|
TidyJoinStyles, /**< Join multiple style attributes */
|
|
|
|
TidyKeepFileTimes, /**< If yes last modied time is preserved */
|
|
|
|
TidyLiteralAttribs, /**< If true attributes may use newlines */
|
|
|
|
TidyLogicalEmphasis, /**< Replace i by em and b by strong */
|
|
|
|
TidyLowerLiterals, /**< Folds known attribute values to lower case */
|
|
|
|
TidyMakeBare, /**< Make bare HTML: remove Microsoft cruft */
|
|
|
|
TidyMakeClean, /**< Replace presentational clutter by style rules */
|
|
|
|
TidyMark, /**< Add meta element indicating tidied doc */
|
|
|
|
TidyMergeDivs, /**< Merge multiple DIVs */
|
|
|
|
TidyMergeEmphasis, /**< Merge nested B and I elements */
|
|
|
|
TidyMergeSpans, /**< Merge multiple SPANs */
|
2011-11-17 02:44:16 +00:00
|
|
|
#if SUPPORT_ASIAN_ENCODINGS
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyNCR, /**< Allow numeric character references */
|
2011-11-17 02:44:16 +00:00
|
|
|
#else
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyNCRNotUsed, /**< This option is not compiled in */
|
2011-11-17 02:44:16 +00:00
|
|
|
#endif
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyNewline, /**< Output line ending (default to platform) */
|
|
|
|
TidyNumEntities, /**< Use numeric entities */
|
|
|
|
TidyOmitOptionalTags, /**< Suppress optional start tags and end tags */
|
|
|
|
TidyOutCharEncoding, /**< Output character encoding (if different) */
|
|
|
|
TidyOutFile, /**< File name to write markup to */
|
2011-11-17 02:44:16 +00:00
|
|
|
#if SUPPORT_UTF16_ENCODINGS
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyOutputBOM, /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */
|
2011-11-17 02:44:16 +00:00
|
|
|
#else
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyOutputBOMNotUsed, /**< This option is not compiled in */
|
2011-11-17 02:44:16 +00:00
|
|
|
#endif
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyPPrintTabs, /**< Indent using tabs istead of spaces */
|
|
|
|
TidyPreserveEntities, /**< Preserve entities */
|
|
|
|
TidyPreTags, /**< Declared pre tags */
|
2011-11-17 02:44:16 +00:00
|
|
|
#if SUPPORT_ASIAN_ENCODINGS
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyPunctWrap, /**< consider punctuation and breaking spaces for wrapping */
|
2011-11-17 02:44:16 +00:00
|
|
|
#else
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyPunctWrapNotUsed, /**< This option is not compiled in */
|
2011-11-17 02:44:16 +00:00
|
|
|
#endif
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyQuiet, /**< No 'Parsing X', guessed DTD or summary */
|
|
|
|
TidyQuoteAmpersand, /**< Output naked ampersand as & */
|
|
|
|
TidyQuoteMarks, /**< Output " marks as " */
|
|
|
|
TidyQuoteNbsp, /**< Output non-breaking space as entity */
|
|
|
|
TidyReplaceColor, /**< Replace hex color attribute values with names */
|
|
|
|
TidyShowErrors, /**< Number of errors to put out */
|
|
|
|
TidyShowInfo, /**< If true, info-level messages are shown */
|
|
|
|
TidyShowMarkup, /**< If false, normal output is suppressed */
|
|
|
|
TidyShowWarnings, /**< However errors are always shown */
|
|
|
|
TidySkipNested, /**< Skip nested tags in script and style CDATA */
|
|
|
|
TidySortAttributes, /**< Sort attributes */
|
|
|
|
TidyStrictTagsAttr, /**< Ensure tags and attributes match output HTML version */
|
|
|
|
TidyTabSize, /**< Expand tabs to n spaces */
|
|
|
|
TidyUpperCaseAttrs, /**< Output attributes in upper not lower case */
|
|
|
|
TidyUpperCaseTags, /**< Output tags in upper not lower case */
|
2017-03-18 15:20:56 +00:00
|
|
|
TidyUseCustomTags, /**< Enable Tidy to use autonomous custom tags */
|
2017-03-10 13:24:23 +00:00
|
|
|
TidyVertSpace, /**< degree to which markup is spread out vertically */
|
|
|
|
TidyWord2000, /**< Draconian cleaning for Word2000 */
|
|
|
|
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
|
|
|
|
TidyWrapAttVals, /**< Wrap within attribute values */
|
|
|
|
TidyWrapJste, /**< Wrap within JSTE pseudo elements */
|
|
|
|
TidyWrapLen, /**< Wrap margin */
|
|
|
|
TidyWrapPhp, /**< Wrap within PHP pseudo elements */
|
|
|
|
TidyWrapScriptlets, /**< Wrap within JavaScript string literals */
|
|
|
|
TidyWrapSection, /**< Wrap within <![ ... ]> section tags */
|
|
|
|
TidyWriteBack, /**< If true then output tidied markup */
|
|
|
|
TidyXhtmlOut, /**< Output extensible HTML */
|
|
|
|
TidyXmlDecl, /**< Add <?xml?> for XML docs */
|
|
|
|
TidyXmlOut, /**< Create output as XML */
|
|
|
|
TidyXmlPIs, /**< If set to yes PIs must end with ?> */
|
|
|
|
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */
|
|
|
|
TidyXmlTags, /**< Treat input as XML */
|
|
|
|
N_TIDY_OPTIONS /**< Must be last */
|
2011-11-17 02:44:16 +00:00
|
|
|
} TidyOptionId;
|
|
|
|
|
2016-01-15 04:06:15 +00:00
|
|
|
|
2011-11-17 02:44:16 +00:00
|
|
|
/** Option data types
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyString, /**< String */
|
|
|
|
TidyInteger, /**< Integer or enumeration */
|
|
|
|
TidyBoolean /**< Boolean flag */
|
|
|
|
} TidyOptionType;
|
|
|
|
|
|
|
|
|
|
|
|
/** AutoBool values used by ParseBool, ParseTriState, ParseIndent, ParseBOM
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyNoState, /**< maps to 'no' */
|
|
|
|
TidyYesState, /**< maps to 'yes' */
|
|
|
|
TidyAutoState /**< Automatic */
|
|
|
|
} TidyTriState;
|
|
|
|
|
2017-03-13 17:45:32 +00:00
|
|
|
/** Integer values used by ParseUseCustomTags. These are used throughout
|
|
|
|
* LibTidy to indicate the how Tidy treats custom tags, and also have
|
|
|
|
* associated localized strings to describe them.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyCustomNo = 300,
|
|
|
|
TidyCustomBlocklevel,
|
|
|
|
TidyCustomEmpty,
|
|
|
|
TidyCustomInline,
|
|
|
|
TidyCustomPre
|
|
|
|
} TidyUseCustomTagsState;
|
|
|
|
|
2011-11-17 02:44:16 +00:00
|
|
|
/** TidyNewline option values to control output line endings.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyLF, /**< Use Unix style: LF */
|
|
|
|
TidyCRLF, /**< Use DOS/Windows style: CR+LF */
|
|
|
|
TidyCR /**< Use Macintosh style: CR */
|
|
|
|
} TidyLineEnding;
|
|
|
|
|
|
|
|
|
|
|
|
/** Mode controlling treatment of doctype
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
2012-03-15 05:11:01 +00:00
|
|
|
TidyDoctypeHtml5, /**< <!DOCTYPE html> */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyDoctypeOmit, /**< Omit DOCTYPE altogether */
|
|
|
|
TidyDoctypeAuto, /**< Keep DOCTYPE in input. Set version to content */
|
|
|
|
TidyDoctypeStrict, /**< Convert document to HTML 4 strict content model */
|
|
|
|
TidyDoctypeLoose, /**< Convert document to HTML 4 transitional
|
|
|
|
content model */
|
|
|
|
TidyDoctypeUser /**< Set DOCTYPE FPI explicitly */
|
|
|
|
} TidyDoctypeModes;
|
|
|
|
|
|
|
|
/** Mode controlling treatment of duplicate Attributes
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyKeepFirst,
|
|
|
|
TidyKeepLast
|
|
|
|
} TidyDupAttrModes;
|
|
|
|
|
|
|
|
/** Mode controlling treatment of sorting attributes
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidySortAttrNone,
|
|
|
|
TidySortAttrAlpha
|
|
|
|
} TidyAttrSortStrategy;
|
|
|
|
|
2016-01-15 04:06:15 +00:00
|
|
|
|
2011-11-17 02:44:16 +00:00
|
|
|
/* I/O and Message handling interface
|
|
|
|
**
|
2017-02-13 19:29:47 +00:00
|
|
|
** By default, Tidy will define, create and use instances of input and output
|
|
|
|
** handlers for standard C buffered I/O (i.e. FILE* stdin, ** FILE* stdout and
|
|
|
|
** FILE* stderr for content input, content output and diagnostic output,
|
|
|
|
** respectively. A FILE* cfgFile input handler will be used for config files.
|
|
|
|
** Command line options will just be set directly.
|
2011-11-17 02:44:16 +00:00
|
|
|
*/
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
/** Message severity level. These are used throughout LibTidy to indicate the
|
|
|
|
* severity of a message, and they also have associated localized strings to
|
|
|
|
* describe them.
|
|
|
|
*/
|
2013-06-28 23:20:02 +00:00
|
|
|
typedef enum
|
2011-11-17 02:44:16 +00:00
|
|
|
{
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
TidyReportLevel_first = 350,
|
|
|
|
TidyInfo = 350, /**< Report: Information about markup usage */
|
|
|
|
TidyWarning, /**< Report: Warning message */
|
|
|
|
TidyConfig, /**< Report: Configuration error */
|
|
|
|
TidyAccess, /**< Report: Accessibility message */
|
|
|
|
TidyError, /**< Report: Error message - output suppressed */
|
|
|
|
TidyBadDocument, /**< Report: I/O or file system error */
|
|
|
|
TidyFatal, /**< Report: Crash! */
|
|
|
|
TidyDialogueInfo, /**< Dialogue: Non-document related information */
|
|
|
|
TidyDialogueSummary, /**< Dialogue: Summary-related information */
|
|
|
|
TidyDialogueDoc, /**< Dialogue: Document-related information */
|
|
|
|
TidyReportLevel_last
|
2011-11-17 02:44:16 +00:00
|
|
|
} TidyReportLevel;
|
|
|
|
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
|
|
|
|
/** 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.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
tidyFormatType_INT = 0,
|
|
|
|
tidyFormatType_UINT,
|
|
|
|
tidyFormatType_STRING,
|
|
|
|
tidyFormatType_DOUBLE,
|
|
|
|
tidyFormatType_UNKNOWN = 20
|
|
|
|
} TidyFormatParameterType;
|
2011-11-17 02:44:16 +00:00
|
|
|
|
|
|
|
/* Document tree traversal functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Node types
|
|
|
|
*/
|
2013-06-28 23:20:02 +00:00
|
|
|
typedef enum
|
2011-11-17 02:44:16 +00:00
|
|
|
{
|
|
|
|
TidyNode_Root, /**< Root */
|
|
|
|
TidyNode_DocType, /**< DOCTYPE */
|
|
|
|
TidyNode_Comment, /**< Comment */
|
|
|
|
TidyNode_ProcIns, /**< Processing Instruction */
|
|
|
|
TidyNode_Text, /**< Text */
|
|
|
|
TidyNode_Start, /**< Start Tag */
|
|
|
|
TidyNode_End, /**< End Tag */
|
|
|
|
TidyNode_StartEnd, /**< Start/End (empty) Tag */
|
|
|
|
TidyNode_CDATA, /**< Unparsed Text */
|
|
|
|
TidyNode_Section, /**< XML Section */
|
|
|
|
TidyNode_Asp, /**< ASP Source */
|
|
|
|
TidyNode_Jste, /**< JSTE Source */
|
|
|
|
TidyNode_Php, /**< PHP Source */
|
|
|
|
TidyNode_XmlDecl /**< XML Declaration */
|
|
|
|
} TidyNodeType;
|
|
|
|
|
|
|
|
|
|
|
|
/** Known HTML element types
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyTag_UNKNOWN, /**< Unknown tag! */
|
|
|
|
TidyTag_A, /**< A */
|
|
|
|
TidyTag_ABBR, /**< ABBR */
|
|
|
|
TidyTag_ACRONYM, /**< ACRONYM */
|
|
|
|
TidyTag_ADDRESS, /**< ADDRESS */
|
|
|
|
TidyTag_ALIGN, /**< ALIGN */
|
|
|
|
TidyTag_APPLET, /**< APPLET */
|
|
|
|
TidyTag_AREA, /**< AREA */
|
|
|
|
TidyTag_B, /**< B */
|
|
|
|
TidyTag_BASE, /**< BASE */
|
|
|
|
TidyTag_BASEFONT, /**< BASEFONT */
|
|
|
|
TidyTag_BDO, /**< BDO */
|
|
|
|
TidyTag_BGSOUND, /**< BGSOUND */
|
|
|
|
TidyTag_BIG, /**< BIG */
|
|
|
|
TidyTag_BLINK, /**< BLINK */
|
|
|
|
TidyTag_BLOCKQUOTE, /**< BLOCKQUOTE */
|
|
|
|
TidyTag_BODY, /**< BODY */
|
|
|
|
TidyTag_BR, /**< BR */
|
|
|
|
TidyTag_BUTTON, /**< BUTTON */
|
|
|
|
TidyTag_CAPTION, /**< CAPTION */
|
|
|
|
TidyTag_CENTER, /**< CENTER */
|
|
|
|
TidyTag_CITE, /**< CITE */
|
|
|
|
TidyTag_CODE, /**< CODE */
|
|
|
|
TidyTag_COL, /**< COL */
|
|
|
|
TidyTag_COLGROUP, /**< COLGROUP */
|
|
|
|
TidyTag_COMMENT, /**< COMMENT */
|
|
|
|
TidyTag_DD, /**< DD */
|
|
|
|
TidyTag_DEL, /**< DEL */
|
|
|
|
TidyTag_DFN, /**< DFN */
|
|
|
|
TidyTag_DIR, /**< DIR */
|
|
|
|
TidyTag_DIV, /**< DIF */
|
|
|
|
TidyTag_DL, /**< DL */
|
|
|
|
TidyTag_DT, /**< DT */
|
|
|
|
TidyTag_EM, /**< EM */
|
|
|
|
TidyTag_EMBED, /**< EMBED */
|
|
|
|
TidyTag_FIELDSET, /**< FIELDSET */
|
|
|
|
TidyTag_FONT, /**< FONT */
|
|
|
|
TidyTag_FORM, /**< FORM */
|
|
|
|
TidyTag_FRAME, /**< FRAME */
|
|
|
|
TidyTag_FRAMESET, /**< FRAMESET */
|
|
|
|
TidyTag_H1, /**< H1 */
|
|
|
|
TidyTag_H2, /**< H2 */
|
|
|
|
TidyTag_H3, /**< H3 */
|
|
|
|
TidyTag_H4, /**< H4 */
|
|
|
|
TidyTag_H5, /**< H5 */
|
|
|
|
TidyTag_H6, /**< H6 */
|
|
|
|
TidyTag_HEAD, /**< HEAD */
|
|
|
|
TidyTag_HR, /**< HR */
|
|
|
|
TidyTag_HTML, /**< HTML */
|
|
|
|
TidyTag_I, /**< I */
|
|
|
|
TidyTag_IFRAME, /**< IFRAME */
|
|
|
|
TidyTag_ILAYER, /**< ILAYER */
|
|
|
|
TidyTag_IMG, /**< IMG */
|
|
|
|
TidyTag_INPUT, /**< INPUT */
|
|
|
|
TidyTag_INS, /**< INS */
|
|
|
|
TidyTag_ISINDEX, /**< ISINDEX */
|
|
|
|
TidyTag_KBD, /**< KBD */
|
|
|
|
TidyTag_KEYGEN, /**< KEYGEN */
|
|
|
|
TidyTag_LABEL, /**< LABEL */
|
|
|
|
TidyTag_LAYER, /**< LAYER */
|
|
|
|
TidyTag_LEGEND, /**< LEGEND */
|
|
|
|
TidyTag_LI, /**< LI */
|
|
|
|
TidyTag_LINK, /**< LINK */
|
|
|
|
TidyTag_LISTING, /**< LISTING */
|
|
|
|
TidyTag_MAP, /**< MAP */
|
2015-02-05 11:21:08 +00:00
|
|
|
TidyTag_MATHML, /**< MATH (HTML5) [i_a]2 MathML embedded in [X]HTML */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_MARQUEE, /**< MARQUEE */
|
|
|
|
TidyTag_MENU, /**< MENU */
|
|
|
|
TidyTag_META, /**< META */
|
|
|
|
TidyTag_MULTICOL, /**< MULTICOL */
|
|
|
|
TidyTag_NOBR, /**< NOBR */
|
|
|
|
TidyTag_NOEMBED, /**< NOEMBED */
|
|
|
|
TidyTag_NOFRAMES, /**< NOFRAMES */
|
|
|
|
TidyTag_NOLAYER, /**< NOLAYER */
|
|
|
|
TidyTag_NOSAVE, /**< NOSAVE */
|
|
|
|
TidyTag_NOSCRIPT, /**< NOSCRIPT */
|
|
|
|
TidyTag_OBJECT, /**< OBJECT */
|
|
|
|
TidyTag_OL, /**< OL */
|
|
|
|
TidyTag_OPTGROUP, /**< OPTGROUP */
|
|
|
|
TidyTag_OPTION, /**< OPTION */
|
|
|
|
TidyTag_P, /**< P */
|
|
|
|
TidyTag_PARAM, /**< PARAM */
|
2015-02-07 12:39:16 +00:00
|
|
|
TidyTag_PICTURE, /**< PICTURE (HTML5) */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_PLAINTEXT,/**< PLAINTEXT */
|
|
|
|
TidyTag_PRE, /**< PRE */
|
|
|
|
TidyTag_Q, /**< Q */
|
|
|
|
TidyTag_RB, /**< RB */
|
|
|
|
TidyTag_RBC, /**< RBC */
|
|
|
|
TidyTag_RP, /**< RP */
|
|
|
|
TidyTag_RT, /**< RT */
|
|
|
|
TidyTag_RTC, /**< RTC */
|
|
|
|
TidyTag_RUBY, /**< RUBY */
|
|
|
|
TidyTag_S, /**< S */
|
|
|
|
TidyTag_SAMP, /**< SAMP */
|
|
|
|
TidyTag_SCRIPT, /**< SCRIPT */
|
|
|
|
TidyTag_SELECT, /**< SELECT */
|
|
|
|
TidyTag_SERVER, /**< SERVER */
|
|
|
|
TidyTag_SERVLET, /**< SERVLET */
|
|
|
|
TidyTag_SMALL, /**< SMALL */
|
|
|
|
TidyTag_SPACER, /**< SPACER */
|
|
|
|
TidyTag_SPAN, /**< SPAN */
|
|
|
|
TidyTag_STRIKE, /**< STRIKE */
|
|
|
|
TidyTag_STRONG, /**< STRONG */
|
|
|
|
TidyTag_STYLE, /**< STYLE */
|
|
|
|
TidyTag_SUB, /**< SUB */
|
|
|
|
TidyTag_SUP, /**< SUP */
|
2015-02-02 16:25:49 +00:00
|
|
|
TidyTag_SVG, /**< SVG (HTML5) */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_TABLE, /**< TABLE */
|
|
|
|
TidyTag_TBODY, /**< TBODY */
|
|
|
|
TidyTag_TD, /**< TD */
|
|
|
|
TidyTag_TEXTAREA, /**< TEXTAREA */
|
|
|
|
TidyTag_TFOOT, /**< TFOOT */
|
|
|
|
TidyTag_TH, /**< TH */
|
|
|
|
TidyTag_THEAD, /**< THEAD */
|
|
|
|
TidyTag_TITLE, /**< TITLE */
|
|
|
|
TidyTag_TR, /**< TR */
|
|
|
|
TidyTag_TT, /**< TT */
|
|
|
|
TidyTag_U, /**< U */
|
|
|
|
TidyTag_UL, /**< UL */
|
|
|
|
TidyTag_VAR, /**< VAR */
|
|
|
|
TidyTag_WBR, /**< WBR */
|
|
|
|
TidyTag_XMP, /**< XMP */
|
|
|
|
TidyTag_NEXTID, /**< NEXTID */
|
|
|
|
|
|
|
|
TidyTag_ARTICLE,
|
|
|
|
TidyTag_ASIDE,
|
|
|
|
TidyTag_AUDIO,
|
2014-11-22 07:42:28 +00:00
|
|
|
TidyTag_BDI,
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_CANVAS,
|
|
|
|
TidyTag_COMMAND,
|
|
|
|
TidyTag_DATALIST,
|
|
|
|
TidyTag_DETAILS,
|
2014-11-22 07:42:28 +00:00
|
|
|
TidyTag_DIALOG,
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_FIGCAPTION,
|
|
|
|
TidyTag_FIGURE,
|
|
|
|
TidyTag_FOOTER,
|
|
|
|
TidyTag_HEADER,
|
|
|
|
TidyTag_HGROUP,
|
2014-11-22 07:42:28 +00:00
|
|
|
TidyTag_MAIN,
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_MARK,
|
2014-11-22 07:42:28 +00:00
|
|
|
TidyTag_MENUITEM,
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_METER,
|
|
|
|
TidyTag_NAV,
|
|
|
|
TidyTag_OUTPUT,
|
|
|
|
TidyTag_PROGRESS,
|
|
|
|
TidyTag_SECTION,
|
|
|
|
TidyTag_SOURCE,
|
|
|
|
TidyTag_SUMMARY,
|
2015-04-10 22:42:49 +00:00
|
|
|
TidyTag_TEMPLATE,
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyTag_TIME,
|
|
|
|
TidyTag_TRACK,
|
|
|
|
TidyTag_VIDEO,
|
|
|
|
|
|
|
|
N_TIDY_TAGS /**< Must be last */
|
|
|
|
} TidyTagId;
|
|
|
|
|
|
|
|
/* Attribute interrogation
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Known HTML attributes
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TidyAttr_UNKNOWN, /**< UNKNOWN= */
|
|
|
|
TidyAttr_ABBR, /**< ABBR= */
|
|
|
|
TidyAttr_ACCEPT, /**< ACCEPT= */
|
|
|
|
TidyAttr_ACCEPT_CHARSET, /**< ACCEPT_CHARSET= */
|
|
|
|
TidyAttr_ACCESSKEY, /**< ACCESSKEY= */
|
|
|
|
TidyAttr_ACTION, /**< ACTION= */
|
|
|
|
TidyAttr_ADD_DATE, /**< ADD_DATE= */
|
|
|
|
TidyAttr_ALIGN, /**< ALIGN= */
|
|
|
|
TidyAttr_ALINK, /**< ALINK= */
|
2016-02-12 11:34:19 +00:00
|
|
|
TidyAttr_ALLOWFULLSCREEN, /**< ALLOWFULLSCREEN= */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_ALT, /**< ALT= */
|
|
|
|
TidyAttr_ARCHIVE, /**< ARCHIVE= */
|
|
|
|
TidyAttr_AXIS, /**< AXIS= */
|
|
|
|
TidyAttr_BACKGROUND, /**< BACKGROUND= */
|
|
|
|
TidyAttr_BGCOLOR, /**< BGCOLOR= */
|
|
|
|
TidyAttr_BGPROPERTIES, /**< BGPROPERTIES= */
|
|
|
|
TidyAttr_BORDER, /**< BORDER= */
|
|
|
|
TidyAttr_BORDERCOLOR, /**< BORDERCOLOR= */
|
|
|
|
TidyAttr_BOTTOMMARGIN, /**< BOTTOMMARGIN= */
|
|
|
|
TidyAttr_CELLPADDING, /**< CELLPADDING= */
|
|
|
|
TidyAttr_CELLSPACING, /**< CELLSPACING= */
|
|
|
|
TidyAttr_CHAR, /**< CHAR= */
|
|
|
|
TidyAttr_CHAROFF, /**< CHAROFF= */
|
|
|
|
TidyAttr_CHARSET, /**< CHARSET= */
|
|
|
|
TidyAttr_CHECKED, /**< CHECKED= */
|
|
|
|
TidyAttr_CITE, /**< CITE= */
|
|
|
|
TidyAttr_CLASS, /**< CLASS= */
|
|
|
|
TidyAttr_CLASSID, /**< CLASSID= */
|
|
|
|
TidyAttr_CLEAR, /**< CLEAR= */
|
|
|
|
TidyAttr_CODE, /**< CODE= */
|
|
|
|
TidyAttr_CODEBASE, /**< CODEBASE= */
|
|
|
|
TidyAttr_CODETYPE, /**< CODETYPE= */
|
|
|
|
TidyAttr_COLOR, /**< COLOR= */
|
|
|
|
TidyAttr_COLS, /**< COLS= */
|
|
|
|
TidyAttr_COLSPAN, /**< COLSPAN= */
|
|
|
|
TidyAttr_COMPACT, /**< COMPACT= */
|
|
|
|
TidyAttr_CONTENT, /**< CONTENT= */
|
|
|
|
TidyAttr_COORDS, /**< COORDS= */
|
|
|
|
TidyAttr_DATA, /**< DATA= */
|
|
|
|
TidyAttr_DATAFLD, /**< DATAFLD= */
|
|
|
|
TidyAttr_DATAFORMATAS, /**< DATAFORMATAS= */
|
|
|
|
TidyAttr_DATAPAGESIZE, /**< DATAPAGESIZE= */
|
|
|
|
TidyAttr_DATASRC, /**< DATASRC= */
|
|
|
|
TidyAttr_DATETIME, /**< DATETIME= */
|
|
|
|
TidyAttr_DECLARE, /**< DECLARE= */
|
|
|
|
TidyAttr_DEFER, /**< DEFER= */
|
|
|
|
TidyAttr_DIR, /**< DIR= */
|
|
|
|
TidyAttr_DISABLED, /**< DISABLED= */
|
|
|
|
TidyAttr_ENCODING, /**< ENCODING= */
|
|
|
|
TidyAttr_ENCTYPE, /**< ENCTYPE= */
|
|
|
|
TidyAttr_FACE, /**< FACE= */
|
|
|
|
TidyAttr_FOR, /**< FOR= */
|
|
|
|
TidyAttr_FRAME, /**< FRAME= */
|
|
|
|
TidyAttr_FRAMEBORDER, /**< FRAMEBORDER= */
|
|
|
|
TidyAttr_FRAMESPACING, /**< FRAMESPACING= */
|
|
|
|
TidyAttr_GRIDX, /**< GRIDX= */
|
|
|
|
TidyAttr_GRIDY, /**< GRIDY= */
|
|
|
|
TidyAttr_HEADERS, /**< HEADERS= */
|
|
|
|
TidyAttr_HEIGHT, /**< HEIGHT= */
|
|
|
|
TidyAttr_HREF, /**< HREF= */
|
|
|
|
TidyAttr_HREFLANG, /**< HREFLANG= */
|
|
|
|
TidyAttr_HSPACE, /**< HSPACE= */
|
|
|
|
TidyAttr_HTTP_EQUIV, /**< HTTP_EQUIV= */
|
|
|
|
TidyAttr_ID, /**< ID= */
|
2017-03-13 17:45:32 +00:00
|
|
|
TidyAttr_IS, /**< IS= */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_ISMAP, /**< ISMAP= */
|
2014-11-22 11:32:30 +00:00
|
|
|
TidyAttr_ITEMID, /**< ITEMID= */
|
2011-11-20 11:58:35 +00:00
|
|
|
TidyAttr_ITEMPROP, /**< ITEMPROP= */
|
2014-11-22 11:32:30 +00:00
|
|
|
TidyAttr_ITEMREF, /**< ITEMREF= */
|
|
|
|
TidyAttr_ITEMSCOPE, /**< ITEMSCOPE= */
|
|
|
|
TidyAttr_ITEMTYPE, /**< ITEMTYPE= */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_LABEL, /**< LABEL= */
|
|
|
|
TidyAttr_LANG, /**< LANG= */
|
|
|
|
TidyAttr_LANGUAGE, /**< LANGUAGE= */
|
|
|
|
TidyAttr_LAST_MODIFIED, /**< LAST_MODIFIED= */
|
|
|
|
TidyAttr_LAST_VISIT, /**< LAST_VISIT= */
|
|
|
|
TidyAttr_LEFTMARGIN, /**< LEFTMARGIN= */
|
|
|
|
TidyAttr_LINK, /**< LINK= */
|
|
|
|
TidyAttr_LONGDESC, /**< LONGDESC= */
|
|
|
|
TidyAttr_LOWSRC, /**< LOWSRC= */
|
|
|
|
TidyAttr_MARGINHEIGHT, /**< MARGINHEIGHT= */
|
|
|
|
TidyAttr_MARGINWIDTH, /**< MARGINWIDTH= */
|
|
|
|
TidyAttr_MAXLENGTH, /**< MAXLENGTH= */
|
|
|
|
TidyAttr_MEDIA, /**< MEDIA= */
|
|
|
|
TidyAttr_METHOD, /**< METHOD= */
|
|
|
|
TidyAttr_MULTIPLE, /**< MULTIPLE= */
|
|
|
|
TidyAttr_NAME, /**< NAME= */
|
|
|
|
TidyAttr_NOHREF, /**< NOHREF= */
|
|
|
|
TidyAttr_NORESIZE, /**< NORESIZE= */
|
|
|
|
TidyAttr_NOSHADE, /**< NOSHADE= */
|
|
|
|
TidyAttr_NOWRAP, /**< NOWRAP= */
|
|
|
|
TidyAttr_OBJECT, /**< OBJECT= */
|
|
|
|
TidyAttr_OnAFTERUPDATE, /**< OnAFTERUPDATE= */
|
|
|
|
TidyAttr_OnBEFOREUNLOAD, /**< OnBEFOREUNLOAD= */
|
|
|
|
TidyAttr_OnBEFOREUPDATE, /**< OnBEFOREUPDATE= */
|
|
|
|
TidyAttr_OnBLUR, /**< OnBLUR= */
|
|
|
|
TidyAttr_OnCHANGE, /**< OnCHANGE= */
|
|
|
|
TidyAttr_OnCLICK, /**< OnCLICK= */
|
|
|
|
TidyAttr_OnDATAAVAILABLE, /**< OnDATAAVAILABLE= */
|
|
|
|
TidyAttr_OnDATASETCHANGED, /**< OnDATASETCHANGED= */
|
|
|
|
TidyAttr_OnDATASETCOMPLETE, /**< OnDATASETCOMPLETE= */
|
|
|
|
TidyAttr_OnDBLCLICK, /**< OnDBLCLICK= */
|
|
|
|
TidyAttr_OnERRORUPDATE, /**< OnERRORUPDATE= */
|
|
|
|
TidyAttr_OnFOCUS, /**< OnFOCUS= */
|
|
|
|
TidyAttr_OnKEYDOWN, /**< OnKEYDOWN= */
|
|
|
|
TidyAttr_OnKEYPRESS, /**< OnKEYPRESS= */
|
|
|
|
TidyAttr_OnKEYUP, /**< OnKEYUP= */
|
|
|
|
TidyAttr_OnLOAD, /**< OnLOAD= */
|
|
|
|
TidyAttr_OnMOUSEDOWN, /**< OnMOUSEDOWN= */
|
|
|
|
TidyAttr_OnMOUSEMOVE, /**< OnMOUSEMOVE= */
|
|
|
|
TidyAttr_OnMOUSEOUT, /**< OnMOUSEOUT= */
|
|
|
|
TidyAttr_OnMOUSEOVER, /**< OnMOUSEOVER= */
|
|
|
|
TidyAttr_OnMOUSEUP, /**< OnMOUSEUP= */
|
|
|
|
TidyAttr_OnRESET, /**< OnRESET= */
|
|
|
|
TidyAttr_OnROWENTER, /**< OnROWENTER= */
|
|
|
|
TidyAttr_OnROWEXIT, /**< OnROWEXIT= */
|
|
|
|
TidyAttr_OnSELECT, /**< OnSELECT= */
|
|
|
|
TidyAttr_OnSUBMIT, /**< OnSUBMIT= */
|
|
|
|
TidyAttr_OnUNLOAD, /**< OnUNLOAD= */
|
|
|
|
TidyAttr_PROFILE, /**< PROFILE= */
|
|
|
|
TidyAttr_PROMPT, /**< PROMPT= */
|
|
|
|
TidyAttr_RBSPAN, /**< RBSPAN= */
|
|
|
|
TidyAttr_READONLY, /**< READONLY= */
|
|
|
|
TidyAttr_REL, /**< REL= */
|
|
|
|
TidyAttr_REV, /**< REV= */
|
|
|
|
TidyAttr_RIGHTMARGIN, /**< RIGHTMARGIN= */
|
2014-11-22 12:44:38 +00:00
|
|
|
TidyAttr_ROLE, /**< ROLE= */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_ROWS, /**< ROWS= */
|
|
|
|
TidyAttr_ROWSPAN, /**< ROWSPAN= */
|
|
|
|
TidyAttr_RULES, /**< RULES= */
|
|
|
|
TidyAttr_SCHEME, /**< SCHEME= */
|
|
|
|
TidyAttr_SCOPE, /**< SCOPE= */
|
|
|
|
TidyAttr_SCROLLING, /**< SCROLLING= */
|
|
|
|
TidyAttr_SELECTED, /**< SELECTED= */
|
|
|
|
TidyAttr_SHAPE, /**< SHAPE= */
|
|
|
|
TidyAttr_SHOWGRID, /**< SHOWGRID= */
|
|
|
|
TidyAttr_SHOWGRIDX, /**< SHOWGRIDX= */
|
|
|
|
TidyAttr_SHOWGRIDY, /**< SHOWGRIDY= */
|
|
|
|
TidyAttr_SIZE, /**< SIZE= */
|
|
|
|
TidyAttr_SPAN, /**< SPAN= */
|
|
|
|
TidyAttr_SRC, /**< SRC= */
|
2015-02-06 18:24:04 +00:00
|
|
|
TidyAttr_SRCSET, /**< SRCSET= (HTML5) */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_STANDBY, /**< STANDBY= */
|
|
|
|
TidyAttr_START, /**< START= */
|
|
|
|
TidyAttr_STYLE, /**< STYLE= */
|
|
|
|
TidyAttr_SUMMARY, /**< SUMMARY= */
|
|
|
|
TidyAttr_TABINDEX, /**< TABINDEX= */
|
|
|
|
TidyAttr_TARGET, /**< TARGET= */
|
|
|
|
TidyAttr_TEXT, /**< TEXT= */
|
|
|
|
TidyAttr_TITLE, /**< TITLE= */
|
|
|
|
TidyAttr_TOPMARGIN, /**< TOPMARGIN= */
|
2016-02-12 11:34:19 +00:00
|
|
|
TidyAttr_TRANSLATE, /**< TRANSLATE= */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_TYPE, /**< TYPE= */
|
|
|
|
TidyAttr_USEMAP, /**< USEMAP= */
|
|
|
|
TidyAttr_VALIGN, /**< VALIGN= */
|
|
|
|
TidyAttr_VALUE, /**< VALUE= */
|
|
|
|
TidyAttr_VALUETYPE, /**< VALUETYPE= */
|
|
|
|
TidyAttr_VERSION, /**< VERSION= */
|
|
|
|
TidyAttr_VLINK, /**< VLINK= */
|
|
|
|
TidyAttr_VSPACE, /**< VSPACE= */
|
|
|
|
TidyAttr_WIDTH, /**< WIDTH= */
|
|
|
|
TidyAttr_WRAP, /**< WRAP= */
|
|
|
|
TidyAttr_XML_LANG, /**< XML_LANG= */
|
|
|
|
TidyAttr_XML_SPACE, /**< XML_SPACE= */
|
|
|
|
TidyAttr_XMLNS, /**< XMLNS= */
|
|
|
|
|
|
|
|
TidyAttr_EVENT, /**< EVENT= */
|
|
|
|
TidyAttr_METHODS, /**< METHODS= */
|
|
|
|
TidyAttr_N, /**< N= */
|
|
|
|
TidyAttr_SDAFORM, /**< SDAFORM= */
|
|
|
|
TidyAttr_SDAPREF, /**< SDAPREF= */
|
|
|
|
TidyAttr_SDASUFF, /**< SDASUFF= */
|
|
|
|
TidyAttr_URN, /**< URN= */
|
|
|
|
|
|
|
|
TidyAttr_ASYNC,
|
|
|
|
TidyAttr_AUTOCOMPLETE,
|
|
|
|
TidyAttr_AUTOFOCUS,
|
|
|
|
TidyAttr_AUTOPLAY,
|
|
|
|
TidyAttr_CHALLENGE,
|
|
|
|
TidyAttr_CONTENTEDITABLE,
|
|
|
|
TidyAttr_CONTEXTMENU,
|
|
|
|
TidyAttr_CONTROLS,
|
2016-07-01 13:43:06 +00:00
|
|
|
TidyAttr_CROSSORIGIN, /**< CROSSORIGIN= */
|
2011-11-17 02:44:16 +00:00
|
|
|
TidyAttr_DEFAULT,
|
|
|
|
TidyAttr_DIRNAME,
|
|
|
|
TidyAttr_DRAGGABLE,
|
|
|
|
TidyAttr_DROPZONE,
|
|
|
|
TidyAttr_FORM,
|
|
|
|
TidyAttr_FORMACTION,
|
|
|
|
TidyAttr_FORMENCTYPE,
|
|
|
|
TidyAttr_FORMMETHOD,
|
|
|
|
TidyAttr_FORMNOVALIDATE,
|
|
|
|
TidyAttr_FORMTARGET,
|
|
|
|
TidyAttr_HIDDEN,
|
|
|
|
TidyAttr_HIGH,
|
|
|
|
TidyAttr_ICON,
|
|
|
|
TidyAttr_KEYTYPE,
|
|
|
|
TidyAttr_KIND,
|
|
|
|
TidyAttr_LIST,
|
|
|
|
TidyAttr_LOOP,
|
|
|
|
TidyAttr_LOW,
|
|
|
|
TidyAttr_MANIFEST,
|
|
|
|
TidyAttr_MAX,
|
|
|
|
TidyAttr_MEDIAGROUP,
|
|
|
|
TidyAttr_MIN,
|
|
|
|
TidyAttr_NOVALIDATE,
|
|
|
|
TidyAttr_OPEN,
|
|
|
|
TidyAttr_OPTIMUM,
|
|
|
|
TidyAttr_OnABORT,
|
|
|
|
TidyAttr_OnAFTERPRINT,
|
|
|
|
TidyAttr_OnBEFOREPRINT,
|
|
|
|
TidyAttr_OnCANPLAY,
|
|
|
|
TidyAttr_OnCANPLAYTHROUGH,
|
|
|
|
TidyAttr_OnCONTEXTMENU,
|
|
|
|
TidyAttr_OnCUECHANGE,
|
|
|
|
TidyAttr_OnDRAG,
|
|
|
|
TidyAttr_OnDRAGEND,
|
|
|
|
TidyAttr_OnDRAGENTER,
|
|
|
|
TidyAttr_OnDRAGLEAVE,
|
|
|
|
TidyAttr_OnDRAGOVER,
|
|
|
|
TidyAttr_OnDRAGSTART,
|
|
|
|
TidyAttr_OnDROP,
|
|
|
|
TidyAttr_OnDURATIONCHANGE,
|
|
|
|
TidyAttr_OnEMPTIED,
|
|
|
|
TidyAttr_OnENDED,
|
|
|
|
TidyAttr_OnERROR,
|
|
|
|
TidyAttr_OnHASHCHANGE,
|
|
|
|
TidyAttr_OnINPUT,
|
|
|
|
TidyAttr_OnINVALID,
|
|
|
|
TidyAttr_OnLOADEDDATA,
|
|
|
|
TidyAttr_OnLOADEDMETADATA,
|
|
|
|
TidyAttr_OnLOADSTART,
|
|
|
|
TidyAttr_OnMESSAGE,
|
|
|
|
TidyAttr_OnMOUSEWHEEL,
|
|
|
|
TidyAttr_OnOFFLINE,
|
|
|
|
TidyAttr_OnONLINE,
|
|
|
|
TidyAttr_OnPAGEHIDE,
|
|
|
|
TidyAttr_OnPAGESHOW,
|
|
|
|
TidyAttr_OnPAUSE,
|
|
|
|
TidyAttr_OnPLAY,
|
|
|
|
TidyAttr_OnPLAYING,
|
|
|
|
TidyAttr_OnPOPSTATE,
|
|
|
|
TidyAttr_OnPROGRESS,
|
|
|
|
TidyAttr_OnRATECHANGE,
|
|
|
|
TidyAttr_OnREADYSTATECHANGE,
|
|
|
|
TidyAttr_OnREDO,
|
|
|
|
TidyAttr_OnRESIZE,
|
|
|
|
TidyAttr_OnSCROLL,
|
|
|
|
TidyAttr_OnSEEKED,
|
|
|
|
TidyAttr_OnSEEKING,
|
|
|
|
TidyAttr_OnSHOW,
|
|
|
|
TidyAttr_OnSTALLED,
|
|
|
|
TidyAttr_OnSTORAGE,
|
|
|
|
TidyAttr_OnSUSPEND,
|
|
|
|
TidyAttr_OnTIMEUPDATE,
|
|
|
|
TidyAttr_OnUNDO,
|
|
|
|
TidyAttr_OnVOLUMECHANGE,
|
|
|
|
TidyAttr_OnWAITING,
|
|
|
|
TidyAttr_PATTERN,
|
|
|
|
TidyAttr_PLACEHOLDER,
|
|
|
|
TidyAttr_POSTER,
|
|
|
|
TidyAttr_PRELOAD,
|
|
|
|
TidyAttr_PUBDATE,
|
|
|
|
TidyAttr_RADIOGROUP,
|
|
|
|
TidyAttr_REQUIRED,
|
|
|
|
TidyAttr_REVERSED,
|
|
|
|
TidyAttr_SANDBOX,
|
|
|
|
TidyAttr_SCOPED,
|
|
|
|
TidyAttr_SEAMLESS,
|
|
|
|
TidyAttr_SIZES,
|
|
|
|
TidyAttr_SPELLCHECK,
|
|
|
|
TidyAttr_SRCDOC,
|
|
|
|
TidyAttr_SRCLANG,
|
|
|
|
TidyAttr_STEP,
|
2013-06-28 23:20:02 +00:00
|
|
|
TidyAttr_ARIA_ACTIVEDESCENDANT,
|
|
|
|
TidyAttr_ARIA_ATOMIC,
|
|
|
|
TidyAttr_ARIA_AUTOCOMPLETE,
|
|
|
|
TidyAttr_ARIA_BUSY,
|
|
|
|
TidyAttr_ARIA_CHECKED,
|
|
|
|
TidyAttr_ARIA_CONTROLS,
|
|
|
|
TidyAttr_ARIA_DESCRIBEDBY,
|
|
|
|
TidyAttr_ARIA_DISABLED,
|
|
|
|
TidyAttr_ARIA_DROPEFFECT,
|
|
|
|
TidyAttr_ARIA_EXPANDED,
|
|
|
|
TidyAttr_ARIA_FLOWTO,
|
|
|
|
TidyAttr_ARIA_GRABBED,
|
|
|
|
TidyAttr_ARIA_HASPOPUP,
|
|
|
|
TidyAttr_ARIA_HIDDEN,
|
|
|
|
TidyAttr_ARIA_INVALID,
|
|
|
|
TidyAttr_ARIA_LABEL,
|
|
|
|
TidyAttr_ARIA_LABELLEDBY,
|
|
|
|
TidyAttr_ARIA_LEVEL,
|
|
|
|
TidyAttr_ARIA_LIVE,
|
|
|
|
TidyAttr_ARIA_MULTILINE,
|
|
|
|
TidyAttr_ARIA_MULTISELECTABLE,
|
2014-11-22 09:39:17 +00:00
|
|
|
TidyAttr_ARIA_ORIENTATION,
|
2013-06-28 23:20:02 +00:00
|
|
|
TidyAttr_ARIA_OWNS,
|
|
|
|
TidyAttr_ARIA_POSINSET,
|
|
|
|
TidyAttr_ARIA_PRESSED,
|
|
|
|
TidyAttr_ARIA_READONLY,
|
|
|
|
TidyAttr_ARIA_RELEVANT,
|
|
|
|
TidyAttr_ARIA_REQUIRED,
|
|
|
|
TidyAttr_ARIA_SELECTED,
|
|
|
|
TidyAttr_ARIA_SETSIZE,
|
|
|
|
TidyAttr_ARIA_SORT,
|
|
|
|
TidyAttr_ARIA_VALUEMAX,
|
|
|
|
TidyAttr_ARIA_VALUEMIN,
|
|
|
|
TidyAttr_ARIA_VALUENOW,
|
|
|
|
TidyAttr_ARIA_VALUETEXT,
|
|
|
|
|
2015-02-02 16:25:49 +00:00
|
|
|
/* SVG attributes (SVG 1.1) */
|
2016-01-29 03:11:53 +00:00
|
|
|
TidyAttr_X, /**< X= */
|
2015-02-02 16:25:49 +00:00
|
|
|
TidyAttr_Y, /**< Y= */
|
|
|
|
TidyAttr_VIEWBOX, /**< VIEWBOX= */
|
|
|
|
TidyAttr_PRESERVEASPECTRATIO, /**< PRESERVEASPECTRATIO= */
|
|
|
|
TidyAttr_ZOOMANDPAN, /**< ZOOMANDPAN= */
|
|
|
|
TidyAttr_BASEPROFILE, /**< BASEPROFILE= */
|
|
|
|
TidyAttr_CONTENTSCRIPTTYPE, /**< CONTENTSCRIPTTYPE= */
|
|
|
|
TidyAttr_CONTENTSTYLETYPE, /**< CONTENTSTYLETYPE= */
|
2015-02-13 17:37:07 +00:00
|
|
|
/* MathML <math> attributes */
|
|
|
|
TidyAttr_DISPLAY, /**< DISPLAY= (html5) */
|
2011-11-17 02:44:16 +00:00
|
|
|
|
2015-11-16 17:29:23 +00:00
|
|
|
/* RDFa global attributes */
|
|
|
|
TidyAttr_ABOUT, /**< ABOUT= */
|
|
|
|
TidyAttr_DATATYPE, /**< DATATYPE= */
|
|
|
|
TidyAttr_INLIST, /**< INLIST= */
|
|
|
|
TidyAttr_PREFIX, /**< PREFIX= */
|
|
|
|
TidyAttr_PROPERTY, /**< PROPERTY= */
|
|
|
|
TidyAttr_RESOURCE, /**< RESOURCE= */
|
|
|
|
TidyAttr_TYPEOF, /**< TYPEOF= */
|
|
|
|
TidyAttr_VOCAB, /**< VOCAB= */
|
|
|
|
|
2016-07-24 14:24:30 +00:00
|
|
|
TidyAttr_INTEGRITY, /**< INTEGRITY= */
|
|
|
|
|
2016-08-23 08:36:25 +00:00
|
|
|
TidyAttr_AS, /**< AS= */
|
|
|
|
|
2017-01-08 23:38:16 +00:00
|
|
|
TidyAttr_XMLNSXLINK, /**< svg xmls:xlink="url" */
|
|
|
|
|
2011-11-17 02:44:16 +00:00
|
|
|
N_TIDY_ATTRIBS /**< Must be last */
|
|
|
|
} TidyAttrId;
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* Code Generation
|
|
|
|
*
|
|
|
|
* Tidy aims to provide a consistent API for library users, and so we
|
|
|
|
* go to some lengths to provide a `tidyMessagesCodes` enum that
|
|
|
|
* consists of the message code for every warning/error/info message
|
|
|
|
* tha Tidy can emit, and a `tidyErrorFilterKeysStruct[]` array with
|
|
|
|
* string representations of each message code.
|
|
|
|
*
|
|
|
|
* We also support the addition of message codes from other modules,
|
|
|
|
* such as from Tidy's accessibility module.
|
|
|
|
*
|
|
|
|
* In order to keep code maintainable and make it simple to add new
|
|
|
|
* messages, the `tidyMessageCodes` and `tidyErrorFilterKeysStruct[]`
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
* are generated dynamically with preprocessor macros defined below.
|
2017-02-13 19:29:47 +00:00
|
|
|
*
|
|
|
|
* Any visible FOREACH_MSG_* macro (including new ones) must be
|
|
|
|
* applied to the `tidyMessageCodes` enum with the MAKE_ENUM() macro
|
|
|
|
* in this file, and to the `tidyErrorFilterKeysStruct[]` with
|
|
|
|
* MAKE_STRUCT in this file.
|
|
|
|
*
|
|
|
|
* Modern IDE's will dynamically pre-process all of these macros,
|
|
|
|
* enabling code-completion of these enums and array of structs.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#define MAKE_ENUM(MESSAGE) MESSAGE,
|
|
|
|
#define MAKE_STRUCT(MESSAGE) {#MESSAGE, MESSAGE},
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* These `tidyMessageCodes` are used throughout libtidy, and also have
|
|
|
|
* associated localized strings to describe them.
|
|
|
|
*
|
|
|
|
* These message codes comprise every possible message that can be
|
|
|
|
* output by Tidy in its report table and via the message filter
|
|
|
|
* callback.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
/* message codes for entities/numeric character references */
|
|
|
|
#define FOREACH_MSG_ENTITIES(FN) \
|
|
|
|
FN(APOS_UNDEFINED) \
|
|
|
|
FN(MISSING_SEMICOLON_NCR) \
|
|
|
|
FN(MISSING_SEMICOLON) \
|
|
|
|
FN(UNESCAPED_AMPERSAND) \
|
|
|
|
FN(UNKNOWN_ENTITY)
|
|
|
|
|
|
|
|
/* error codes for element messages */
|
|
|
|
#define FOREACH_MSG_ELEMENT(FN) \
|
|
|
|
FN(BAD_CDATA_CONTENT) \
|
|
|
|
FN(BAD_COMMENT_CHARS) \
|
|
|
|
FN(BAD_XML_COMMENT) \
|
|
|
|
FN(CANT_BE_NESTED) \
|
|
|
|
FN(COERCE_TO_ENDTAG_WARN) \
|
|
|
|
FN(COERCE_TO_ENDTAG) \
|
|
|
|
FN(CONTENT_AFTER_BODY) \
|
|
|
|
FN(DISCARDING_UNEXPECTED) \
|
2017-03-19 19:41:51 +00:00
|
|
|
FN(XML_DECLARATION_DETECTED) \
|
2017-02-13 19:29:47 +00:00
|
|
|
FN(DOCTYPE_AFTER_TAGS) \
|
|
|
|
FN(DTYPE_NOT_UPPER_CASE) \
|
|
|
|
FN(DUPLICATE_FRAMESET) \
|
|
|
|
FN(ELEMENT_NOT_EMPTY) \
|
|
|
|
FN(ELEMENT_VERS_MISMATCH_ERROR) \
|
|
|
|
FN(ELEMENT_VERS_MISMATCH_WARN) \
|
|
|
|
FN(ENCODING_IO_CONFLICT) \
|
|
|
|
FN(ILLEGAL_NESTING) \
|
|
|
|
FN(INCONSISTENT_NAMESPACE) \
|
|
|
|
FN(INCONSISTENT_VERSION) \
|
|
|
|
FN(INSERTING_TAG) \
|
|
|
|
FN(MALFORMED_COMMENT) \
|
|
|
|
FN(MALFORMED_DOCTYPE) \
|
|
|
|
FN(MISSING_DOCTYPE) \
|
|
|
|
FN(MISSING_ENDTAG_BEFORE) \
|
|
|
|
FN(MISSING_ENDTAG_FOR) \
|
|
|
|
FN(MISSING_STARTTAG) \
|
|
|
|
FN(MISSING_TITLE_ELEMENT) \
|
|
|
|
FN(MIXED_CONTENT_IN_BLOCK) \
|
|
|
|
FN(NESTED_EMPHASIS) \
|
|
|
|
FN(NESTED_QUOTATION) \
|
|
|
|
FN(NOFRAMES_CONTENT) \
|
|
|
|
FN(NON_MATCHING_ENDTAG) \
|
|
|
|
FN(OBSOLETE_ELEMENT) \
|
|
|
|
FN(PROPRIETARY_ELEMENT) \
|
|
|
|
FN(REPLACING_ELEMENT) \
|
2017-03-13 17:45:32 +00:00
|
|
|
FN(CUSTOM_TAG_DETECTED) \
|
2017-02-13 19:29:47 +00:00
|
|
|
FN(REPLACING_UNEX_ELEMENT) \
|
|
|
|
FN(SPACE_PRECEDING_XMLDECL) \
|
|
|
|
FN(SUSPECTED_MISSING_QUOTE) \
|
|
|
|
FN(TAG_NOT_ALLOWED_IN) \
|
|
|
|
FN(TOO_MANY_ELEMENTS_IN) \
|
|
|
|
FN(TOO_MANY_ELEMENTS) \
|
|
|
|
FN(TRIM_EMPTY_ELEMENT) \
|
|
|
|
FN(UNESCAPED_ELEMENT) \
|
|
|
|
FN(UNEXPECTED_END_OF_FILE) \
|
|
|
|
FN(UNEXPECTED_ENDTAG_IN) \
|
|
|
|
FN(UNEXPECTED_ENDTAG) \
|
|
|
|
FN(UNKNOWN_ELEMENT) \
|
2017-03-15 21:36:05 +00:00
|
|
|
FN(UNKNOWN_ELEMENT_LOOKS_CUSTOM) \
|
2017-02-13 19:29:47 +00:00
|
|
|
FN(USING_BR_INPLACE_OF)
|
|
|
|
|
|
|
|
/* error codes used for attribute messages */
|
|
|
|
#define FOREACH_MSG_ATTRIBUTE(FN) \
|
|
|
|
FN(ANCHOR_NOT_UNIQUE) \
|
|
|
|
FN(ATTR_VALUE_NOT_LCASE) \
|
|
|
|
FN(BACKSLASH_IN_URI) \
|
|
|
|
FN(BAD_ATTRIBUTE_VALUE_REPLACED) \
|
|
|
|
FN(BAD_ATTRIBUTE_VALUE) \
|
|
|
|
FN(BAD_SUMMARY_HTML5) \
|
|
|
|
FN(ESCAPED_ILLEGAL_URI) \
|
|
|
|
FN(FIXED_BACKSLASH) \
|
|
|
|
FN(ID_NAME_MISMATCH) \
|
|
|
|
FN(ILLEGAL_URI_REFERENCE) \
|
|
|
|
FN(INSERTING_ATTRIBUTE) \
|
|
|
|
FN(INSERTING_AUTO_ATTRIBUTE) \
|
|
|
|
FN(INVALID_ATTRIBUTE) \
|
|
|
|
FN(INVALID_XML_ID) \
|
|
|
|
FN(JOINING_ATTRIBUTE) \
|
|
|
|
FN(MISMATCHED_ATTRIBUTE_ERROR) \
|
|
|
|
FN(MISMATCHED_ATTRIBUTE_WARN) \
|
2017-03-13 17:45:32 +00:00
|
|
|
FN(ATTRIBUTE_IS_NOT_ALLOWED) \
|
2017-02-13 19:29:47 +00:00
|
|
|
FN(MISSING_ATTR_VALUE) \
|
|
|
|
FN(MISSING_ATTRIBUTE) \
|
|
|
|
FN(MISSING_IMAGEMAP) \
|
|
|
|
FN(MISSING_QUOTEMARK) \
|
|
|
|
FN(NEWLINE_IN_URI) \
|
|
|
|
FN(PREVIOUS_LOCATION) \
|
|
|
|
FN(PROPRIETARY_ATTR_VALUE) \
|
|
|
|
FN(PROPRIETARY_ATTRIBUTE) \
|
|
|
|
FN(REMOVED_HTML5) \
|
|
|
|
FN(REPEATED_ATTRIBUTE) \
|
|
|
|
FN(UNEXPECTED_END_OF_FILE_ATTR) \
|
|
|
|
FN(UNEXPECTED_EQUALSIGN) \
|
|
|
|
FN(UNEXPECTED_GT) \
|
|
|
|
FN(UNEXPECTED_QUOTEMARK) \
|
|
|
|
FN(UNKNOWN_ATTRIBUTE) \
|
|
|
|
FN(WHITE_IN_URI) \
|
|
|
|
FN(XML_ATTRIBUTE_VALUE) \
|
|
|
|
FN(XML_ID_SYNTAX)
|
|
|
|
|
|
|
|
/* character encoding errors */
|
|
|
|
#define FOREACH_MSG_ENCODING(FN) \
|
|
|
|
FN(BAD_SURROGATE_LEAD) \
|
|
|
|
FN(BAD_SURROGATE_PAIR) \
|
|
|
|
FN(BAD_SURROGATE_TAIL) \
|
|
|
|
FN(ENCODING_MISMATCH) \
|
|
|
|
FN(INVALID_NCR) \
|
|
|
|
FN(INVALID_SGML_CHARS) \
|
|
|
|
FN(INVALID_URI) \
|
|
|
|
FN(INVALID_UTF8) \
|
|
|
|
FN(INVALID_UTF16) \
|
|
|
|
FN(VENDOR_SPECIFIC_CHARS)
|
|
|
|
|
|
|
|
/* miscellaneous config and info messages */
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
#define FOREACH_MSG_OTHER(FN) \
|
2017-02-13 19:29:47 +00:00
|
|
|
FN(STRING_CONTENT_LOOKS) /* `Document content looks like %s`. */ \
|
|
|
|
FN(STRING_DOCTYPE_GIVEN) /* `Doctype given is \"%s\". */ \
|
|
|
|
FN(STRING_HTML_PROPRIETARY) /* `HTML Proprietary`/ */ \
|
|
|
|
FN(STRING_MISSING_MALFORMED) /* For `missing or malformed argument for option: %s`. */ \
|
|
|
|
FN(STRING_NO_SYSID) /* `No system identifier in emitted doctype`. */ \
|
|
|
|
FN(STRING_UNKNOWN_OPTION) /* For retrieving a string `unknown option: %s`. */
|
|
|
|
|
|
|
|
/* accessibility module contributions */
|
|
|
|
#define FOREACH_MSG_ACCESS(FN) \
|
|
|
|
/* [1.1.1.1] */ FN(IMG_MISSING_ALT) \
|
|
|
|
/* [1.1.1.2] */ FN(IMG_ALT_SUSPICIOUS_FILENAME) \
|
|
|
|
/* [1.1.1.3] */ FN(IMG_ALT_SUSPICIOUS_FILE_SIZE) \
|
|
|
|
/* [1.1.1.4] */ FN(IMG_ALT_SUSPICIOUS_PLACEHOLDER) \
|
|
|
|
/* [1.1.1.10] */ FN(IMG_ALT_SUSPICIOUS_TOO_LONG) \
|
|
|
|
/* [1.1.1.11] */ FN(IMG_MISSING_ALT_BULLET) \
|
|
|
|
/* [1.1.1.12] */ FN(IMG_MISSING_ALT_H_RULE) \
|
|
|
|
/* [1.1.2.1] */ FN(IMG_MISSING_LONGDESC_DLINK) \
|
|
|
|
/* [1.1.2.2] */ FN(IMG_MISSING_DLINK) \
|
|
|
|
/* [1.1.2.3] */ FN(IMG_MISSING_LONGDESC) \
|
|
|
|
/* [1.1.2.5] */ FN(LONGDESC_NOT_REQUIRED) \
|
|
|
|
/* [1.1.3.1] */ FN(IMG_BUTTON_MISSING_ALT) \
|
|
|
|
/* [1.1.4.1] */ FN(APPLET_MISSING_ALT) \
|
|
|
|
/* [1.1.5.1] */ FN(OBJECT_MISSING_ALT) \
|
|
|
|
/* [1.1.6.1] */ FN(AUDIO_MISSING_TEXT_WAV) \
|
|
|
|
/* [1.1.6.2] */ FN(AUDIO_MISSING_TEXT_AU) \
|
|
|
|
/* [1.1.6.3] */ FN(AUDIO_MISSING_TEXT_AIFF) \
|
|
|
|
/* [1.1.6.4] */ FN(AUDIO_MISSING_TEXT_SND) \
|
|
|
|
/* [1.1.6.5] */ FN(AUDIO_MISSING_TEXT_RA) \
|
|
|
|
/* [1.1.6.6] */ FN(AUDIO_MISSING_TEXT_RM) \
|
|
|
|
/* [1.1.8.1] */ FN(FRAME_MISSING_LONGDESC) \
|
|
|
|
/* [1.1.9.1] */ FN(AREA_MISSING_ALT) \
|
|
|
|
/* [1.1.10.1] */ FN(SCRIPT_MISSING_NOSCRIPT) \
|
|
|
|
/* [1.1.12.1] */ FN(ASCII_REQUIRES_DESCRIPTION) \
|
|
|
|
/* [1.2.1.1] */ FN(IMG_MAP_SERVER_REQUIRES_TEXT_LINKS) \
|
|
|
|
/* [1.4.1.1] */ FN(MULTIMEDIA_REQUIRES_TEXT) \
|
|
|
|
/* [1.5.1.1] */ FN(IMG_MAP_CLIENT_MISSING_TEXT_LINKS) \
|
|
|
|
/* [2.1.1.1] */ FN(INFORMATION_NOT_CONVEYED_IMAGE) \
|
|
|
|
/* [2.1.1.2] */ FN(INFORMATION_NOT_CONVEYED_APPLET) \
|
|
|
|
/* [2.1.1.3] */ FN(INFORMATION_NOT_CONVEYED_OBJECT) \
|
|
|
|
/* [2.1.1.4] */ FN(INFORMATION_NOT_CONVEYED_SCRIPT) \
|
|
|
|
/* [2.1.1.5] */ FN(INFORMATION_NOT_CONVEYED_INPUT) \
|
|
|
|
/* [2.2.1.1] */ FN(COLOR_CONTRAST_TEXT) \
|
|
|
|
/* [2.2.1.2] */ FN(COLOR_CONTRAST_LINK) \
|
|
|
|
/* [2.2.1.3] */ FN(COLOR_CONTRAST_ACTIVE_LINK) \
|
|
|
|
/* [2.2.1.4] */ FN(COLOR_CONTRAST_VISITED_LINK) \
|
|
|
|
/* [3.2.1.1] */ FN(DOCTYPE_MISSING) \
|
|
|
|
/* [3.3.1.1] */ FN(STYLE_SHEET_CONTROL_PRESENTATION) \
|
|
|
|
/* [3.5.1.1] */ FN(HEADERS_IMPROPERLY_NESTED) \
|
|
|
|
/* [3.5.2.1] */ FN(POTENTIAL_HEADER_BOLD) \
|
|
|
|
/* [3.5.2.2] */ FN(POTENTIAL_HEADER_ITALICS) \
|
|
|
|
/* [3.5.2.3] */ FN(POTENTIAL_HEADER_UNDERLINE) \
|
|
|
|
/* [3.5.3.1] */ FN(HEADER_USED_FORMAT_TEXT) \
|
|
|
|
/* [3.6.1.1] */ FN(LIST_USAGE_INVALID_UL) \
|
|
|
|
/* [3.6.1.2] */ FN(LIST_USAGE_INVALID_OL) \
|
|
|
|
/* [3.6.1.4] */ FN(LIST_USAGE_INVALID_LI) \
|
|
|
|
/* [4.1.1.1] */ FN(INDICATE_CHANGES_IN_LANGUAGE) \
|
|
|
|
/* [4.3.1.1] */ FN(LANGUAGE_NOT_IDENTIFIED) \
|
|
|
|
/* [4.3.1.1] */ FN(LANGUAGE_INVALID) \
|
|
|
|
/* [5.1.2.1] */ FN(DATA_TABLE_MISSING_HEADERS) \
|
|
|
|
/* [5.1.2.2] */ FN(DATA_TABLE_MISSING_HEADERS_COLUMN) \
|
|
|
|
/* [5.1.2.3] */ FN(DATA_TABLE_MISSING_HEADERS_ROW) \
|
|
|
|
/* [5.2.1.1] */ FN(DATA_TABLE_REQUIRE_MARKUP_COLUMN_HEADERS) \
|
|
|
|
/* [5.2.1.2] */ FN(DATA_TABLE_REQUIRE_MARKUP_ROW_HEADERS) \
|
|
|
|
/* [5.3.1.1] */ FN(LAYOUT_TABLES_LINEARIZE_PROPERLY) \
|
|
|
|
/* [5.4.1.1] */ FN(LAYOUT_TABLE_INVALID_MARKUP) \
|
|
|
|
/* [5.5.1.1] */ FN(TABLE_MISSING_SUMMARY) \
|
|
|
|
/* [5.5.1.2] */ FN(TABLE_SUMMARY_INVALID_NULL) \
|
|
|
|
/* [5.5.1.3] */ FN(TABLE_SUMMARY_INVALID_SPACES) \
|
|
|
|
/* [5.5.1.6] */ FN(TABLE_SUMMARY_INVALID_PLACEHOLDER) \
|
|
|
|
/* [5.5.2.1] */ FN(TABLE_MISSING_CAPTION) \
|
|
|
|
/* [5.6.1.1] */ FN(TABLE_MAY_REQUIRE_HEADER_ABBR) \
|
|
|
|
/* [5.6.1.2] */ FN(TABLE_MAY_REQUIRE_HEADER_ABBR_NULL) \
|
|
|
|
/* [5.6.1.3] */ FN(TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES) \
|
|
|
|
/* [6.1.1.1] */ FN(STYLESHEETS_REQUIRE_TESTING_LINK) \
|
|
|
|
/* [6.1.1.2] */ FN(STYLESHEETS_REQUIRE_TESTING_STYLE_ELEMENT) \
|
|
|
|
/* [6.1.1.3] */ FN(STYLESHEETS_REQUIRE_TESTING_STYLE_ATTR) \
|
|
|
|
/* [6.2.1.1] */ FN(FRAME_SRC_INVALID) \
|
|
|
|
/* [6.2.2.1] */ FN(TEXT_EQUIVALENTS_REQUIRE_UPDATING_APPLET) \
|
|
|
|
/* [6.2.2.2] */ FN(TEXT_EQUIVALENTS_REQUIRE_UPDATING_SCRIPT) \
|
|
|
|
/* [6.2.2.3] */ FN(TEXT_EQUIVALENTS_REQUIRE_UPDATING_OBJECT) \
|
|
|
|
/* [6.3.1.1] */ FN(PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_SCRIPT) \
|
|
|
|
/* [6.3.1.2] */ FN(PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_OBJECT) \
|
|
|
|
/* [6.3.1.3] */ FN(PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_EMBED) \
|
|
|
|
/* [6.3.1.4] */ FN(PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_APPLET) \
|
|
|
|
/* [6.5.1.1] */ FN(FRAME_MISSING_NOFRAMES) \
|
|
|
|
/* [6.5.1.2] */ FN(NOFRAMES_INVALID_NO_VALUE) \
|
|
|
|
/* [6.5.1.3] */ FN(NOFRAMES_INVALID_CONTENT) \
|
|
|
|
/* [6.5.1.4] */ FN(NOFRAMES_INVALID_LINK) \
|
|
|
|
/* [7.1.1.1] */ FN(REMOVE_FLICKER_SCRIPT) \
|
|
|
|
/* [7.1.1.2] */ FN(REMOVE_FLICKER_OBJECT) \
|
|
|
|
/* [7.1.1.3] */ FN(REMOVE_FLICKER_EMBED) \
|
|
|
|
/* [7.1.1.4] */ FN(REMOVE_FLICKER_APPLET) \
|
|
|
|
/* [7.1.1.5] */ FN(REMOVE_FLICKER_ANIMATED_GIF) \
|
|
|
|
/* [7.2.1.1] */ FN(REMOVE_BLINK_MARQUEE) \
|
|
|
|
/* [7.4.1.1] */ FN(REMOVE_AUTO_REFRESH) \
|
|
|
|
/* [7.5.1.1] */ FN(REMOVE_AUTO_REDIRECT) \
|
|
|
|
/* [8.1.1.1] */ FN(ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_SCRIPT) \
|
|
|
|
/* [8.1.1.2] */ FN(ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_OBJECT) \
|
|
|
|
/* [8.1.1.3] */ FN(ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_APPLET) \
|
|
|
|
/* [8.1.1.4] */ FN(ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_EMBED) \
|
|
|
|
/* [9.1.1.1] */ FN(IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION) \
|
|
|
|
/* [9.3.1.1] */ FN(SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_DOWN) \
|
|
|
|
/* [9.3.1.2] */ FN(SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_UP) \
|
|
|
|
/* [9.3.1.3] */ FN(SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_CLICK) \
|
|
|
|
/* [9.3.1.4] */ FN(SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OVER) \
|
|
|
|
/* [9.3.1.5] */ FN(SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OUT) \
|
|
|
|
/* [9.3.1.6] */ FN(SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_MOVE) \
|
|
|
|
/* [10.1.1.1] */ FN(NEW_WINDOWS_REQUIRE_WARNING_NEW) \
|
|
|
|
/* [10.1.1.2] */ FN(NEW_WINDOWS_REQUIRE_WARNING_BLANK) \
|
|
|
|
/* [10.2.1.1] */ FN(LABEL_NEEDS_REPOSITIONING_BEFORE_INPUT) \
|
|
|
|
/* [10.2.1.2] */ FN(LABEL_NEEDS_REPOSITIONING_AFTER_INPUT) \
|
|
|
|
/* [10.4.1.1] */ FN(FORM_CONTROL_REQUIRES_DEFAULT_TEXT) \
|
|
|
|
/* [10.4.1.2] */ FN(FORM_CONTROL_DEFAULT_TEXT_INVALID_NULL) \
|
|
|
|
/* [10.4.1.3] */ FN(FORM_CONTROL_DEFAULT_TEXT_INVALID_SPACES) \
|
|
|
|
/* [11.2.1.1] */ FN(REPLACE_DEPRECATED_HTML_APPLET) \
|
|
|
|
/* [11.2.1.2] */ FN(REPLACE_DEPRECATED_HTML_BASEFONT) \
|
|
|
|
/* [11.2.1.3] */ FN(REPLACE_DEPRECATED_HTML_CENTER) \
|
|
|
|
/* [11.2.1.4] */ FN(REPLACE_DEPRECATED_HTML_DIR) \
|
|
|
|
/* [11.2.1.5] */ FN(REPLACE_DEPRECATED_HTML_FONT) \
|
|
|
|
/* [11.2.1.6] */ FN(REPLACE_DEPRECATED_HTML_ISINDEX) \
|
|
|
|
/* [11.2.1.7] */ FN(REPLACE_DEPRECATED_HTML_MENU) \
|
|
|
|
/* [11.2.1.8] */ FN(REPLACE_DEPRECATED_HTML_S) \
|
|
|
|
/* [11.2.1.9] */ FN(REPLACE_DEPRECATED_HTML_STRIKE) \
|
|
|
|
/* [11.2.1.10] */ FN(REPLACE_DEPRECATED_HTML_U) \
|
|
|
|
/* [12.1.1.1] */ FN(FRAME_MISSING_TITLE) \
|
|
|
|
/* [12.1.1.2] */ FN(FRAME_TITLE_INVALID_NULL) \
|
|
|
|
/* [12.1.1.3] */ FN(FRAME_TITLE_INVALID_SPACES) \
|
|
|
|
/* [12.4.1.1] */ FN(ASSOCIATE_LABELS_EXPLICITLY) \
|
|
|
|
/* [12.4.1.2] */ FN(ASSOCIATE_LABELS_EXPLICITLY_FOR) \
|
|
|
|
/* [12.4.1.3] */ FN(ASSOCIATE_LABELS_EXPLICITLY_ID) \
|
|
|
|
/* [13.1.1.1] */ FN(LINK_TEXT_NOT_MEANINGFUL) \
|
|
|
|
/* [13.1.1.2] */ FN(LINK_TEXT_MISSING) \
|
|
|
|
/* [13.1.1.3] */ FN(LINK_TEXT_TOO_LONG) \
|
|
|
|
/* [13.1.1.4] */ FN(LINK_TEXT_NOT_MEANINGFUL_CLICK_HERE) \
|
|
|
|
/* [13.1.1.5] */ FN(LINK_TEXT_NOT_MEANINGFUL_MORE) \
|
|
|
|
/* [13.1.1.6] */ FN(LINK_TEXT_NOT_MEANINGFUL_FOLLOW_THIS) \
|
|
|
|
/* [13.2.1.1] */ FN(METADATA_MISSING) \
|
|
|
|
/* [13.2.1.2] */ FN(METADATA_MISSING_LINK) \
|
|
|
|
/* [13.2.1.3] */ FN(METADATA_MISSING_REDIRECT_AUTOREFRESH) \
|
|
|
|
/* [13.10.1.1] */ FN(SKIPOVER_ASCII_ART)
|
|
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
/** @name Data Structures */
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* `tidyMessageCodes`
|
|
|
|
*
|
|
|
|
* The actual definition of the enumeration, generated dynamically
|
|
|
|
* per the notes above.
|
|
|
|
*********************************************************************/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* This MUST be present and first. */
|
|
|
|
tidyMessageCodes_first = 500,
|
|
|
|
|
|
|
|
FOREACH_MSG_ENTITIES(MAKE_ENUM)
|
|
|
|
FOREACH_MSG_ELEMENT(MAKE_ENUM)
|
|
|
|
FOREACH_MSG_ATTRIBUTE(MAKE_ENUM)
|
|
|
|
FOREACH_MSG_ENCODING(MAKE_ENUM)
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
FOREACH_MSG_OTHER(MAKE_ENUM)
|
2017-02-13 19:29:47 +00:00
|
|
|
|
|
|
|
#if SUPPORT_ACCESSIBILITY_CHECKS
|
|
|
|
/* Defined in `access.h` */
|
|
|
|
FOREACH_MSG_ACCESS(MAKE_ENUM)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* This MUST be present and last. */
|
|
|
|
tidyMessageCodes_last
|
|
|
|
} tidyMessageCodes;
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* These `tidyMessagesMisc` are used throughout libtidy, and also have
|
|
|
|
* associated localized strings to describe them.
|
|
|
|
*
|
|
|
|
* These message codes comprise every possible message that can be
|
|
|
|
* output by Tidy that are *not* diagnostic style messages available
|
|
|
|
* in the message filter callback, and are *not* console application
|
|
|
|
* specific messages.
|
|
|
|
*********************************************************************/
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
|
|
|
|
#define FOREACH_MSG_MISC(FN) \
|
|
|
|
/* Point to Accessibility Guidelines. */ FN(ACCESS_URL) \
|
|
|
|
/* Point to Tidy accessibility page. */ FN(ATRC_ACCESS_URL) \
|
|
|
|
/* File can't be opened. */ FN(FILE_CANT_OPEN) \
|
|
|
|
/* Localized `line %d column %d` text. */ FN(LINE_COLUMN_STRING) \
|
|
|
|
/* For `discarding`. */ FN(STRING_DISCARDING) \
|
|
|
|
/* `%u %s, %u %s were found!`. */ FN(STRING_ERROR_COUNT) \
|
|
|
|
/* `error` and `errors`. */ FN(STRING_ERROR_COUNT_ERROR) \
|
|
|
|
/* `warning` and `warnings`. */ FN(STRING_ERROR_COUNT_WARNING) \
|
|
|
|
/* Accessibility hello message. */ FN(STRING_HELLO_ACCESS) \
|
|
|
|
/* `No warnings or errors were found.\n\n`. */ FN(STRING_NO_ERRORS) \
|
|
|
|
/* ` Not all warnings/errors were shown.\n\n`. */ FN(STRING_NOT_ALL_SHOWN) \
|
|
|
|
/* For `plain text`. */ FN(STRING_PLAIN_TEXT) \
|
|
|
|
/* For `replacing`. */ FN(STRING_REPLACING) \
|
|
|
|
/* For `specified`. */ FN(STRING_SPECIFIED) \
|
|
|
|
/* For `XML declaration`. */ FN(STRING_XML_DECLARATION) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_ACCESS_ADVICE1) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_ACCESS_ADVICE2) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_BAD_FORM) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_BAD_MAIN) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_GENERAL_INFO) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_GENERAL_INFO_PLEA) \
|
|
|
|
/* Describes the HTML table algorithm. */ FN(TEXT_HTML_T_ALGORITHM) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_INVALID_URI) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_INVALID_UTF16) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_INVALID_UTF8) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_M_IMAGE_ALT) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_M_IMAGE_MAP) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_M_LINK_ALT) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_M_SUMMARY) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_NEEDS_INTERVENTION) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_SGML_CHARS) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_USING_BODY) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_USING_FONT) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_USING_FRAMES) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_USING_LAYER) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_USING_NOBR) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_USING_SPACER) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_VENDOR_CHARS) \
|
|
|
|
/* Explanatory text. */ FN(TEXT_WINDOWS_CHARS)
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* This MUST be present and first. */
|
|
|
|
tidyMessagesMisc_first = tidyMessageCodes_last,
|
|
|
|
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
FOREACH_MSG_MISC(MAKE_ENUM)
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
/* This MUST be present and last. */
|
|
|
|
tidyMessagesMisc_last
|
|
|
|
} tidyMessagesMisc;
|
|
|
|
|
|
|
|
|
|
|
|
#if SUPPORT_CONSOLE_APP
|
|
|
|
/*********************************************************************
|
|
|
|
* These `tidyConsoleMessages` are used throughout libtidy, and also
|
|
|
|
* have associated localized strings to describe them.
|
|
|
|
*
|
|
|
|
* These message codes comprise every message is exclusive to the
|
|
|
|
* Tidy console application. It it possible to build LibTidy without
|
|
|
|
* these strings.
|
|
|
|
*********************************************************************/
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
#define FOREACH_MSG_CONSOLE(FN) \
|
|
|
|
FN(TC_LABEL_COL) \
|
|
|
|
FN(TC_LABEL_FILE) \
|
|
|
|
FN(TC_LABEL_LANG) \
|
|
|
|
FN(TC_LABEL_LEVL) \
|
|
|
|
FN(TC_LABEL_OPT) \
|
|
|
|
FN(TC_MAIN_ERROR_LOAD_CONFIG) \
|
|
|
|
FN(TC_OPT_ACCESS) \
|
|
|
|
FN(TC_OPT_ASCII) \
|
|
|
|
FN(TC_OPT_ASHTML) \
|
|
|
|
FN(TC_OPT_ASXML) \
|
|
|
|
FN(TC_OPT_BARE) \
|
|
|
|
FN(TC_OPT_BIG5) \
|
|
|
|
FN(TC_OPT_CLEAN) \
|
|
|
|
FN(TC_OPT_CONFIG) \
|
|
|
|
FN(TC_OPT_ERRORS) \
|
|
|
|
FN(TC_OPT_FILE) \
|
|
|
|
FN(TC_OPT_GDOC) \
|
|
|
|
FN(TC_OPT_HELP) \
|
|
|
|
FN(TC_OPT_HELPCFG) \
|
|
|
|
FN(TC_OPT_HELPOPT) \
|
|
|
|
FN(TC_OPT_IBM858) \
|
|
|
|
FN(TC_OPT_INDENT) \
|
|
|
|
FN(TC_OPT_ISO2022) \
|
|
|
|
FN(TC_OPT_LANGUAGE) \
|
|
|
|
FN(TC_OPT_LATIN0) \
|
|
|
|
FN(TC_OPT_LATIN1) \
|
|
|
|
FN(TC_OPT_MAC) \
|
|
|
|
FN(TC_OPT_MODIFY) \
|
|
|
|
FN(TC_OPT_NUMERIC) \
|
|
|
|
FN(TC_OPT_OMIT) \
|
|
|
|
FN(TC_OPT_OUTPUT) \
|
|
|
|
FN(TC_OPT_QUIET) \
|
|
|
|
FN(TC_OPT_RAW) \
|
|
|
|
FN(TC_OPT_SHIFTJIS) \
|
|
|
|
FN(TC_OPT_SHOWCFG) \
|
|
|
|
FN(TC_OPT_UPPER) \
|
|
|
|
FN(TC_OPT_UTF16) \
|
|
|
|
FN(TC_OPT_UTF16BE) \
|
|
|
|
FN(TC_OPT_UTF16LE) \
|
|
|
|
FN(TC_OPT_UTF8) \
|
|
|
|
FN(TC_OPT_VERSION) \
|
|
|
|
FN(TC_OPT_WIN1252) \
|
|
|
|
FN(TC_OPT_WRAP) \
|
|
|
|
FN(TC_OPT_XML) \
|
|
|
|
FN(TC_OPT_XMLCFG) \
|
|
|
|
FN(TC_OPT_XMLSTRG) \
|
|
|
|
FN(TC_OPT_XMLERRS) \
|
|
|
|
FN(TC_OPT_XMLOPTS) \
|
|
|
|
FN(TC_OPT_XMLHELP) \
|
|
|
|
FN(TC_STRING_CONF_HEADER) \
|
|
|
|
FN(TC_STRING_CONF_NAME) \
|
|
|
|
FN(TC_STRING_CONF_TYPE) \
|
|
|
|
FN(TC_STRING_CONF_VALUE) \
|
|
|
|
FN(TC_STRING_CONF_NOTE) \
|
|
|
|
FN(TC_STRING_OPT_NOT_DOCUMENTED) \
|
|
|
|
FN(TC_STRING_OUT_OF_MEMORY) \
|
|
|
|
FN(TC_STRING_FATAL_ERROR) \
|
|
|
|
FN(TC_STRING_FILE_MANIP) \
|
|
|
|
FN(TC_STRING_LANG_MUST_SPECIFY) \
|
|
|
|
FN(TC_STRING_LANG_NOT_FOUND) \
|
|
|
|
FN(TC_STRING_MUST_SPECIFY) \
|
|
|
|
FN(TC_STRING_PROCESS_DIRECTIVES) \
|
|
|
|
FN(TC_STRING_CHAR_ENCODING) \
|
|
|
|
FN(TC_STRING_MISC) \
|
|
|
|
FN(TC_STRING_XML) \
|
|
|
|
FN(TC_STRING_UNKNOWN_OPTION) \
|
|
|
|
FN(TC_STRING_UNKNOWN_OPTION_B) \
|
|
|
|
FN(TC_STRING_VERS_A) \
|
|
|
|
FN(TC_STRING_VERS_B) \
|
|
|
|
FN(TC_TXT_HELP_1) \
|
|
|
|
FN(TC_TXT_HELP_2A) \
|
|
|
|
FN(TC_TXT_HELP_2B) \
|
|
|
|
FN(TC_TXT_HELP_3) \
|
|
|
|
FN(TC_TXT_HELP_CONFIG) \
|
|
|
|
FN(TC_TXT_HELP_CONFIG_NAME) \
|
|
|
|
FN(TC_TXT_HELP_CONFIG_TYPE) \
|
|
|
|
FN(TC_TXT_HELP_CONFIG_ALLW) \
|
|
|
|
FN(TC_TXT_HELP_LANG_1) \
|
|
|
|
FN(TC_TXT_HELP_LANG_2) \
|
|
|
|
FN(TC_TXT_HELP_LANG_3)
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* This MUST be present and first. */
|
|
|
|
tidyConsoleMessages_first = tidyMessagesMisc_last,
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
|
|
|
|
FOREACH_MSG_CONSOLE(MAKE_ENUM)
|
|
|
|
|
2017-02-13 19:29:47 +00:00
|
|
|
/* This MUST be present and last. */
|
|
|
|
tidyConsoleMessages_last
|
|
|
|
} tidyConsoleMessages;
|
|
|
|
|
|
|
|
#endif /* SUPPORT_CONSOLE_APP */
|
|
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
Massive Revamp of the Messaging System
This is a rather large refactoring of Tidy's messaging system. This was done
mostly to allow non-C libraries that cannot adequately take advantage of
arg_lists a chance to query report filter information for information related
to arguments used in constructing an error message.
Three main goals were in mind for this project:
- Don't change the contents of Tidy's existing output sinks. This will ensure
that changes do no affect console Tidy users, or LibTidy users who use the
output sinks directly. This was accomplished 100% other than some improved
cosmetics in the output. See tidy-html5-tests repository, the `refactor` and
`more_messages_changes` branches for these minor diffs.
- Provide an API that is simple and also extensible without having to write new
error filters all the time. This was accomplished by adding the new message
callback `TidyMessageCallback` that provides callback functions an opaque
object representing the message, and an API to query the message for wanted
details. With this, we should never have to add a new callback routine again,
as additional API can simply be written against the opaque object.
- The API should work the same as the rest of LibTidy's API in that it's
consistent and only uses simple types with wide interoperability with other
languages. Thanks to @gagern who suggested the model for the API in #409.
Although the API uses the "Tidy" way off accessing data via an iterator
rather than an index, this can be easily abstracted in the target language.
There are two *major* API breaking changes:
- Removed TidyReportFilter2
- This was only used by one application in the entire world, and was a hacky
kludge that served its purpose. TidyReportCallback (né TidyReportFilter3)
is much better. If, for some reason, this affects you, I recommend using
TidyReportCallback instead. It's a minor change for your application.
- Renamed TidyReportFilter3 to TidyReportCallback
- This name is much more semantic, and much more sensible in light of
improved callback system. As the name implies, it remains capable of
*only* receiving callbacks for Tidy "reports."
Introducing TidyMessageCallback, and a new message interrogation API.
- As its name implies, it is able to capture (and optionally suppress) *all*
of Tidy's output, including the dialogue messages that never make it to
the existing report filters.
- Provides an opaque `TidyMessage` and an API that can be used to query against
it to find the juicy goodness inside.
- For example, `tidyGetMessageOutput( tmessage )` will return the complete,
localized message.
- Another example, `tidyGetMessageLine( tmessage )` will return the line the
message applies to.
- You can also get information about the individual arguments that make up a
message. By using the `tidyGetMessageArguments( tmessage )` itorator and
`tidyGetNextMessageArgument` you will obtain an opaque `TidyMessageArgument`
which has its own interrogation API. For example:
- tidyGetArgType( tmessage, &iterator );
- tidyGetArgFormat( tmessage, &iterator );
- tidyGetArgValueString( tmessage, &iterator );
- …and so on.
Other major changes include refactoring `messages.c` to use the new message
"object" directly when emitting messages to the console or output sinks. This
allowed replacement of a lot of specialized functions with generalized ones.
Some of this generalizing involved modifications to the `language_xx.h` header
files, and these are all positive improvements even without the above changes.
2017-03-13 17:28:57 +00:00
|
|
|
|
2011-11-17 02:44:16 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
#endif /* __TIDYENUM_H__ */
|
2013-06-28 23:20:02 +00:00
|
|
|
|