Merge pull request #503 from htacg/messages_squashed

Messages squashed
This commit is contained in:
Jim Derry 2017-03-02 09:39:19 -05:00 committed by GitHub
commit ab183b8ae5
30 changed files with 3808 additions and 2806 deletions

View file

@ -60,6 +60,16 @@ else ()
add_definitions ( -DSUPPORT_LOCALIZATIONS=0 ) add_definitions ( -DSUPPORT_LOCALIZATIONS=0 )
endif () endif ()
# Allow building without console support, which mostly prevents console strings
# from existing in the library. Note that this will prevent the console
# application from being built, since it can't be linked.
option( SUPPORT_CONSOLE_APP "Set OFF to libraries only without console application support." ON )
if (SUPPORT_CONSOLE_APP)
add_definitions ( -DSUPPORT_CONSOLE_APP=1 )
else ()
add_definitions ( -DSUPPORT_CONSOLE_APP=0 )
endif ()
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
set( WARNING_FLAGS -Wall ) set( WARNING_FLAGS -Wall )
endif(CMAKE_COMPILER_IS_GNUCXX) endif(CMAKE_COMPILER_IS_GNUCXX)
@ -214,18 +224,20 @@ endif ()
########################################################## ##########################################################
### main executable - linked with STATIC/SHARED library ### main executable - linked with STATIC/SHARED library
set(name ${LIB_NAME}) if (SUPPORT_CONSOLE_APP)
set ( BINDIR console ) set(name ${LIB_NAME})
add_executable( ${name} ${BINDIR}/tidy.c ) set ( BINDIR console )
target_link_libraries( ${name} ${add_LIBS} ) add_executable( ${name} ${BINDIR}/tidy.c )
if (MSVC) target_link_libraries( ${name} ${add_LIBS} )
if (MSVC)
set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d ) set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d )
endif () endif ()
if (NOT TIDY_CONSOLE_SHARED) if (NOT TIDY_CONSOLE_SHARED)
set_target_properties( ${name} PROPERTIES set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DTIDY_STATIC" ) COMPILE_FLAGS "-DTIDY_STATIC" )
endif ()
install (TARGETS ${name} DESTINATION bin)
endif () endif ()
install (TARGETS ${name} DESTINATION bin)
if (BUILD_TAB2SPACE) if (BUILD_TAB2SPACE)
set(name tab2space) set(name tab2space)
@ -250,7 +262,7 @@ endif ()
#========================================================== #==========================================================
# Create man pages # Create man pages
#========================================================== #==========================================================
if (UNIX) if (UNIX AND SUPPORT_CONSOLE_APP)
find_program( XSLTPROC_FOUND xsltproc ) find_program( XSLTPROC_FOUND xsltproc )
if (XSLTPROC_FOUND) if (XSLTPROC_FOUND)
## NOTE: man name must match exe ie currently `${LIB_NAME}.1` not `tidy.1` ## NOTE: man name must match exe ie currently `${LIB_NAME}.1` not `tidy.1`

105
README/API_AND_NAMESPACE.md Normal file
View file

@ -0,0 +1,105 @@
# The `LibTidy` API and Namespacing
## Introduction
If you're just getting started working with `LibTidy`, some of the design choices may seem overwhelming if you're not a seasoned C veteran. Hopefully this article will give a decent overview, encouraging you to explore and contribute to the `LibTidy` code.
This article will discuss briefly:
- How `LibTidy` achieves namespacing in C
- Explanations for some of the bizzarre, do-nothing macros.
- Opaque types
- How to add new functions to the `LibTidy` API.
# Namespacing
The C language does not support built in namespacing, but it is subject to namespace collision, especially when a library is statically linked. `LibTidy` tries to get around this by making a compromise between human-readable names and making the names random enough to avoid a collision.
As you browse Tidy's code, you'll notice many uses of a macro function `TY_()` applied to the function names of non-static functions. The preprocessor thus resolves all of these function names to `prvTidyFunction`, thus ensuring a clear namespace and avoiding the possibility of collisions (unless some other library has thoughtlessly borrowed our prefix for the same). For example, `TY_(getNextOptionPick)` will resolve to `prvTidygetNextOptionPick` when compiled.
Of course, `static` functions are immune to the issue of namespace pollution, so in general you will really only use this technique for functions that must be accessible from outside of your new file, such as functions that you want to expose to the API.
# Macros for documentation
`TIDY_EXPORT` and `TIDY_CALL` are defined to be `NULL`, i.e., when compiled they resolve to nothing. These are used exclusively for documenting functions that are part of the API defined in `tidy.h` and the implementation in `tidylib.c`. For example, in `tidy.h`:
~~~
TIDY_EXPORT TidyIterator TIDY_CALL getWindowsLanguageList();
~~~
The `TIDY_EXPORT` call clearly indicates that this function prototype is meant to be exported from the API, and `TIDY_CALL` clearly indicates that the function is called from within `LibTidy`.
Although this makes things obvious from the documentation perspective, the truth is a little murkier. In some environments one might define `TIDY_EXPORT` and `TIDY_CALL` differently in order to control compiler behavior, especially in environments that have special requirements for dynamic libraries. In general, though, you shouldn't have to worry about this.
Note that MSVC has issues with macros inserted before pointer operators, and so the preferred use of pointer operators when documenting with macros is this:
~~~
const tidyLocaleMapItem* TIDY_CALL getNextWindowsLanguage( TidyIterator* iter )
~~~
…instead of this:
~~~
const tidyLocaleMapItem TIDY_CALL *getNextWindowsLanguage( TidyIterator* iter )
~~~
# External types are opaque
In several spots the source code indicates that a particular structure is "opaque." This simply means that API users cannot see inside of them, and they have to depend on accessor functions to gain access to the sweet fruit that is within. This is a design choice that makes `LibTidy` highly portable and makes it accessible to multitudes of other languages that can communicate with a C API.
Take `tidyDoc` for example, as it's the most fundamental datatype within `LibTidy`. As an API user, you can have a reference to a `tidyDoc`, and you're going to pass it around a lot to accessor functions (such as `tidyCleanAndRepair`), and you know that it contains lots of good stuff, but you're not allowed to peek inside of it unless an accessor function is provided. Think of it as a token that you pass around, and nothing more.
Internally, the type is cast to a native C structure of type `tidyDocImpl`, and so if you decide to become a Tidy developer, you have the choice to access the item fully.
If you extend Tidy's API, it's important to respect this design choice, even if only writing functionality for the console application (which is, of course, simply an implementor of `LibTidy`).
# How to add new functions to `LibTidy`
All of the information above is useful for anyone who wants to browse Tidy's source code, or use the API, or understand Tidy better, but it all comes together nicely when you want to extend the API. This quick lesson will show you how to do so, using `tidyLocalizedString()` as an example.
## Behind the scenes
The first thing we need to do is have the internal version of the function that we want to add. Tidy has module that handles localization: `language.h/c`. In the header is where we define the interface to LibTidy, which should be namespaced according to the discussion above. We can declare:
~~~
ctmbstr TY_(tidyLocalizedString)( uint messageType );
~~~
…and of course implement it in the `.c` file.
Now you have a decision to make: if you plan to use this function internally, you're going to have to import the header into other modules that require the function. This can lead to painful compile-time consequences. However since we want to expose this particular function to the API, it will be visible within `TidyLib`, so we can use the public API internally, too.
## The API
Once implemented, we want a pretty, public-facing name for our `tidyLocalizedString()` function, which appropriate is `tidyLocalizedString()`. Add the declaration to `tidy.h`:
~~~
TIDY_EXPORT ctmbstr TIDY_CALL tidyLocalizedString( uint messageType );
~~~
…and now the publicly exposed interface knows that your function exists. All that's left to do is add the `language.h` header to `tidylib.c`, and then implement it there:
~~~
ctmbstr TIDY_CALL tidyLocalizedString( uint messageType )
{
return TY_(tidyLocalizedString)( messageType );
}
~~~
Congratulations, you can now expose new functionality to the API.
## API functions for opaque types
For a more complicated example that demonstrates how to use opaque types (and also the `TidyIterator` type) have a look at the implementation of `getWindowsLanguageList()`, and its partners `*getNextWindowsLanguage()`, `TidyLangWindowsName()`, and `TidyLangPosixName()`. These demonstrate how to:
- implement iteration for structures with multiple records.
- write a function in `tidylib.c` that converts between the exposed, opaque type and the internal, implementation type.
- further reinforce how functionality is added to the API.

View file

@ -18,6 +18,9 @@ From reading of the Tidy source, some things are self evident, in no particular
- No C++ single line comments using `//`. - No C++ single line comments using `//`.
- The openning `{` is indented on the next newline. - The openning `{` is indented on the next newline.
- While the maximum code line length varies, generally long `if`, `while`, ... statements are wrapped to newlines. - While the maximum code line length varies, generally long `if`, `while`, ... statements are wrapped to newlines.
- For compatibility with MSVC, pointer operators in declarations must precede any macro documentation, e.g, `const tidyLocaleMapItem* TIDY_CALL getNextWindowsLanguage( TidyIterator* iter )` instead of `const tidyLocaleMapItem TIDY_CALL *getNextWindowsLanguage( TidyIterator* iter )`.
Look forward to this document being filled out in detail... Look forward to this document being filled out in detail...

View file

@ -2,34 +2,24 @@
Tidy has quite complex warning/error messaging system. This is all about adding a **new** warning or error message to **libTidy**. Tidy has quite complex warning/error messaging system. This is all about adding a **new** warning or error message to **libTidy**.
First assign the message a key value. This is done in `message.h`, in one of the two enumerations that are listed there. First assign the message a key value. This is done in `tidyenum.h`, in one of the two enumerations that are listed there.
1. `tidyErrorCodes` - starts with the value `CODES_TIDY_ERROR_FIRST = 200`, and it must be first. 1. `tidyMessageCodes` - starts with the value `tidyMessageCodes_first = 500`, and it must be first. These are messages that appear in Tidy's report list, the list that's emitted telling you what Tidy did to your code. **However** don't modify this enum directly. You'll modify a preprocessor macro instead.
2. `tidyMessagesMisc` - starts with the value ACCESS_URL = 2048 - so, at present the above `tidyErrorCodes` must not exceed this. 2. `tidyMessagesMisc` - starts with the value `tidyMessagesMisc_first = tidyMessageCodes_last`. These are messages that are emitted that tell you general information, such as further advice.
3. For the sake of completeness, there's also a third enum present in `access.h` called `accessErrorCodes`; you should only ever be concerned about this if you are working on new strings for Tidy's accessibility module.
If your message is something that will appear in the error list, then its key should be defined in the `tidyErrorCodes` enum, unless you are adding errors to the accessibility module (see point 3, above). If you are adding strings that are _not_ intended for the error list, then they belong in `tidyMessagesMisc`. These are strings that are typically output with Tidy's CLI.
All enum values are only ever used by name within **libTidy** (and incidentally, should only ever be used by name in your client applications; never trust the value!), so feel free to enter new strings wherever they make the most sense. There are already existing categories (marked by comments), or feel free to create a new category if that's best. All enum values are only ever used by name within **libTidy** (and incidentally, should only ever be used by name in your client applications; never trust the value!), so feel free to enter new strings wherever they make the most sense. There are already existing categories (marked by comments), or feel free to create a new category if that's best.
Because some clients retrieve error information via `libTidy`s callback mechanism, it's also important to update the `language.c:tidyErrorFilterKeysStruct[]`, as well, if your new messages are intended for the error list. As mentioned above, `tidyMessageCodes` messaged must be defined in one of the existing macros named like `FOREACH_...(FN)`, such as `FOREACH_MSG_ENTITIES(FN)`. These macros ensure that another data structure used for localization and key lookup is updated automatically any time strings are added or removed, thus limiting the possibility of developer error.
## Step 1 ## Step 1
So in this case I want to add 3 warning messages: `BAD_SURROGATE_PAIR`, `BAD_SURROGATE_TAIL`, and `BAD_SURROGATE_LEAD`. Because these are error messages, they belong in the `tidyErrorCodes` enum, and they fit into nicely into the "character encoding errors" category just before the **last** `CODES_TIDY_ERROR_LAST`. So in this case I want to add 3 warning messages: `BAD_SURROGATE_PAIR`, `BAD_SURROGATE_TAIL`, and `BAD_SURROGATE_LEAD`. Because these are error messages, they belong in the `tidyErrorCodes` enum, and they fit into nicely into the macro beginning `FOREACH_MSG_ENCODING(FN)`.
## Step 2 ## Step 2
Because the new messages are error code, update the `tidyErrorFilterKeysStruct` in `language.c` with the same key values, and with string representations thereof. You should put them in the same logical order as you inserted them into `tidyErrorCodes` enum.
Note that at some point when all of the error enums are merged (probably Tidy 5.5) this kludge won't have to be used and we can have a nice, single enum exported to clients.
## Step 3
The next step is adding a `format` string to `language_en.h`. This string may later be translated to various supported language strings, but at present it is important that the other language translated strings, like `language_fr.h`, `language_es.h`, etc, keep the same format order. The next step is adding a `format` string to `language_en.h`. This string may later be translated to various supported language strings, but at present it is important that the other language translated strings, like `language_fr.h`, `language_es.h`, etc, keep the same format order.
Where to add this seems a bit of a mess, but in general things are grouped by where they're used in `libTidy`, and often in alphabetical order within those groups. Here I've added them relative to where they were placed in the other enums and structs. Where to add this seems a bit of a mess, but in general things are grouped by where they're used in `libTidy`, and often in alphabetical order within those groups. Here I've added them relative to where they were placed in the other enums and structs.

View file

@ -9,7 +9,6 @@
*/ */
#include "tidy.h" #include "tidy.h"
#include "language.h"
#include "locale.h" #include "locale.h"
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> /* Force console to UTF8. */ #include <windows.h> /* Force console to UTF8. */
@ -554,19 +553,9 @@ static Bool isAutoBool( TidyOption topt )
*/ */
static ctmbstr ConfigCategoryName( TidyConfigCategory id ) static ctmbstr ConfigCategoryName( TidyConfigCategory id )
{ {
switch( id ) if (id >= TidyMarkup && id <= TidyMiscellaneous)
{ return tidyLocalizedString(id);
case TidyMarkup:
return tidyLocalizedString( TC_CAT_MARKUP );
case TidyDiagnostics:
return tidyLocalizedString( TC_CAT_DIAGNOSTICS );
case TidyPrettyPrint:
return tidyLocalizedString( TC_CAT_PRETTYPRINT );
case TidyEncoding:
return tidyLocalizedString( TC_CAT_ENCODING );
case TidyMiscellaneous:
return tidyLocalizedString( TC_CAT_MISC );
}
fprintf(stderr, tidyLocalizedString(TC_STRING_FATAL_ERROR), (int)id); fprintf(stderr, tidyLocalizedString(TC_STRING_FATAL_ERROR), (int)id);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@ -884,13 +873,17 @@ void tidyPrintWindowsLanguageNames( ctmbstr format )
{ {
const tidyLocaleMapItem *item; const tidyLocaleMapItem *item;
TidyIterator i = getWindowsLanguageList(); TidyIterator i = getWindowsLanguageList();
ctmbstr winName;
ctmbstr posixName;
while (i) { while (i) {
item = getNextWindowsLanguage(&i); item = getNextWindowsLanguage(&i);
winName = TidyLangWindowsName( item );
posixName = TidyLangPosixName( item );
if ( format ) if ( format )
printf( format, item->winName, item->POSIXName ); printf( format, winName, posixName );
else else
printf( "%-20s -> %s\n", item->winName, item->POSIXName ); printf( "%-20s -> %s\n", winName, posixName );
} }
} }
@ -1424,7 +1417,7 @@ static void xml_options_strings( TidyDoc tdoc )
**/ **/
static void xml_error_strings( TidyDoc tdoc ) static void xml_error_strings( TidyDoc tdoc )
{ {
const tidyErrorFilterKeyItem *item; uint errorCode;
ctmbstr localizedString; ctmbstr localizedString;
TidyIterator j = getErrorCodeList(); TidyIterator j = getErrorCodeList();
@ -1432,10 +1425,10 @@ static void xml_error_strings( TidyDoc tdoc )
printf( "<error_strings version=\"%s\">\n", tidyLibraryVersion()); printf( "<error_strings version=\"%s\">\n", tidyLibraryVersion());
while (j) { while (j) {
item = getNextErrorCode(&j); errorCode = getNextErrorCode(&j);
localizedString = tidyLocalizedString(item->value); localizedString = tidyLocalizedString(errorCode);
printf( " <error_string>\n" ); printf( " <error_string>\n" );
printf( " <name>%s</name>\n",item->key); printf( " <name>%s</name>\n", tidyErrorCodeAsKey(errorCode));
if ( localizedString ) if ( localizedString )
printf( " <string class=\"%s\"><![CDATA[%s]]></string>\n", tidyGetLanguage(), localizedString ); printf( " <string class=\"%s\"><![CDATA[%s]]></string>\n", tidyGetLanguage(), localizedString );
else else
@ -1457,7 +1450,9 @@ static void xml_error_strings( TidyDoc tdoc )
** better to use our POT/PO workflow with your favorite tools, or simply ** better to use our POT/PO workflow with your favorite tools, or simply
** diff the language header files directly. ** diff the language header files directly.
** **Important:** The attribute `id` is not a specification, promise, or ** **Important:** The attribute `id` is not a specification, promise, or
** part of an API. You must not depend on this value. ** part of an API. You must not depend on this value. For strings meant
** for error output, the `label` attribute will contain the stringified
** version of the internal key for the string.
*/ */
static void xml_strings( void ) static void xml_strings( void )
{ {
@ -1465,6 +1460,7 @@ static void xml_strings( void )
TidyIterator j; TidyIterator j;
ctmbstr current_language = tidyGetLanguage(); ctmbstr current_language = tidyGetLanguage();
ctmbstr current_label;
Bool skip_current = strcmp( current_language, "en" ) == 0; Bool skip_current = strcmp( current_language, "en" ) == 0;
Bool matches_base; Bool matches_base;
@ -1474,7 +1470,10 @@ static void xml_strings( void )
j = getStringKeyList(); j = getStringKeyList();
while (j) { while (j) {
i = getNextStringKey(&j); i = getNextStringKey(&j);
printf( "<localized_string id=\"%u\">\n", i ); current_label = tidyErrorCodeAsKey(i);
if (!strcmp(current_label, "UNDEFINED"))
current_label = "";
printf( "<localized_string id=\"%u\" label=\"%s\">\n", i, current_label );
printf( " <string class=\"%s\">", "en" ); printf( " <string class=\"%s\">", "en" );
printf("%s", tidyDefaultString(i)); printf("%s", tidyDefaultString(i));
printf( "</string>\n" ); printf( "</string>\n" );

View file

@ -1,15 +1,11 @@
#ifndef __TIDY_H__ #ifndef __TIDY_H__
#define __TIDY_H__ #define __TIDY_H__
/** @file tidy.h - Defines HTML Tidy API implemented by tidy library. /** @file tidy.h - Defines HTML Tidy API implemented by LibTidy.
Public interface is const-correct and doesn't explicitly depend
on any globals. Thus, thread-safety may be introduced w/out
changing the interface.
Looking ahead to a C++ wrapper, C functions always pass
this-equivalent as 1st arg.
Public interface is const-correct and doesn't explicitly depend on any
globals. Thus, thread-safety may be introduced without changing the
interface.
Copyright (c) 1998-2016 World Wide Web Consortium Copyright (c) 1998-2016 World Wide Web Consortium
(Massachusetts Institute of Technology, European Research (Massachusetts Institute of Technology, European Research
@ -20,45 +16,43 @@
Dave Raggett <dsr@w3.org> Dave Raggett <dsr@w3.org>
The contributing author(s) would like to thank all those who The contributing author(s) would like to thank all those who helped with
helped with testing, bug fixes and suggestions for improvements. testing, bug fixes and suggestions for improvements. This wouldn't have been
This wouldn't have been possible without your help. possible without your help.
COPYRIGHT NOTICE: COPYRIGHT NOTICE:
This software and documentation is provided "as is," and This software and documentation is provided "as is," and the copyright holders
the copyright holders and contributing author(s) make no and contributing author(s) make no representations or warranties, express or
representations or warranties, express or implied, including implied, including but not limited to, warranties of merchantability or
but not limited to, warranties of merchantability or fitness fitness for any particular purpose or that the use of the software or
for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights,
documentation will not infringe any third party patents, trademarks or other rights.
copyrights, trademarks or other rights.
The copyright holders and contributing author(s) will not be held The copyright holders and contributing author(s) will not be held liable for
liable for any direct, indirect, special or consequential damages any direct, indirect, special or consequential damages arising out of any use
arising out of any use of the software or documentation, even if of the software or documentation, even if advised of the possibility of such
advised of the possibility of such damage. damage.
Permission is hereby granted to use, copy, modify, and distribute Permission is hereby granted to use, copy, modify, and distribute this source
this source code, or portions hereof, documentation and executables, code, or portions hereof, documentation and executables, for any purpose,
for any purpose, without fee, subject to the following restrictions: without fee, subject to the following restrictions:
1. The origin of this source code must not be misrepresented. 1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must 2. Altered versions must be plainly marked as such and must not be
not be misrepresented as being the original source. misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any 3. This Copyright notice may not be removed or altered from any source or
source or altered source distribution. altered source distribution.
The copyright holders and contributing author(s) specifically
permit, without fee, and encourage the use of this source code
as a component for supporting the Hypertext Markup Language in
commercial products. If you use this source code in a product,
acknowledgment is not required but would be appreciated.
The copyright holders and contributing author(s) specifically permit, without
 fee, and encourage the use of this source code as a component for supporting
the Hypertext Markup Language in commercial products. If you use this source
code in a product, acknowledgment is not required but would be appreciated.
Created 2001-05-20 by Charles Reitzel Created 2001-05-20 by Charles Reitzel
Updated 2002-07-01 by Charles Reitzel - 1st Implementation Updated 2002-07-01 by Charles Reitzel - 1st Implementation
Updated 2015-06-09 by Geoff R. McLane - Add more doxygen syntax Updated 2015-06-09 by Geoff R. McLane - Add more doxygen syntax
Additional updates: consult git log
*/ */
@ -71,8 +65,14 @@ extern "C" {
/** @defgroup Opaque Opaque Types /** @defgroup Opaque Opaque Types
** **
** These instances of these types are available for use in your programs,
** however their internal details are opaque. These items should be accessed
** with LibTidy's accessor functions.
**
** Internally LibTidy will cast these to internal implementation types.
** Cast to implementation types within lib. ** Cast to implementation types within lib.
** Reduces inter-dependencies/conflicts w/ application code. **
** This reduces inter-dependencies and conflicts with application code.
** @{ ** @{
*/ */
@ -98,55 +98,46 @@ opaque_type( TidyAttr );
/** @} end Opaque group */ /** @} end Opaque group */
TIDY_STRUCT struct _TidyBuffer; TIDY_STRUCT struct _TidyBuffer;
typedef struct _TidyBuffer TidyBuffer; typedef struct _TidyBuffer TidyBuffer;
/** @defgroup Memory Memory Allocation /** @defgroup Memory Memory Allocation
** **
** Tidy uses a user provided allocator for all ** Tidy uses a user provided allocator for all memory allocations. If this
** memory allocations. If this allocator is ** allocator is not provided, then a default allocator is used which simply
** not provided, then a default allocator is ** wraps standard C malloc/free calls. These wrappers call the panic function
** used which simply wraps standard C malloc/free ** upon any failure. The default panic function prints an out of memory message
** calls. These wrappers call the panic function ** to stderr, and calls exit(2).
** upon any failure. The default panic function
** prints an out of memory message to stderr, and
** calls exit(2).
** **
** For applications in which it is unacceptable to ** For applications in which it is unacceptable to abort in the case of memory
** abort in the case of memory allocation, then the ** allocation, then the panic function can be replaced with one which longjmps()
** panic function can be replaced with one which ** out of the LibTidy code. For this to clean up completely, you should be
** longjmps() out of the tidy code. For this to ** careful not to use any tidy methods that open files as these will not be
** clean up completely, you should be careful not ** closed before panic() is called.
** to use any tidy methods that open files as these
** will not be closed before panic() is called.
** **
** TODO: associate file handles with tidyDoc and ** TODO: associate file handles with tidyDoc and ensure that tidyDocRelease()
** ensure that tidyDocRelease() can close them all. ** can close them all.
** **
** Calling the withAllocator() family ( ** Calling the xWithAllocator() family (tidyCreateWithAllocator,
** tidyCreateWithAllocator, tidyBufInitWithAllocator, ** tidyBufInitWithAllocator, tidyBufAllocWithAllocator) allow setting custom
** tidyBufAllocWithAllocator) allow settings custom ** allocators.
** allocators).
** **
** All parts of the document use the same allocator. ** All parts of the document use the same allocator. Calls that require a user
** Calls that require a user provided buffer can ** provided buffer can optionally use a different allocator.
** optionally use a different allocator.
** **
** For reference in designing a plug-in allocator, ** For reference in designing a plug-in allocator, most allocations made by
** most allocations made by tidy are less than 100 ** LibTidy are less than 100 bytes, corresponding to attribute names and
** bytes, corresponding to attribute names/values, etc. ** values, etc.
** **
** There is also an additional class of much larger ** There is also an additional class of much larger allocations which are where
** allocations which are where most of the data from ** most of the data from the lexer is stored. It is not currently possible to
** the lexer is stored. (It is not currently possible ** use a separate allocator for the lexer; this would be a useful extension.
** to use a separate allocator for the lexer, this
** would be a useful extension).
** **
** In general, approximately 1/3rd of the memory ** In general, approximately 1/3rd of the memory used by LibTidy is freed during
** used by tidy is freed during the parse, so if ** the parse, so if memory usage is an issue then an allocator that can reuse
** memory usage is an issue then an allocator that ** this memory is a good idea.
** can reuse this memory is a good idea.
** **
** @{ ** @{
*/ */
@ -161,8 +152,7 @@ struct _TidyAllocator;
/** The allocator **/ /** The allocator **/
typedef struct _TidyAllocator TidyAllocator; typedef struct _TidyAllocator TidyAllocator;
/** An allocator's function table. All functions here must /** An allocator's function table. All functions here must be provided.
be provided.
*/ */
struct _TidyAllocatorVtbl { struct _TidyAllocatorVtbl {
/** Called to allocate a block of nBytes of memory */ /** Called to allocate a block of nBytes of memory */
@ -173,15 +163,14 @@ struct _TidyAllocatorVtbl {
void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes ); void* (TIDY_CALL *realloc)( TidyAllocator *self, void *block, size_t nBytes );
/** Called to free a previously allocated block of memory */ /** Called to free a previously allocated block of memory */
void (TIDY_CALL *free)( TidyAllocator *self, void *block); void (TIDY_CALL *free)( TidyAllocator *self, void *block);
/** Called when a panic condition is detected. Must support /** Called when a panic condition is detected. Must support block == NULL.
block == NULL. This function is not called if either alloc This function is not called if either alloc or realloc fails; it is up
or realloc fails; it is up to the allocator to do this. to the allocator to do this. Currently this function can only be called
Currently this function can only be called if an error is if an error is detected in the tree integrity via the internal function
detected in the tree integrity via the internal function CheckNodeIntegrity(). This is a situation that can only arise in the
CheckNodeIntegrity(). This is a situation that can case of a programming error in LibTidy. You can turn off node integrity
only arise in the case of a programming error in tidylib. checking by defining the constant NO_NODE_INTEGRITY_CHECK during the
You can turn off node integrity checking by defining build.
the constant NO_NODE_INTEGRITY_CHECK during the build.
**/ **/
void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg ); void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg );
}; };
@ -249,73 +238,20 @@ TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic );
/** @defgroup Basic Basic Operations /** @defgroup Basic Basic Operations
** **
** Tidy public interface ** For an excellent example of how to invoke LibTidy, please consult
** `console/tidy.c:main()` for in-depth implementation details. A simplified
** example can be seen on our site: http://www.html-tidy.org/developer/
** **
** Several functions return an integer document status: ** There used to be an example built into the documentation right here, but
** as it was formatted for Doxygen rather than a developer, it was unreadable
** and so has been removed.
** **
** <pre>
** 0 -> SUCCESS
** >0 -> 1 == TIDY WARNING, 2 == TIDY ERROR
** <0 -> SEVERE ERROR
** </pre>
**
The following is a short example program.
<pre>
\#include &lt;tidy.h&gt;
\#include &lt;tidybuffio.h&gt;
\#include &lt;stdio.h&gt;
\#include &lt;errno.h&gt;
int main(int argc, char **argv )
{
const char* input = "&lt;title&gt;Foo&lt;/title&gt;&lt;p&gt;Foo!";
TidyBuffer output;
TidyBuffer errbuf;
int rc = -1;
Bool ok;
TidyDoc tdoc = tidyCreate(); // Initialize "document"
tidyBufInit( &amp;output );
tidyBufInit( &amp;errbuf );
printf( "Tidying:\t\%s\\n", input );
ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML
if ( ok )
rc = tidySetErrorBuffer( tdoc, &amp;errbuf ); // Capture diagnostics
if ( rc &gt;= 0 )
rc = tidyParseString( tdoc, input ); // Parse the input
if ( rc &gt;= 0 )
rc = tidyCleanAndRepair( tdoc ); // Tidy it up!
if ( rc &gt;= 0 )
rc = tidyRunDiagnostics( tdoc ); // Kvetch
if ( rc &gt; 1 ) // If error, force output.
rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
if ( rc &gt;= 0 )
rc = tidySaveBuffer( tdoc, &amp;output ); // Pretty Print
if ( rc &gt;= 0 )
{
if ( rc &gt; 0 )
printf( "\\nDiagnostics:\\n\\n\%s", errbuf.bp );
printf( "\\nAnd here is the result:\\n\\n\%s", output.bp );
}
else
printf( "A severe error (\%d) occurred.\\n", rc );
tidyBufFree( &amp;output );
tidyBufFree( &amp;errbuf );
tidyRelease( tdoc );
return rc;
}
</pre>
** @{ ** @{
*/ */
/** The primary creation of a TidyDoc. /** The primary creation of a TidyDoc. This must be the first call before most
** This must be the first call before most of the Tidy API which require the TidyDoc parameter. ** of the Tidy API which require the TidyDoc parameter. When completed,
** When completed tidyRelease( TidyDoc tdoc ); should be called to release all memory ** tidyRelease( TidyDoc tdoc ); should be called to release all memory
*/ */
TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void); TIDY_EXPORT TidyDoc TIDY_CALL tidyCreate(void);
@ -338,10 +274,7 @@ TIDY_EXPORT void TIDY_CALL tidySetAppData( TidyDoc tdoc, void* appData );
TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc ); TIDY_EXPORT void* TIDY_CALL tidyGetAppData( TidyDoc tdoc );
/** Get release date (version) for current library /** Get release date (version) for current library
** @deprecated tidyReleaseDate() is deprecated in favor of semantic
** versioning and should be replaced with tidyLibraryVersion().
*/ */
TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void); TIDY_EXPORT ctmbstr TIDY_CALL tidyReleaseDate(void);
/** Get version number for the current library */ /** Get version number for the current library */
@ -1138,6 +1071,137 @@ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod );
/** @} end AttrGet group */ /** @} end AttrGet group */
/** @defgroup MessagesKeys Message Key Management
**
** These functions serve to manage message codes. To-do is to rename them
** so they reflect messages and not errors.
** @{
*/
TIDY_EXPORT ctmbstr TIDY_CALL tidyErrorCodeAsKey(uint code);
TIDY_EXPORT TidyIterator TIDY_CALL getErrorCodeList();
TIDY_EXPORT uint TIDY_CALL getNextErrorCode( TidyIterator* iter );
/** @} end MessagesKeys group */
/** @defgroup Localization Localization Support
**
** These functions help manage localization in Tidy.
** @{
*/
/**
** Determines the current locale without affecting the C locale.
** Tidy has always used the default C locale, and at this point
** in its development we're not going to tamper with that.
** @param result The buffer to use to return the string.
** Returns NULL on failure.
** @return The same buffer for convenience.
*/
TIDY_EXPORT tmbstr TIDY_CALL tidySystemLocale(tmbstr result);
/**
* Tells Tidy to use a different language for output.
* @param languageCode A Windows or POSIX language code, and must match
* a TIDY_LANGUAGE for an installed language.
* @result Indicates that a setting was applied, but not necessarily the
* specific request, i.e., true indicates a language and/or region
* was applied. If es_mx is requested but not installed, and es is
* installed, then es will be selected and this function will return
* true. However the opposite is not true; if es is requested but
* not present, Tidy will not try to select from the es_XX variants.
*/
TIDY_EXPORT Bool TIDY_CALL tidySetLanguage( ctmbstr languageCode );
/**
* Gets the current language used by Tidy.
*/
TIDY_EXPORT ctmbstr TIDY_CALL tidyGetLanguage();
/**
* Provides a string given `messageType` in the current
* localization for `quantity`.
*/
TIDY_EXPORT ctmbstr TIDY_CALL tidyLocalizedStringN( uint messageType, uint quantity );
/**
* Provides a string given `messageType` in the current
* localization for the single case.
*/
TIDY_EXPORT ctmbstr TIDY_CALL tidyLocalizedString( uint messageType );
/**
* Provides a string given `messageType` in the default
* localization (which is `en`).
*/
TIDY_EXPORT ctmbstr TIDY_CALL tidyDefaultString( uint messageType );
/*
* Initializes the TidyIterator to point to the first item
* in Tidy's list of localization string keys. Note that
* these are provided for documentation generation purposes
* and probably aren't useful for LibTidy implementors.
*/
TIDY_EXPORT TidyIterator TIDY_CALL getStringKeyList();
/*
* Provides the next key value in Tidy's list of localized
* strings. Note that these are provided for documentation
* generation purposes and probably aren't useful to
* libtidy implementors.
*/
TIDY_EXPORT uint TIDY_CALL getNextStringKey( TidyIterator* iter );
/**
* Define an opaque type we can use for tidyLocaleMapItem, which
* is used to iterate through the language list, and used to access
* the windowsName() and the posixName().
*/
opaque_type(tidyLocaleMapItem);
/**
* Initializes the TidyIterator to point to the first item
* in Tidy's structure of Windows<->POSIX local mapping.
* Items can be retrieved with getNextWindowsLanguage();
*/
TIDY_EXPORT TidyIterator TIDY_CALL getWindowsLanguageList();
/**
* Returns the next record of type `localeMapItem` in
* Tidy's structure of Windows<->POSIX local mapping.
*/
TIDY_EXPORT const tidyLocaleMapItem* TIDY_CALL getNextWindowsLanguage( TidyIterator* iter );
/**
* Given a `tidyLocalMapItem`, return the Windows name.
*/
TIDY_EXPORT const ctmbstr TIDY_CALL TidyLangWindowsName( const tidyLocaleMapItem *item );
/**
* Given a `tidyLocalMapItem`, return the POSIX name.
*/
TIDY_EXPORT const ctmbstr TIDY_CALL TidyLangPosixName( const tidyLocaleMapItem *item );
/**
* Initializes the TidyIterator to point to the first item
* in Tidy's list of installed language codes.
* Items can be retrieved with getNextInstalledLanguage();
*/
TIDY_EXPORT TidyIterator TIDY_CALL getInstalledLanguageList();
/**
* Returns the next installed language.
*/
TIDY_EXPORT ctmbstr TIDY_CALL getNextInstalledLanguage( TidyIterator* iter );
/** @} end MessagesKeys group */
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View file

@ -1,18 +1,31 @@
#ifndef __TIDYENUM_H__ #ifndef __TIDYENUM_H__
#define __TIDYENUM_H__ #define __TIDYENUM_H__
/** @file tidyenum.h - Separated public enumerations header /*********************************************************************
* Separated public enumerations header
Simplifies enum re-use in various wrappers. e.g. SWIG *
generated wrappers and COM IDL files. * Simplifies enum re-use in various wrappers, e.g. SWIG, generated
* wrappers, and COM IDL files.
(c) 1998-2016 (W3C) MIT, ERCIM, Keio University *
See tidy.h for the full copyright notice. * This file also contains macros to generate additional enums for
* use in Tidy's language localizations. See detailed information in
Created 2001-05-20 by Charles Reitzel * comments.
Updated 2002-07-01 by Charles Reitzel - 1st Implementation *
* 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.
*********************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -21,11 +34,13 @@ extern "C" {
/* Enumerate configuration options /* Enumerate configuration options
*/ */
/** Categories of Tidy configuration options /** 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.
*/ */
typedef enum typedef enum
{ {
TidyMarkup, /**< Markup options: (X)HTML version, etc */ TidyMarkup = 300, /**< Markup options: (X)HTML version, etc */
TidyDiagnostics, /**< Diagnostics */ TidyDiagnostics, /**< Diagnostics */
TidyPrettyPrint, /**< Output layout */ TidyPrettyPrint, /**< Output layout */
TidyEncoding, /**< Character encodings */ TidyEncoding, /**< Character encodings */
@ -37,13 +52,10 @@ typedef enum
These TidyOptionId are used throughout libtidy, and also These TidyOptionId are used throughout libtidy, and also
have associated localized strings to describe them. have associated localized strings to describe them.
Note this enum MUST start at zero due to historical design-time
decisions that make assumptions about this starting value.
*/ */
typedef enum typedef enum
{ {
TidyUnknownOption, /**< Unknown option! */ TidyUnknownOption = 0, /**< Unknown option! */
TidyIndentSpaces, /**< Indentation n spaces/tabs */ TidyIndentSpaces, /**< Indentation n spaces/tabs */
TidyWrapLen, /**< Wrap margin */ TidyWrapLen, /**< Wrap margin */
TidyTabSize, /**< Expand tabs to n spaces */ TidyTabSize, /**< Expand tabs to n spaces */
@ -72,7 +84,7 @@ typedef enum
TidyIndentContent, /**< Indent content of appropriate tags */ TidyIndentContent, /**< Indent content of appropriate tags */
/**< "auto" does text/block level content indentation */ /**< "auto" does text/block level content indentation */
TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */ TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */
TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */ TidyOmitOptionalTags, /**< Suppress optional start tags and end tags */
TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */ TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */
TidyXmlTags, /**< Treat input as XML */ TidyXmlTags, /**< Treat input as XML */
TidyXmlOut, /**< Create output as XML */ TidyXmlOut, /**< Create output as XML */
@ -107,11 +119,11 @@ typedef enum
TidyWrapJste, /**< Wrap within JSTE pseudo elements */ TidyWrapJste, /**< Wrap within JSTE pseudo elements */
TidyWrapPhp, /**< Wrap within PHP pseudo elements */ TidyWrapPhp, /**< Wrap within PHP pseudo elements */
TidyFixBackslash, /**< Fix URLs by replacing \ with / */ TidyFixBackslash, /**< Fix URLs by replacing \ with / */
TidyIndentAttributes,/**< Newline+indent before each attribute */ TidyIndentAttributes, /**< Newline+indent before each attribute */
TidyXmlPIs, /**< If set to yes PIs must end with ?> */ TidyXmlPIs, /**< If set to yes PIs must end with ?> */
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */ TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */
TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */ TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */
TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */ TidyEncloseBlockText, /**< If yes text in blocks is wrapped in P's */
TidyKeepFileTimes, /**< If yes last modied time is preserved */ TidyKeepFileTimes, /**< If yes last modied time is preserved */
TidyWord2000, /**< Draconian cleaning for Word2000 */ TidyWord2000, /**< Draconian cleaning for Word2000 */
TidyMark, /**< Add meta element indicating tidied doc */ TidyMark, /**< Add meta element indicating tidied doc */
@ -237,26 +249,20 @@ typedef enum
/* I/O and Message handling interface /* I/O and Message handling interface
** **
** By default, Tidy will define, create and use ** By default, Tidy will define, create and use instances of input and output
** instances of input and output handlers for ** handlers for standard C buffered I/O (i.e. FILE* stdin, ** FILE* stdout and
** standard C buffered I/O (i.e. FILE* stdin, ** FILE* stderr for content input, content output and diagnostic output,
** FILE* stdout and FILE* stderr for content ** respectively. A FILE* cfgFile input handler will be used for config files.
** input, content output and diagnostic output, ** Command line options will just be set directly.
** respectively. A FILE* cfgFile input handler
** will be used for config files. Command line
** options will just be set directly.
*/ */
/** Message severity level /** Message severity level. These are used throughout LibTidy to indicate the
* These TidyReportLevel are used throughout libtidy, but don't * severity of a message, and they also have associated localized strings to
* have associated localized strings to describe them because * describe them.
* TidyReportLevel is externally-facing, and changing the enum */
* starting int can break existing API's for poorly-written
* applications using libtidy. See enum `TidyReportLevelKeys`.
*/
typedef enum typedef enum
{ {
TidyInfo, /**< Information about markup usage */ TidyInfo = 350, /**< Information about markup usage */
TidyWarning, /**< Warning message */ TidyWarning, /**< Warning message */
TidyConfig, /**< Configuration error */ TidyConfig, /**< Configuration error */
TidyAccess, /**< Accessibility message */ TidyAccess, /**< Accessibility message */
@ -265,22 +271,6 @@ typedef enum
TidyFatal /**< Crash! */ TidyFatal /**< Crash! */
} TidyReportLevel; } TidyReportLevel;
/** Message severity level - string lookup keys
* These TidyReportLevelKeys are used throughout libtidy, and
* have associated localized strings to describe them. They
* correspond to enum `TidyReportLevel`.
*/
typedef enum
{
TidyInfoString = 600,
TidyWarningString,
TidyConfigString,
TidyAccessString,
TidyErrorString,
TidyBadDocumentString,
TidyFatalString
} TidyReportLevelKeys;
/* Document tree traversal functions /* Document tree traversal functions
*/ */
@ -813,6 +803,495 @@ typedef enum
N_TIDY_ATTRIBS /**< Must be last */ N_TIDY_ATTRIBS /**< Must be last */
} TidyAttrId; } TidyAttrId;
/*********************************************************************
* 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[]`
* are generated dynamically with preprocessor macros defined below,
* or in respective modules (e.g., `access.h`).
*
* 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) \
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) \
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) \
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) \
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 */
#define FOREACH_MSG_MISC(FN) \
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)
FOREACH_MSG_MISC(MAKE_ENUM)
#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.
*********************************************************************/
typedef enum
{
/* This MUST be present and first. */
tidyMessagesMisc_first = tidyMessageCodes_last,
ACCESS_URL, /* Used to point to Web Accessibility Guidelines. */
ATRC_ACCESS_URL, /* Points to Tidy's accessibility page. */
FILE_CANT_OPEN, /* For retrieving a string when a file can't be opened. */
LINE_COLUMN_STRING, /* For retrieving localized `line %d column %d` text. */
STRING_DISCARDING, /* For `discarding`. */
STRING_ERROR_COUNT, /* `%u %s, %u %s were found!`. */
STRING_ERROR_COUNT_ERROR, /* `error` and `errors`. */
STRING_ERROR_COUNT_WARNING, /* `warning` and `warnings`. */
STRING_HELLO_ACCESS, /* Accessibility hello message. */
STRING_NO_ERRORS, /* `No warnings or errors were found.\n\n`. */
STRING_NOT_ALL_SHOWN, /* ` Not all warnings/errors were shown.\n\n`. */
STRING_PLAIN_TEXT, /* For retrieving a string `plain text`. */
STRING_REPLACING, /* For `replacing`. */
STRING_SPECIFIED, /* For `specified`. */
STRING_XML_DECLARATION, /* For retrieving a string `XML declaration`. */
TEXT_ACCESS_ADVICE1, /* Explanatory text. */
TEXT_ACCESS_ADVICE2, /* Explanatory text. */
TEXT_BAD_FORM, /* Explanatory text. */
TEXT_BAD_MAIN, /* Explanatory text. */
TEXT_GENERAL_INFO, /* Explanatory text. */
TEXT_GENERAL_INFO_PLEA, /* Explanatory text. */
TEXT_HTML_T_ALGORITHM, /* Paragraph for describing the HTML table algorithm. */
TEXT_INVALID_URI, /* Explanatory text. */
TEXT_INVALID_UTF16, /* Explanatory text. */
TEXT_INVALID_UTF8, /* Explanatory text. */
TEXT_M_IMAGE_ALT, /* Explanatory text. */
TEXT_M_IMAGE_MAP, /* Explanatory text. */
TEXT_M_LINK_ALT, /* Explanatory text. */
TEXT_M_SUMMARY, /* Explanatory text. */
TEXT_NEEDS_INTERVENTION, /* Explanatory text. */
TEXT_SGML_CHARS, /* Explanatory text. */
TEXT_USING_BODY, /* Explanatory text. */
TEXT_USING_FONT, /* Explanatory text. */
TEXT_USING_FRAMES, /* Explanatory text. */
TEXT_USING_LAYER, /* Explanatory text. */
TEXT_USING_NOBR, /* Explanatory text. */
TEXT_USING_SPACER, /* Explanatory text. */
TEXT_VENDOR_CHARS, /* Explanatory text. */
TEXT_WINDOWS_CHARS, /* Explanatory text. */
/* 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.
*********************************************************************/
typedef enum
{
/* This MUST be present and first. */
tidyConsoleMessages_first = tidyMessagesMisc_last,
TC_LABEL_COL,
TC_LABEL_FILE,
TC_LABEL_LANG,
TC_LABEL_LEVL,
TC_LABEL_OPT,
TC_MAIN_ERROR_LOAD_CONFIG,
TC_OPT_ACCESS,
TC_OPT_ASCII,
TC_OPT_ASHTML,
TC_OPT_ASXML,
TC_OPT_BARE,
TC_OPT_BIG5,
TC_OPT_CLEAN,
TC_OPT_CONFIG,
TC_OPT_ERRORS,
TC_OPT_FILE,
TC_OPT_GDOC,
TC_OPT_HELP,
TC_OPT_HELPCFG,
TC_OPT_HELPOPT,
TC_OPT_IBM858,
TC_OPT_INDENT,
TC_OPT_ISO2022,
TC_OPT_LANGUAGE,
TC_OPT_LATIN0,
TC_OPT_LATIN1,
TC_OPT_MAC,
TC_OPT_MODIFY,
TC_OPT_NUMERIC,
TC_OPT_OMIT,
TC_OPT_OUTPUT,
TC_OPT_QUIET,
TC_OPT_RAW,
TC_OPT_SHIFTJIS,
TC_OPT_SHOWCFG,
TC_OPT_UPPER,
TC_OPT_UTF16,
TC_OPT_UTF16BE,
TC_OPT_UTF16LE,
TC_OPT_UTF8,
TC_OPT_VERSION,
TC_OPT_WIN1252,
TC_OPT_WRAP,
TC_OPT_XML,
TC_OPT_XMLCFG,
TC_OPT_XMLSTRG,
TC_OPT_XMLERRS,
TC_OPT_XMLOPTS,
TC_OPT_XMLHELP,
TC_STRING_CONF_HEADER,
TC_STRING_CONF_NAME,
TC_STRING_CONF_TYPE,
TC_STRING_CONF_VALUE,
TC_STRING_CONF_NOTE,
TC_STRING_OPT_NOT_DOCUMENTED,
TC_STRING_OUT_OF_MEMORY,
TC_STRING_FATAL_ERROR,
TC_STRING_FILE_MANIP,
TC_STRING_LANG_MUST_SPECIFY,
TC_STRING_LANG_NOT_FOUND,
TC_STRING_MUST_SPECIFY,
TC_STRING_PROCESS_DIRECTIVES,
TC_STRING_CHAR_ENCODING,
TC_STRING_MISC,
TC_STRING_XML,
TC_STRING_UNKNOWN_OPTION,
TC_STRING_UNKNOWN_OPTION_B,
TC_STRING_VERS_A,
TC_STRING_VERS_B,
TC_TXT_HELP_1,
TC_TXT_HELP_2A,
TC_TXT_HELP_2B,
TC_TXT_HELP_3,
TC_TXT_HELP_CONFIG,
TC_TXT_HELP_CONFIG_NAME,
TC_TXT_HELP_CONFIG_TYPE,
TC_TXT_HELP_CONFIG_ALLW,
TC_TXT_HELP_LANG_1,
TC_TXT_HELP_LANG_2,
TC_TXT_HELP_LANG_3,
/* This MUST be present and last. */
tidyConsoleMessages_last
} tidyConsoleMessages;
#endif /* SUPPORT_CONSOLE_APP */
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View file

@ -70,6 +70,11 @@ extern "C" {
#define SUPPORT_LOCALIZATIONS 1 #define SUPPORT_LOCALIZATIONS 1
#endif #endif
/* Enable/disable support for console */
#ifndef SUPPORT_CONSOLE_APP
#define SUPPORT_CONSOLE_APP 1
#endif
/* Convenience defines for Mac platforms */ /* Convenience defines for Mac platforms */

View file

@ -21,7 +21,7 @@
* `poconvert.rb msgunfmt language_<%= po_content.language %>.h` (our own * `poconvert.rb msgunfmt language_<%= po_content.language %>.h` (our own
* conversion tool) to generate a fresh PO from this file first! * conversion tool) to generate a fresh PO from this file first!
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Template Created by Jim Derry on 01/14/2016. * Template Created by Jim Derry on 01/14/2016.
@ -35,10 +35,6 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm

View file

@ -30,7 +30,7 @@ module PoConvertModule
########################################################### ###########################################################
@@default_en = File.expand_path(File.join('..', 'src', 'language_en.h' )) @@default_en = File.expand_path(File.join('..', 'src', 'language_en.h' ))
@@header_template = File.expand_path(File.join('.', 'language_ll_cc.h.erb')) @@header_template = File.expand_path(File.join('.', 'language_ll_cc.h.erb'))
@@header_digest = 'b597e5948de1611ab6cde11934df6fc792c7ec4d21f3cd2030fb2e9bcfb94991' @@header_digest = '9e5c3bf0b02c20e6fe2068a8edc09de1bb091a14144b211f4c36b0f9d1ec5f97'
########################################################### ###########################################################
@ -1177,8 +1177,9 @@ Complete Help:
error_count = 0 error_count = 0
fuzzy_list = nil fuzzy_list = nil
if options[:sha]
pwd = File.expand_path( File.join(Dir.getwd, '..') ) pwd = File.expand_path( File.join(Dir.getwd, '..') )
if options[:sha]
sha = options[:sha] sha = options[:sha]
temp_file = "~#{sha}.h" temp_file = "~#{sha}.h"
project = Git.open(pwd) project = Git.open(pwd)

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n" "X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n" "Project-Id-Version: \n"
"PO-Revision-Date: 2016-03-24 10:59:55\n" "PO-Revision-Date: 2017-02-17 14:46:38\n"
"Last-Translator: jderry\n" "Last-Translator: jderry\n"
"Language-Team: \n" "Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found. #. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL" msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL" msgid "http://www.w3.org/WAI/GL"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified" msgid "specified"
msgstr "" msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format #, c-format
msgctxt "STRING_UNKNOWN_OPTION" msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s" msgid "unknown option: %s"
msgstr "" msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION" msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration" msgid "XML declaration"
msgstr "" msgstr ""
@ -381,31 +372,31 @@ msgstr ""
"helping us to localise HTML Tidy. For details please see \n" "helping us to localise HTML Tidy. For details please see \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
msgctxt "TidyInfoString" msgctxt "TidyInfo"
msgid "Info: " msgid "Info: "
msgstr "" msgstr ""
msgctxt "TidyWarningString" msgctxt "TidyWarning"
msgid "Warning: " msgid "Warning: "
msgstr "" msgstr ""
msgctxt "TidyConfigString" msgctxt "TidyConfig"
msgid "Config: " msgid "Config: "
msgstr "" msgstr ""
msgctxt "TidyAccessString" msgctxt "TidyAccess"
msgid "Access: " msgid "Access: "
msgstr "" msgstr ""
msgctxt "TidyErrorString" msgctxt "TidyError"
msgid "Error: " msgid "Error: "
msgstr "" msgstr ""
msgctxt "TidyBadDocumentString" msgctxt "TidyBadDocument"
msgid "Document: " msgid "Document: "
msgstr "" msgstr ""
msgctxt "TidyFatalString" msgctxt "TidyFatal"
msgid "Panic: " msgid "Panic: "
msgstr "" msgstr ""
@ -439,6 +430,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s" msgid "%s invalid numeric character reference %s"
msgstr "" msgstr ""
msgctxt "BAD_SURROGATE_PAIR"
msgid "Have out-of-range surrogate pair U+%04X:U+%04X, replaced with U+FFFD value."
msgstr ""
msgctxt "BAD_SURROGATE_TAIL"
msgid "Leading (High) surrogate pair U+%04X, with no trailing (Low) entity, replaced with U+FFFD."
msgstr ""
msgctxt "BAD_SURROGATE_LEAD"
msgid "Trailing (Low) surrogate pair U+%04X, with no leading (High) entity, replaced with U+FFFD."
msgstr ""
#, c-format #, c-format
msgctxt "MISSING_SEMICOLON" msgctxt "MISSING_SEMICOLON"
msgid "entity \"%s\" doesn't end in ';'" msgid "entity \"%s\" doesn't end in ';'"
@ -3027,23 +3030,23 @@ msgid ""
"to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this." "to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this."
msgstr "" msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS" msgctxt "TidyDiagnostics"
msgid "diagnostics" msgid "diagnostics"
msgstr "" msgstr ""
msgctxt "TC_CAT_ENCODING" msgctxt "TidyEncoding"
msgid "encoding" msgid "encoding"
msgstr "" msgstr ""
msgctxt "TC_CAT_MARKUP" msgctxt "TidyMarkup"
msgid "markup" msgid "markup"
msgstr "" msgstr ""
msgctxt "TC_CAT_MISC" msgctxt "TidyMiscellaneous"
msgid "misc" msgid "misc"
msgstr "" msgstr ""
msgctxt "TC_CAT_PRETTYPRINT" msgctxt "TidyPrettyPrint"
msgid "print" msgid "print"
msgstr "" msgstr ""

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n" "X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n" "Project-Id-Version: \n"
"PO-Revision-Date: 2016-03-24 10:59:55\n" "PO-Revision-Date: 2017-02-17 14:46:38\n"
"Last-Translator: jderry\n" "Last-Translator: jderry\n"
"Language-Team: \n" "Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found. #. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL" msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL" msgid "http://www.w3.org/WAI/GL"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified" msgid "specified"
msgstr "" msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format #, c-format
msgctxt "STRING_UNKNOWN_OPTION" msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s" msgid "unknown option: %s"
msgstr "" msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION" msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration" msgid "XML declaration"
msgstr "" msgstr ""
@ -377,31 +368,31 @@ msgstr ""
"ayudarnos a localizar HTML Tidy. Para más detalles consulte \n" "ayudarnos a localizar HTML Tidy. Para más detalles consulte \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n"
msgctxt "TidyInfoString" msgctxt "TidyInfo"
msgid "Info: " msgid "Info: "
msgstr "" msgstr ""
msgctxt "TidyWarningString" msgctxt "TidyWarning"
msgid "Warning: " msgid "Warning: "
msgstr "" msgstr ""
msgctxt "TidyConfigString" msgctxt "TidyConfig"
msgid "Config: " msgid "Config: "
msgstr "" msgstr ""
msgctxt "TidyAccessString" msgctxt "TidyAccess"
msgid "Access: " msgid "Access: "
msgstr "" msgstr ""
msgctxt "TidyErrorString" msgctxt "TidyError"
msgid "Error: " msgid "Error: "
msgstr "" msgstr ""
msgctxt "TidyBadDocumentString" msgctxt "TidyBadDocument"
msgid "Document: " msgid "Document: "
msgstr "" msgstr ""
msgctxt "TidyFatalString" msgctxt "TidyFatal"
msgid "Panic: " msgid "Panic: "
msgstr "" msgstr ""
@ -435,6 +426,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s" msgid "%s invalid numeric character reference %s"
msgstr "" msgstr ""
msgctxt "BAD_SURROGATE_PAIR"
msgid "Have out-of-range surrogate pair U+%04X:U+%04X, replaced with U+FFFD value."
msgstr ""
msgctxt "BAD_SURROGATE_TAIL"
msgid "Leading (High) surrogate pair U+%04X, with no trailing (Low) entity, replaced with U+FFFD."
msgstr ""
msgctxt "BAD_SURROGATE_LEAD"
msgid "Trailing (Low) surrogate pair U+%04X, with no leading (High) entity, replaced with U+FFFD."
msgstr ""
#, c-format #, c-format
msgctxt "MISSING_SEMICOLON" msgctxt "MISSING_SEMICOLON"
msgid "entity \"%s\" doesn't end in ';'" msgid "entity \"%s\" doesn't end in ';'"
@ -3004,23 +3007,23 @@ msgid ""
"to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this." "to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this."
msgstr "" msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS" msgctxt "TidyDiagnostics"
msgid "diagnostics" msgid "diagnostics"
msgstr "" msgstr ""
msgctxt "TC_CAT_ENCODING" msgctxt "TidyEncoding"
msgid "encoding" msgid "encoding"
msgstr "" msgstr ""
msgctxt "TC_CAT_MARKUP" msgctxt "TidyMarkup"
msgid "markup" msgid "markup"
msgstr "" msgstr ""
msgctxt "TC_CAT_MISC" msgctxt "TidyMiscellaneous"
msgid "misc" msgid "misc"
msgstr "" msgstr ""
msgctxt "TC_CAT_PRETTYPRINT" msgctxt "TidyPrettyPrint"
msgid "print" msgid "print"
msgstr "" msgstr ""

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n" "X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n" "Project-Id-Version: \n"
"PO-Revision-Date: 2016-03-24 10:59:55\n" "PO-Revision-Date: 2017-02-17 14:46:38\n"
"Last-Translator: jderry\n" "Last-Translator: jderry\n"
"Language-Team: \n" "Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found. #. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL" msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL" msgid "http://www.w3.org/WAI/GL"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified" msgid "specified"
msgstr "" msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format #, c-format
msgctxt "STRING_UNKNOWN_OPTION" msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s" msgid "unknown option: %s"
msgstr "" msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION" msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration" msgid "XML declaration"
msgstr "" msgstr ""
@ -377,31 +368,31 @@ msgstr ""
"ayudarnos a localizar HTML Tidy. Para más detalles consulte \n" "ayudarnos a localizar HTML Tidy. Para más detalles consulte \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n"
msgctxt "TidyInfoString" msgctxt "TidyInfo"
msgid "Info: " msgid "Info: "
msgstr "" msgstr ""
msgctxt "TidyWarningString" msgctxt "TidyWarning"
msgid "Warning: " msgid "Warning: "
msgstr "" msgstr ""
msgctxt "TidyConfigString" msgctxt "TidyConfig"
msgid "Config: " msgid "Config: "
msgstr "" msgstr ""
msgctxt "TidyAccessString" msgctxt "TidyAccess"
msgid "Access: " msgid "Access: "
msgstr "" msgstr ""
msgctxt "TidyErrorString" msgctxt "TidyError"
msgid "Error: " msgid "Error: "
msgstr "" msgstr ""
msgctxt "TidyBadDocumentString" msgctxt "TidyBadDocument"
msgid "Document: " msgid "Document: "
msgstr "" msgstr ""
msgctxt "TidyFatalString" msgctxt "TidyFatal"
msgid "Panic: " msgid "Panic: "
msgstr "" msgstr ""
@ -435,6 +426,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s" msgid "%s invalid numeric character reference %s"
msgstr "" msgstr ""
msgctxt "BAD_SURROGATE_PAIR"
msgid "Have out-of-range surrogate pair U+%04X:U+%04X, replaced with U+FFFD value."
msgstr ""
msgctxt "BAD_SURROGATE_TAIL"
msgid "Leading (High) surrogate pair U+%04X, with no trailing (Low) entity, replaced with U+FFFD."
msgstr ""
msgctxt "BAD_SURROGATE_LEAD"
msgid "Trailing (Low) surrogate pair U+%04X, with no leading (High) entity, replaced with U+FFFD."
msgstr ""
#, c-format #, c-format
msgctxt "MISSING_SEMICOLON" msgctxt "MISSING_SEMICOLON"
msgid "entity \"%s\" doesn't end in ';'" msgid "entity \"%s\" doesn't end in ';'"
@ -2999,23 +3002,23 @@ msgid ""
"to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this." "to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this."
msgstr "" msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS" msgctxt "TidyDiagnostics"
msgid "diagnostics" msgid "diagnostics"
msgstr "" msgstr ""
msgctxt "TC_CAT_ENCODING" msgctxt "TidyEncoding"
msgid "encoding" msgid "encoding"
msgstr "" msgstr ""
msgctxt "TC_CAT_MARKUP" msgctxt "TidyMarkup"
msgid "markup" msgid "markup"
msgstr "" msgstr ""
msgctxt "TC_CAT_MISC" msgctxt "TidyMiscellaneous"
msgid "misc" msgid "misc"
msgstr "" msgstr ""
msgctxt "TC_CAT_PRETTYPRINT" msgctxt "TidyPrettyPrint"
msgid "print" msgid "print"
msgstr "" msgstr ""

File diff suppressed because it is too large Load diff

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: HTML Tidy poconvert.rb\n" "X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n" "Project-Id-Version: \n"
"PO-Revision-Date: 2016-03-24 10:59:55\n" "PO-Revision-Date: 2017-02-17 14:46:38\n"
"Last-Translator: jderry\n" "Last-Translator: jderry\n"
"Language-Team: \n" "Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found. #. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL" msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL" msgid "http://www.w3.org/WAI/GL"
@ -100,20 +100,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified" msgid "specified"
msgstr "" msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format #, c-format
msgctxt "STRING_UNKNOWN_OPTION" msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s" msgid "unknown option: %s"
msgstr "" msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION" msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration" msgid "XML declaration"
msgstr "" msgstr ""
@ -371,31 +362,31 @@ msgid ""
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
msgstr "" msgstr ""
msgctxt "TidyInfoString" msgctxt "TidyInfo"
msgid "Info: " msgid "Info: "
msgstr "" msgstr ""
msgctxt "TidyWarningString" msgctxt "TidyWarning"
msgid "Warning: " msgid "Warning: "
msgstr "" msgstr ""
msgctxt "TidyConfigString" msgctxt "TidyConfig"
msgid "Config: " msgid "Config: "
msgstr "" msgstr ""
msgctxt "TidyAccessString" msgctxt "TidyAccess"
msgid "Access: " msgid "Access: "
msgstr "" msgstr ""
msgctxt "TidyErrorString" msgctxt "TidyError"
msgid "Error: " msgid "Error: "
msgstr "" msgstr ""
msgctxt "TidyBadDocumentString" msgctxt "TidyBadDocument"
msgid "Document: " msgid "Document: "
msgstr "" msgstr ""
msgctxt "TidyFatalString" msgctxt "TidyFatal"
msgid "Panic: " msgid "Panic: "
msgstr "" msgstr ""
@ -429,6 +420,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s" msgid "%s invalid numeric character reference %s"
msgstr "" msgstr ""
msgctxt "BAD_SURROGATE_PAIR"
msgid "Have out-of-range surrogate pair U+%04X:U+%04X, replaced with U+FFFD value."
msgstr ""
msgctxt "BAD_SURROGATE_TAIL"
msgid "Leading (High) surrogate pair U+%04X, with no trailing (Low) entity, replaced with U+FFFD."
msgstr ""
msgctxt "BAD_SURROGATE_LEAD"
msgid "Trailing (Low) surrogate pair U+%04X, with no leading (High) entity, replaced with U+FFFD."
msgstr ""
#, c-format #, c-format
msgctxt "MISSING_SEMICOLON" msgctxt "MISSING_SEMICOLON"
msgid "entity \"%s\" doesn't end in ';'" msgid "entity \"%s\" doesn't end in ';'"
@ -2993,23 +2996,23 @@ msgid ""
"to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this." "to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this."
msgstr "" msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS" msgctxt "TidyDiagnostics"
msgid "diagnostics" msgid "diagnostics"
msgstr "" msgstr ""
msgctxt "TC_CAT_ENCODING" msgctxt "TidyEncoding"
msgid "encoding" msgid "encoding"
msgstr "" msgstr ""
msgctxt "TC_CAT_MARKUP" msgctxt "TidyMarkup"
msgid "markup" msgid "markup"
msgstr "" msgstr ""
msgctxt "TC_CAT_MISC" msgctxt "TidyMiscellaneous"
msgid "misc" msgid "misc"
msgstr "" msgstr ""
msgctxt "TC_CAT_PRETTYPRINT" msgctxt "TidyPrettyPrint"
msgid "print" msgid "print"
msgstr "" msgstr ""

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\n" "X-Generator: HTML Tidy poconvert.rb\n"
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2016-03-24 11:36:17\n" "POT-Creation-Date: 2017-02-17 14:46:38\n"
"Last-Translator: jderry\n" "Last-Translator: jderry\n"
"Language-Team: \n" "Language-Team: \n"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified" msgid "specified"
msgstr "" msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format #, c-format
msgctxt "STRING_UNKNOWN_OPTION" msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s" msgid "unknown option: %s"
msgstr "" msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION" msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration" msgid "XML declaration"
msgstr "" msgstr ""
@ -373,31 +364,31 @@ msgid ""
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
msgstr "" msgstr ""
msgctxt "TidyInfoString" msgctxt "TidyInfo"
msgid "Info: " msgid "Info: "
msgstr "" msgstr ""
msgctxt "TidyWarningString" msgctxt "TidyWarning"
msgid "Warning: " msgid "Warning: "
msgstr "" msgstr ""
msgctxt "TidyConfigString" msgctxt "TidyConfig"
msgid "Config: " msgid "Config: "
msgstr "" msgstr ""
msgctxt "TidyAccessString" msgctxt "TidyAccess"
msgid "Access: " msgid "Access: "
msgstr "" msgstr ""
msgctxt "TidyErrorString" msgctxt "TidyError"
msgid "Error: " msgid "Error: "
msgstr "" msgstr ""
msgctxt "TidyBadDocumentString" msgctxt "TidyBadDocument"
msgid "Document: " msgid "Document: "
msgstr "" msgstr ""
msgctxt "TidyFatalString" msgctxt "TidyFatal"
msgid "Panic: " msgid "Panic: "
msgstr "" msgstr ""
@ -431,6 +422,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s" msgid "%s invalid numeric character reference %s"
msgstr "" msgstr ""
msgctxt "BAD_SURROGATE_PAIR"
msgid "Have out-of-range surrogate pair U+%04X:U+%04X, replaced with U+FFFD value."
msgstr ""
msgctxt "BAD_SURROGATE_TAIL"
msgid "Leading (High) surrogate pair U+%04X, with no trailing (Low) entity, replaced with U+FFFD."
msgstr ""
msgctxt "BAD_SURROGATE_LEAD"
msgid "Trailing (Low) surrogate pair U+%04X, with no leading (High) entity, replaced with U+FFFD."
msgstr ""
#, c-format #, c-format
msgctxt "MISSING_SEMICOLON" msgctxt "MISSING_SEMICOLON"
msgid "entity \"%s\" doesn't end in ';'" msgid "entity \"%s\" doesn't end in ';'"
@ -2995,23 +2998,23 @@ msgid ""
"to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this." "to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this."
msgstr "" msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS" msgctxt "TidyDiagnostics"
msgid "diagnostics" msgid "diagnostics"
msgstr "" msgstr ""
msgctxt "TC_CAT_ENCODING" msgctxt "TidyEncoding"
msgid "encoding" msgid "encoding"
msgstr "" msgstr ""
msgctxt "TC_CAT_MARKUP" msgctxt "TidyMarkup"
msgid "markup" msgid "markup"
msgstr "" msgstr ""
msgctxt "TC_CAT_MISC" msgctxt "TidyMiscellaneous"
msgid "misc" msgid "misc"
msgstr "" msgstr ""
msgctxt "TC_CAT_PRETTYPRINT" msgctxt "TidyPrettyPrint"
msgid "print" msgid "print"
msgstr "" msgstr ""

View file

@ -6,28 +6,6 @@
*/ */
/*********************************************************************
* AccessibilityChecks
*
* Carries out processes for all accessibility checks. Traverses
* through all the content within the tree and evaluates the tags for
* accessibility.
*
* To perform the following checks, 'AccessibilityChecks' must be
* called AFTER the tree structure has been formed.
*
* If, in the command prompt, there is no specification of which
* accessibility priorities to check, no accessibility checks will be
* performed. (ie. '1' for priority 1, '2' for priorities 1 and 2,
* and '3') for priorities 1, 2 and 3.)
*
* Copyright University of Toronto
* Programmed by: Mike Lam and Chris Ridpath
* Modifications by : Terry Teague (TRT)
*
* Reference document: http://www.w3.org/TR/WAI-WEBCONTENT/
*********************************************************************/
#include "tidy-int.h" #include "tidy-int.h"

View file

@ -1,56 +1,44 @@
#ifndef __ACCESS_H__ #ifndef __ACCESS_H__
#define __ACCESS_H__ #define __ACCESS_H__
/* access.h -- carry out accessibility checks
Copyright University of Toronto
Portions (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
/********************************************************************* /*********************************************************************
* AccessibilityChecks * carry out accessibility checks
* *
* Carries out processes for all accessibility checks. Traverses * This module is an add-on to HTML Tidy and is enabled or disabled via
* through all the content within the tree and evaluates the tags for * the SUPPORT_ACCESSIBILITY_CHECKS macro, which is defined by default
* accessibility. * in `tidyplatform.h`. Search this code for this macro to determine
* * other locations supporting code exists.
* To perform the following checks, 'AccessibilityChecks' must be *
* called AFTER the tree structure has been formed. * This module carries out processes for all accessibility checks. It
* * traverses through all the content within the tree and evaluates the
* If, in the command prompt, there is no specification of which * tags for accessibility.
* accessibility priorities to check, no accessibility checks will be *
* performed. (ie. '1' for priority 1, '2' for priorities 1 and 2, * To perform the following checks, 'AccessibilityChecks' must be
* and '3') for priorities 1, 2 and 3.) * called AFTER the tree structure has been formed.
* *
* Copyright University of Toronto * If, in the command prompt or configuration file, there is no
* Programmed by: Mike Lam and Chris Ridpath * specification of which accessibility priorities to check, then no
* Modifications by : Terry Teague (TRT) * accessibility checks will be performed.
* *
*********************************************************************/ * The accessibility checks to perform depending on user's desire:
* 1. priority 1
* 2. priority 1 & 2
* 3. priority 1, 2, & 3
*
* Reference document: http://www.w3.org/TR/WAI-WEBCONTENT/
*
* Copyright University of Toronto
* Portions (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
* See `tidy.h` for the copyright notice.
* Programmed by: Mike Lam and Chris Ridpath
* Modifications by: Terry Teague (TRT)
* Further modifications: consult git log.
*********************************************************************/
#include "forward.h" #include "forward.h"
#include "message.h"
#if SUPPORT_ACCESSIBILITY_CHECKS #if SUPPORT_ACCESSIBILITY_CHECKS
/* The accessibility checks to perform depending on user's desire.
1. priority 1
2. priority 1 & 2
3. priority 1, 2, & 3
*/
/* Determines if the client-side text link is found within the document
typedef struct AreaLinks
{
struct AreaLinks* next;
char* link;
Bool HasBeenFound;
} AreaLinks;
*/
enum { enum {
TEXTBUF_SIZE=128u TEXTBUF_SIZE=128u
@ -62,7 +50,7 @@ typedef struct _TidyAccessImpl TidyAccessImpl;
struct _TidyAccessImpl struct _TidyAccessImpl
{ {
/* gets set from Tidy variable AccessibilityCheckLevel */ /* gets set from Tidy variable AccessibilityCheckLevel */
int PRIORITYCHK; int PRIORITYCHK; /**< */
/* Number of characters that are found within the concatenated text */ /* Number of characters that are found within the concatenated text */
int counter; int counter;
@ -100,180 +88,11 @@ struct _TidyAccessImpl
Bool HasInvalidColumnHeader; Bool HasInvalidColumnHeader;
int ForID; int ForID;
/* List containing map-links
AreaLinks* links;
AreaLinks* start;
AreaLinks* current;
*/
}; };
/* void TY_(AccessibilityHelloMessage)( TidyDocImpl* doc ); /* impl. message.c */
Determines which error/warning message should be displayed, void TY_(DisplayHTMLTableAlgorithm)( TidyDocImpl* doc ); /* impl. message.c */
depending on the error code that was called.
Offset accessibility error codes by FIRST_ACCESS_ERR to avoid conflict with
other error codes defined in message.h and used in localize.c.
These accessErrorCodes are used throughout libtidy, and also
have associated localized strings to describe them.
IMPORTANT: to maintain compatability with TidyMessageFilter3, if you add
or remove keys from this enum, ALSO add/remove the corresponding key
in language.c:tidyErrorFilterKeysStruct[]!
*/
typedef enum
{
FIRST_ACCESS_ERR = CODES_TIDY_ERROR_LAST + 1, /* must be first */
/* [1.1.1.1] */ IMG_MISSING_ALT,
/* [1.1.1.2] */ IMG_ALT_SUSPICIOUS_FILENAME,
/* [1.1.1.3] */ IMG_ALT_SUSPICIOUS_FILE_SIZE,
/* [1.1.1.4] */ IMG_ALT_SUSPICIOUS_PLACEHOLDER,
/* [1.1.1.10] */ IMG_ALT_SUSPICIOUS_TOO_LONG,
/* [1.1.1.11] */ IMG_MISSING_ALT_BULLET,
/* [1.1.1.12] */ IMG_MISSING_ALT_H_RULE,
/* [1.1.2.1] */ IMG_MISSING_LONGDESC_DLINK,
/* [1.1.2.2] */ IMG_MISSING_DLINK,
/* [1.1.2.3] */ IMG_MISSING_LONGDESC,
/* [1.1.2.5] */ LONGDESC_NOT_REQUIRED,
/* [1.1.3.1] */ IMG_BUTTON_MISSING_ALT,
/* [1.1.4.1] */ APPLET_MISSING_ALT,
/* [1.1.5.1] */ OBJECT_MISSING_ALT,
/* [1.1.6.1] */ AUDIO_MISSING_TEXT_WAV,
/* [1.1.6.2] */ AUDIO_MISSING_TEXT_AU,
/* [1.1.6.3] */ AUDIO_MISSING_TEXT_AIFF,
/* [1.1.6.4] */ AUDIO_MISSING_TEXT_SND,
/* [1.1.6.5] */ AUDIO_MISSING_TEXT_RA,
/* [1.1.6.6] */ AUDIO_MISSING_TEXT_RM,
/* [1.1.8.1] */ FRAME_MISSING_LONGDESC,
/* [1.1.9.1] */ AREA_MISSING_ALT,
/* [1.1.10.1] */ SCRIPT_MISSING_NOSCRIPT,
/* [1.1.12.1] */ ASCII_REQUIRES_DESCRIPTION,
/* [1.2.1.1] */ IMG_MAP_SERVER_REQUIRES_TEXT_LINKS,
/* [1.4.1.1] */ MULTIMEDIA_REQUIRES_TEXT,
/* [1.5.1.1] */ IMG_MAP_CLIENT_MISSING_TEXT_LINKS,
/* [2.1.1.1] */ INFORMATION_NOT_CONVEYED_IMAGE,
/* [2.1.1.2] */ INFORMATION_NOT_CONVEYED_APPLET,
/* [2.1.1.3] */ INFORMATION_NOT_CONVEYED_OBJECT,
/* [2.1.1.4] */ INFORMATION_NOT_CONVEYED_SCRIPT,
/* [2.1.1.5] */ INFORMATION_NOT_CONVEYED_INPUT,
/* [2.2.1.1] */ COLOR_CONTRAST_TEXT,
/* [2.2.1.2] */ COLOR_CONTRAST_LINK,
/* [2.2.1.3] */ COLOR_CONTRAST_ACTIVE_LINK,
/* [2.2.1.4] */ COLOR_CONTRAST_VISITED_LINK,
/* [3.2.1.1] */ DOCTYPE_MISSING,
/* [3.3.1.1] */ STYLE_SHEET_CONTROL_PRESENTATION,
/* [3.5.1.1] */ HEADERS_IMPROPERLY_NESTED,
/* [3.5.2.1] */ POTENTIAL_HEADER_BOLD,
/* [3.5.2.2] */ POTENTIAL_HEADER_ITALICS,
/* [3.5.2.3] */ POTENTIAL_HEADER_UNDERLINE,
/* [3.5.3.1] */ HEADER_USED_FORMAT_TEXT,
/* [3.6.1.1] */ LIST_USAGE_INVALID_UL,
/* [3.6.1.2] */ LIST_USAGE_INVALID_OL,
/* [3.6.1.4] */ LIST_USAGE_INVALID_LI,
/* [4.1.1.1] */ INDICATE_CHANGES_IN_LANGUAGE,
/* [4.3.1.1] */ LANGUAGE_NOT_IDENTIFIED,
/* [4.3.1.1] */ LANGUAGE_INVALID,
/* [5.1.2.1] */ DATA_TABLE_MISSING_HEADERS,
/* [5.1.2.2] */ DATA_TABLE_MISSING_HEADERS_COLUMN,
/* [5.1.2.3] */ DATA_TABLE_MISSING_HEADERS_ROW,
/* [5.2.1.1] */ DATA_TABLE_REQUIRE_MARKUP_COLUMN_HEADERS,
/* [5.2.1.2] */ DATA_TABLE_REQUIRE_MARKUP_ROW_HEADERS,
/* [5.3.1.1] */ LAYOUT_TABLES_LINEARIZE_PROPERLY,
/* [5.4.1.1] */ LAYOUT_TABLE_INVALID_MARKUP,
/* [5.5.1.1] */ TABLE_MISSING_SUMMARY,
/* [5.5.1.2] */ TABLE_SUMMARY_INVALID_NULL,
/* [5.5.1.3] */ TABLE_SUMMARY_INVALID_SPACES,
/* [5.5.1.6] */ TABLE_SUMMARY_INVALID_PLACEHOLDER,
/* [5.5.2.1] */ TABLE_MISSING_CAPTION,
/* [5.6.1.1] */ TABLE_MAY_REQUIRE_HEADER_ABBR,
/* [5.6.1.2] */ TABLE_MAY_REQUIRE_HEADER_ABBR_NULL,
/* [5.6.1.3] */ TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES,
/* [6.1.1.1] */ STYLESHEETS_REQUIRE_TESTING_LINK,
/* [6.1.1.2] */ STYLESHEETS_REQUIRE_TESTING_STYLE_ELEMENT,
/* [6.1.1.3] */ STYLESHEETS_REQUIRE_TESTING_STYLE_ATTR,
/* [6.2.1.1] */ FRAME_SRC_INVALID,
/* [6.2.2.1] */ TEXT_EQUIVALENTS_REQUIRE_UPDATING_APPLET,
/* [6.2.2.2] */ TEXT_EQUIVALENTS_REQUIRE_UPDATING_SCRIPT,
/* [6.2.2.3] */ TEXT_EQUIVALENTS_REQUIRE_UPDATING_OBJECT,
/* [6.3.1.1] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_SCRIPT,
/* [6.3.1.2] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_OBJECT,
/* [6.3.1.3] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_EMBED,
/* [6.3.1.4] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_APPLET,
/* [6.5.1.1] */ FRAME_MISSING_NOFRAMES,
/* [6.5.1.2] */ NOFRAMES_INVALID_NO_VALUE,
/* [6.5.1.3] */ NOFRAMES_INVALID_CONTENT,
/* [6.5.1.4] */ NOFRAMES_INVALID_LINK,
/* [7.1.1.1] */ REMOVE_FLICKER_SCRIPT,
/* [7.1.1.2] */ REMOVE_FLICKER_OBJECT,
/* [7.1.1.3] */ REMOVE_FLICKER_EMBED,
/* [7.1.1.4] */ REMOVE_FLICKER_APPLET,
/* [7.1.1.5] */ REMOVE_FLICKER_ANIMATED_GIF,
/* [7.2.1.1] */ REMOVE_BLINK_MARQUEE,
/* [7.4.1.1] */ REMOVE_AUTO_REFRESH,
/* [7.5.1.1] */ REMOVE_AUTO_REDIRECT,
/* [8.1.1.1] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_SCRIPT,
/* [8.1.1.2] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_OBJECT,
/* [8.1.1.3] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_APPLET,
/* [8.1.1.4] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_EMBED,
/* [9.1.1.1] */ IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION,
/* [9.3.1.1] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_DOWN,
/* [9.3.1.2] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_UP,
/* [9.3.1.3] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_CLICK,
/* [9.3.1.4] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OVER,
/* [9.3.1.5] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OUT,
/* [9.3.1.6] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_MOVE,
/* [10.1.1.1] */ NEW_WINDOWS_REQUIRE_WARNING_NEW,
/* [10.1.1.2] */ NEW_WINDOWS_REQUIRE_WARNING_BLANK,
/* [10.2.1.1] */ LABEL_NEEDS_REPOSITIONING_BEFORE_INPUT,
/* [10.2.1.2] */ LABEL_NEEDS_REPOSITIONING_AFTER_INPUT,
/* [10.4.1.1] */ FORM_CONTROL_REQUIRES_DEFAULT_TEXT,
/* [10.4.1.2] */ FORM_CONTROL_DEFAULT_TEXT_INVALID_NULL,
/* [10.4.1.3] */ FORM_CONTROL_DEFAULT_TEXT_INVALID_SPACES,
/* [11.2.1.1] */ REPLACE_DEPRECATED_HTML_APPLET,
/* [11.2.1.2] */ REPLACE_DEPRECATED_HTML_BASEFONT,
/* [11.2.1.3] */ REPLACE_DEPRECATED_HTML_CENTER,
/* [11.2.1.4] */ REPLACE_DEPRECATED_HTML_DIR,
/* [11.2.1.5] */ REPLACE_DEPRECATED_HTML_FONT,
/* [11.2.1.6] */ REPLACE_DEPRECATED_HTML_ISINDEX,
/* [11.2.1.7] */ REPLACE_DEPRECATED_HTML_MENU,
/* [11.2.1.8] */ REPLACE_DEPRECATED_HTML_S,
/* [11.2.1.9] */ REPLACE_DEPRECATED_HTML_STRIKE,
/* [11.2.1.10] */ REPLACE_DEPRECATED_HTML_U,
/* [12.1.1.1] */ FRAME_MISSING_TITLE,
/* [12.1.1.2] */ FRAME_TITLE_INVALID_NULL,
/* [12.1.1.3] */ FRAME_TITLE_INVALID_SPACES,
/* [12.4.1.1] */ ASSOCIATE_LABELS_EXPLICITLY,
/* [12.4.1.2] */ ASSOCIATE_LABELS_EXPLICITLY_FOR,
/* [12.4.1.3] */ ASSOCIATE_LABELS_EXPLICITLY_ID,
/* [13.1.1.1] */ LINK_TEXT_NOT_MEANINGFUL,
/* [13.1.1.2] */ LINK_TEXT_MISSING,
/* [13.1.1.3] */ LINK_TEXT_TOO_LONG,
/* [13.1.1.4] */ LINK_TEXT_NOT_MEANINGFUL_CLICK_HERE,
/* [13.1.1.5] */ LINK_TEXT_NOT_MEANINGFUL_MORE,
/* [13.1.1.6] */ LINK_TEXT_NOT_MEANINGFUL_FOLLOW_THIS,
/* [13.2.1.1] */ METADATA_MISSING,
/* [13.2.1.2] */ METADATA_MISSING_LINK,
/* [13.2.1.3] */ METADATA_MISSING_REDIRECT_AUTOREFRESH,
/* [13.10.1.1] */ SKIPOVER_ASCII_ART,
LAST_ACCESS_ERR /* must be last */
} accessErrorCodes;
void TY_(AccessibilityHelloMessage)( TidyDocImpl* doc );
void TY_(DisplayHTMLTableAlgorithm)( TidyDocImpl* doc );
/************************************************************
* AccessibilityChecks
*
* Traverses through the individual nodes of the tree
* and checks attributes and elements for accessibility.
* after the tree structure has been formed.
************************************************************/
void TY_(AccessibilityChecks)( TidyDocImpl* doc ); void TY_(AccessibilityChecks)( TidyDocImpl* doc );

View file

@ -78,7 +78,9 @@ const TidyOptionImpl* TY_(getNextOption)( TidyDocImpl* doc, TidyIterator* iter )
TidyIterator TY_(getOptionPickList)( const TidyOptionImpl* option ); TidyIterator TY_(getOptionPickList)( const TidyOptionImpl* option );
ctmbstr TY_(getNextOptionPick)( const TidyOptionImpl* option, TidyIterator* iter ); ctmbstr TY_(getNextOptionPick)( const TidyOptionImpl* option, TidyIterator* iter );
#if SUPPORT_CONSOLE_APP
const TidyOptionDoc* TY_(OptGetDocDesc)( TidyOptionId optId ); const TidyOptionDoc* TY_(OptGetDocDesc)( TidyOptionId optId );
#endif /* SUPPORT_CONSOLE_APP */
void TY_(InitConfig)( TidyDocImpl* doc ); void TY_(InitConfig)( TidyDocImpl* doc );
void TY_(FreeConfig)( TidyDocImpl* doc ); void TY_(FreeConfig)( TidyDocImpl* doc );

View file

@ -1,15 +1,15 @@
/* /* language.c -- localization support for HTML Tidy.
* language.c
* Localization support for HTML Tidy. Copyright 2015 HTACG
* See tidy.h for the copyright notice.
* (c) 2015 HTACG
* See tidy.h and access.h for the copyright notice.
*
* Created by Jim Derry on 11/28/15.
*/ */
#include "language.h" #include "language.h"
#include "language_en.h" #include "language_en.h"
#include "tmbstr.h"
#include "locale.h"
#if SUPPORT_LOCALIZATIONS #if SUPPORT_LOCALIZATIONS
#include "language_en_gb.h" #include "language_en_gb.h"
#include "language_es.h" #include "language_es.h"
@ -17,8 +17,6 @@
#include "language_zh_cn.h" #include "language_zh_cn.h"
#include "language_fr.h" #include "language_fr.h"
#endif #endif
#include "tmbstr.h"
#include "locale.h"
/** /**
@ -59,7 +57,7 @@ static tidyLanguagesType tidyLanguages = {
* to proper POSIX names (modern Windows already uses * to proper POSIX names (modern Windows already uses
* POSIX names). * POSIX names).
*/ */
static const tidyLocaleMapItem localeMappings[] = { static const tidyLocaleMapItemImpl localeMappings[] = {
{ "america", "en_us" }, { "america", "en_us" },
{ "american english", "en_us" }, { "american english", "en_us" },
{ "american-english", "en_us" }, { "american-english", "en_us" },
@ -225,279 +223,10 @@ static const tidyLocaleMapItem localeMappings[] = {
}; };
/**
* LibTidy users may want to use `TidyReportFilter3` to enable their own
* localization lookup features. Because Tidy's errors codes are enums the
* specific values can change over time. This table will ensure that LibTidy
* users always have a static value available for use.
*/
static const tidyErrorFilterKeyItem tidyErrorFilterKeysStruct[] = {
/* This blocks of codes comes from `tidyErrorCodes` enum. */
{ "CODES_TIDY_ERROR_FIRST", CODES_TIDY_ERROR_FIRST },
{ "MISSING_SEMICOLON", MISSING_SEMICOLON },
{ "MISSING_SEMICOLON_NCR", MISSING_SEMICOLON_NCR },
{ "UNKNOWN_ENTITY", UNKNOWN_ENTITY },
{ "UNESCAPED_AMPERSAND", UNESCAPED_AMPERSAND },
{ "APOS_UNDEFINED", APOS_UNDEFINED },
{ "MISSING_ENDTAG_FOR", MISSING_ENDTAG_FOR },
{ "MISSING_ENDTAG_BEFORE", MISSING_ENDTAG_BEFORE },
{ "DISCARDING_UNEXPECTED", DISCARDING_UNEXPECTED },
{ "NESTED_EMPHASIS", NESTED_EMPHASIS },
{ "NON_MATCHING_ENDTAG", NON_MATCHING_ENDTAG },
{ "TAG_NOT_ALLOWED_IN", TAG_NOT_ALLOWED_IN },
{ "MISSING_STARTTAG", MISSING_STARTTAG },
{ "UNEXPECTED_ENDTAG", UNEXPECTED_ENDTAG },
{ "USING_BR_INPLACE_OF", USING_BR_INPLACE_OF },
{ "INSERTING_TAG", INSERTING_TAG },
{ "SUSPECTED_MISSING_QUOTE", SUSPECTED_MISSING_QUOTE },
{ "MISSING_TITLE_ELEMENT", MISSING_TITLE_ELEMENT },
{ "DUPLICATE_FRAMESET", DUPLICATE_FRAMESET },
{ "CANT_BE_NESTED", CANT_BE_NESTED },
{ "OBSOLETE_ELEMENT", OBSOLETE_ELEMENT },
{ "PROPRIETARY_ELEMENT", PROPRIETARY_ELEMENT },
{ "ELEMENT_VERS_MISMATCH_ERROR", ELEMENT_VERS_MISMATCH_ERROR },
{ "ELEMENT_VERS_MISMATCH_WARN", ELEMENT_VERS_MISMATCH_WARN },
{ "UNKNOWN_ELEMENT", UNKNOWN_ELEMENT },
{ "TRIM_EMPTY_ELEMENT", TRIM_EMPTY_ELEMENT },
{ "COERCE_TO_ENDTAG", COERCE_TO_ENDTAG },
{ "ILLEGAL_NESTING", ILLEGAL_NESTING },
{ "NOFRAMES_CONTENT", NOFRAMES_CONTENT },
{ "CONTENT_AFTER_BODY", CONTENT_AFTER_BODY },
{ "INCONSISTENT_VERSION", INCONSISTENT_VERSION },
{ "MALFORMED_COMMENT", MALFORMED_COMMENT },
{ "BAD_COMMENT_CHARS", BAD_COMMENT_CHARS },
{ "BAD_XML_COMMENT", BAD_XML_COMMENT },
{ "BAD_CDATA_CONTENT", BAD_CDATA_CONTENT },
{ "INCONSISTENT_NAMESPACE", INCONSISTENT_NAMESPACE },
{ "DOCTYPE_AFTER_TAGS", DOCTYPE_AFTER_TAGS },
{ "MALFORMED_DOCTYPE", MALFORMED_DOCTYPE },
{ "UNEXPECTED_END_OF_FILE", UNEXPECTED_END_OF_FILE },
{ "DTYPE_NOT_UPPER_CASE", DTYPE_NOT_UPPER_CASE },
{ "TOO_MANY_ELEMENTS", TOO_MANY_ELEMENTS },
{ "UNESCAPED_ELEMENT", UNESCAPED_ELEMENT },
{ "NESTED_QUOTATION", NESTED_QUOTATION },
{ "ELEMENT_NOT_EMPTY", ELEMENT_NOT_EMPTY },
{ "ENCODING_IO_CONFLICT", ENCODING_IO_CONFLICT },
{ "MIXED_CONTENT_IN_BLOCK", MIXED_CONTENT_IN_BLOCK },
{ "MISSING_DOCTYPE", MISSING_DOCTYPE },
{ "SPACE_PRECEDING_XMLDECL", SPACE_PRECEDING_XMLDECL },
{ "TOO_MANY_ELEMENTS_IN", TOO_MANY_ELEMENTS_IN },
{ "UNEXPECTED_ENDTAG_IN", UNEXPECTED_ENDTAG_IN },
{ "REPLACING_ELEMENT", REPLACING_ELEMENT },
{ "REPLACING_UNEX_ELEMENT", REPLACING_UNEX_ELEMENT },
{ "COERCE_TO_ENDTAG_WARN", COERCE_TO_ENDTAG_WARN },
{ "UNKNOWN_ATTRIBUTE", UNKNOWN_ATTRIBUTE },
{ "INSERTING_ATTRIBUTE", INSERTING_ATTRIBUTE },
{ "INSERTING_AUTO_ATTRIBUTE", INSERTING_AUTO_ATTRIBUTE },
{ "MISSING_ATTR_VALUE", MISSING_ATTR_VALUE },
{ "BAD_ATTRIBUTE_VALUE", BAD_ATTRIBUTE_VALUE },
{ "UNEXPECTED_GT", UNEXPECTED_GT },
{ "PROPRIETARY_ATTRIBUTE", PROPRIETARY_ATTRIBUTE },
{ "MISMATCHED_ATTRIBUTE_ERROR", MISMATCHED_ATTRIBUTE_ERROR },
{ "MISMATCHED_ATTRIBUTE_WARN", MISMATCHED_ATTRIBUTE_WARN },
{ "PROPRIETARY_ATTR_VALUE", PROPRIETARY_ATTR_VALUE },
{ "REPEATED_ATTRIBUTE", REPEATED_ATTRIBUTE },
{ "MISSING_IMAGEMAP", MISSING_IMAGEMAP },
{ "XML_ATTRIBUTE_VALUE", XML_ATTRIBUTE_VALUE },
{ "UNEXPECTED_QUOTEMARK", UNEXPECTED_QUOTEMARK },
{ "MISSING_QUOTEMARK", MISSING_QUOTEMARK },
{ "ID_NAME_MISMATCH", ID_NAME_MISMATCH },
{ "BACKSLASH_IN_URI", BACKSLASH_IN_URI },
{ "FIXED_BACKSLASH", FIXED_BACKSLASH },
{ "ILLEGAL_URI_REFERENCE", ILLEGAL_URI_REFERENCE },
{ "ESCAPED_ILLEGAL_URI", ESCAPED_ILLEGAL_URI },
{ "NEWLINE_IN_URI", NEWLINE_IN_URI },
{ "ANCHOR_NOT_UNIQUE", ANCHOR_NOT_UNIQUE },
{ "JOINING_ATTRIBUTE", JOINING_ATTRIBUTE },
{ "UNEXPECTED_EQUALSIGN", UNEXPECTED_EQUALSIGN },
{ "ATTR_VALUE_NOT_LCASE", ATTR_VALUE_NOT_LCASE },
{ "XML_ID_SYNTAX", XML_ID_SYNTAX },
{ "INVALID_ATTRIBUTE", INVALID_ATTRIBUTE },
{ "BAD_ATTRIBUTE_VALUE_REPLACED", BAD_ATTRIBUTE_VALUE_REPLACED },
{ "INVALID_XML_ID", INVALID_XML_ID },
{ "UNEXPECTED_END_OF_FILE_ATTR", UNEXPECTED_END_OF_FILE_ATTR },
{ "MISSING_ATTRIBUTE", MISSING_ATTRIBUTE },
{ "WHITE_IN_URI", WHITE_IN_URI },
{ "REMOVED_HTML5", REMOVED_HTML5 },
{ "BAD_SUMMARY_HTML5", BAD_SUMMARY_HTML5 },
{ "PREVIOUS_LOCATION", PREVIOUS_LOCATION },
{ "VENDOR_SPECIFIC_CHARS", VENDOR_SPECIFIC_CHARS },
{ "INVALID_SGML_CHARS", INVALID_SGML_CHARS },
{ "INVALID_UTF8", INVALID_UTF8 },
{ "INVALID_UTF16", INVALID_UTF16 },
{ "ENCODING_MISMATCH", ENCODING_MISMATCH },
{ "INVALID_URI", INVALID_URI },
{ "INVALID_NCR", INVALID_NCR },
{ "BAD_SURROGATE_PAIR", BAD_SURROGATE_PAIR },
{ "BAD_SURROGATE_TAIL", BAD_SURROGATE_TAIL },
{ "BAD_SURROGATE_LEAD", BAD_SURROGATE_LEAD },
{ "CODES_TIDY_ERROR_LAST", CODES_TIDY_ERROR_LAST },
#if SUPPORT_ACCESSIBILITY_CHECKS
/* This blocks of codes comes from `accessErrorCodes` enum. */
{ "FIRST_ACCESS_ERR", FIRST_ACCESS_ERR },
{ "IMG_MISSING_ALT", IMG_MISSING_ALT },
{ "IMG_ALT_SUSPICIOUS_FILENAME", IMG_ALT_SUSPICIOUS_FILENAME },
{ "IMG_ALT_SUSPICIOUS_FILE_SIZE", IMG_ALT_SUSPICIOUS_FILE_SIZE },
{ "IMG_ALT_SUSPICIOUS_PLACEHOLDER", IMG_ALT_SUSPICIOUS_PLACEHOLDER },
{ "IMG_ALT_SUSPICIOUS_TOO_LONG", IMG_ALT_SUSPICIOUS_TOO_LONG },
{ "IMG_MISSING_ALT_BULLET", IMG_MISSING_ALT_BULLET },
{ "IMG_MISSING_ALT_H_RULE", IMG_MISSING_ALT_H_RULE },
{ "IMG_MISSING_LONGDESC_DLINK", IMG_MISSING_LONGDESC_DLINK },
{ "IMG_MISSING_DLINK", IMG_MISSING_DLINK },
{ "IMG_MISSING_LONGDESC", IMG_MISSING_LONGDESC },
{ "LONGDESC_NOT_REQUIRED", LONGDESC_NOT_REQUIRED },
{ "IMG_BUTTON_MISSING_ALT", IMG_BUTTON_MISSING_ALT },
{ "APPLET_MISSING_ALT", APPLET_MISSING_ALT },
{ "OBJECT_MISSING_ALT", OBJECT_MISSING_ALT },
{ "AUDIO_MISSING_TEXT_WAV", AUDIO_MISSING_TEXT_WAV },
{ "AUDIO_MISSING_TEXT_AU", AUDIO_MISSING_TEXT_AU },
{ "AUDIO_MISSING_TEXT_AIFF", AUDIO_MISSING_TEXT_AIFF },
{ "AUDIO_MISSING_TEXT_SND", AUDIO_MISSING_TEXT_SND },
{ "AUDIO_MISSING_TEXT_RA", AUDIO_MISSING_TEXT_RA },
{ "AUDIO_MISSING_TEXT_RM", AUDIO_MISSING_TEXT_RM },
{ "FRAME_MISSING_LONGDESC", FRAME_MISSING_LONGDESC },
{ "AREA_MISSING_ALT", AREA_MISSING_ALT },
{ "SCRIPT_MISSING_NOSCRIPT", SCRIPT_MISSING_NOSCRIPT },
{ "ASCII_REQUIRES_DESCRIPTION", ASCII_REQUIRES_DESCRIPTION },
{ "IMG_MAP_SERVER_REQUIRES_TEXT_LINKS", IMG_MAP_SERVER_REQUIRES_TEXT_LINKS },
{ "MULTIMEDIA_REQUIRES_TEXT", MULTIMEDIA_REQUIRES_TEXT },
{ "IMG_MAP_CLIENT_MISSING_TEXT_LINKS", IMG_MAP_CLIENT_MISSING_TEXT_LINKS },
{ "INFORMATION_NOT_CONVEYED_IMAGE", INFORMATION_NOT_CONVEYED_IMAGE },
{ "INFORMATION_NOT_CONVEYED_APPLET", INFORMATION_NOT_CONVEYED_APPLET },
{ "INFORMATION_NOT_CONVEYED_OBJECT", INFORMATION_NOT_CONVEYED_OBJECT },
{ "INFORMATION_NOT_CONVEYED_SCRIPT", INFORMATION_NOT_CONVEYED_SCRIPT },
{ "INFORMATION_NOT_CONVEYED_INPUT", INFORMATION_NOT_CONVEYED_INPUT },
{ "COLOR_CONTRAST_TEXT", COLOR_CONTRAST_TEXT },
{ "COLOR_CONTRAST_LINK", COLOR_CONTRAST_LINK },
{ "COLOR_CONTRAST_ACTIVE_LINK", COLOR_CONTRAST_ACTIVE_LINK },
{ "COLOR_CONTRAST_VISITED_LINK", COLOR_CONTRAST_VISITED_LINK },
{ "DOCTYPE_MISSING", DOCTYPE_MISSING },
{ "STYLE_SHEET_CONTROL_PRESENTATION", STYLE_SHEET_CONTROL_PRESENTATION },
{ "HEADERS_IMPROPERLY_NESTED", HEADERS_IMPROPERLY_NESTED },
{ "POTENTIAL_HEADER_BOLD", POTENTIAL_HEADER_BOLD },
{ "POTENTIAL_HEADER_ITALICS", POTENTIAL_HEADER_ITALICS },
{ "POTENTIAL_HEADER_UNDERLINE", POTENTIAL_HEADER_UNDERLINE },
{ "HEADER_USED_FORMAT_TEXT", HEADER_USED_FORMAT_TEXT },
{ "LIST_USAGE_INVALID_UL", LIST_USAGE_INVALID_UL },
{ "LIST_USAGE_INVALID_OL", LIST_USAGE_INVALID_OL },
{ "LIST_USAGE_INVALID_LI", LIST_USAGE_INVALID_LI },
{ "INDICATE_CHANGES_IN_LANGUAGE", INDICATE_CHANGES_IN_LANGUAGE },
{ "LANGUAGE_NOT_IDENTIFIED", LANGUAGE_NOT_IDENTIFIED },
{ "LANGUAGE_INVALID", LANGUAGE_INVALID },
{ "DATA_TABLE_MISSING_HEADERS", DATA_TABLE_MISSING_HEADERS },
{ "DATA_TABLE_MISSING_HEADERS_COLUMN", DATA_TABLE_MISSING_HEADERS_COLUMN },
{ "DATA_TABLE_MISSING_HEADERS_ROW", DATA_TABLE_MISSING_HEADERS_ROW },
{ "DATA_TABLE_REQUIRE_MARKUP_COLUMN_HEADERS", DATA_TABLE_REQUIRE_MARKUP_COLUMN_HEADERS },
{ "DATA_TABLE_REQUIRE_MARKUP_ROW_HEADERS", DATA_TABLE_REQUIRE_MARKUP_ROW_HEADERS },
{ "LAYOUT_TABLES_LINEARIZE_PROPERLY", LAYOUT_TABLES_LINEARIZE_PROPERLY },
{ "LAYOUT_TABLE_INVALID_MARKUP", LAYOUT_TABLE_INVALID_MARKUP },
{ "TABLE_MISSING_SUMMARY", TABLE_MISSING_SUMMARY },
{ "TABLE_SUMMARY_INVALID_NULL", TABLE_SUMMARY_INVALID_NULL },
{ "TABLE_SUMMARY_INVALID_SPACES", TABLE_SUMMARY_INVALID_SPACES },
{ "TABLE_SUMMARY_INVALID_PLACEHOLDER", TABLE_SUMMARY_INVALID_PLACEHOLDER },
{ "TABLE_MISSING_CAPTION", TABLE_MISSING_CAPTION },
{ "TABLE_MAY_REQUIRE_HEADER_ABBR", TABLE_MAY_REQUIRE_HEADER_ABBR },
{ "TABLE_MAY_REQUIRE_HEADER_ABBR_NULL", TABLE_MAY_REQUIRE_HEADER_ABBR_NULL },
{ "TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES", TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES },
{ "STYLESHEETS_REQUIRE_TESTING_LINK", STYLESHEETS_REQUIRE_TESTING_LINK },
{ "STYLESHEETS_REQUIRE_TESTING_STYLE_ELEMENT", STYLESHEETS_REQUIRE_TESTING_STYLE_ELEMENT },
{ "STYLESHEETS_REQUIRE_TESTING_STYLE_ATTR", STYLESHEETS_REQUIRE_TESTING_STYLE_ATTR },
{ "FRAME_SRC_INVALID", FRAME_SRC_INVALID },
{ "TEXT_EQUIVALENTS_REQUIRE_UPDATING_APPLET", TEXT_EQUIVALENTS_REQUIRE_UPDATING_APPLET },
{ "TEXT_EQUIVALENTS_REQUIRE_UPDATING_SCRIPT", TEXT_EQUIVALENTS_REQUIRE_UPDATING_SCRIPT },
{ "TEXT_EQUIVALENTS_REQUIRE_UPDATING_OBJECT", TEXT_EQUIVALENTS_REQUIRE_UPDATING_OBJECT },
{ "PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_SCRIPT", PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_SCRIPT },
{ "PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_OBJECT", PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_OBJECT },
{ "PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_EMBED", PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_EMBED },
{ "PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_APPLET", PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_APPLET },
{ "FRAME_MISSING_NOFRAMES", FRAME_MISSING_NOFRAMES },
{ "NOFRAMES_INVALID_NO_VALUE", NOFRAMES_INVALID_NO_VALUE },
{ "NOFRAMES_INVALID_CONTENT", NOFRAMES_INVALID_CONTENT },
{ "NOFRAMES_INVALID_LINK", NOFRAMES_INVALID_LINK },
{ "REMOVE_FLICKER_SCRIPT", REMOVE_FLICKER_SCRIPT },
{ "REMOVE_FLICKER_OBJECT", REMOVE_FLICKER_OBJECT },
{ "REMOVE_FLICKER_EMBED", REMOVE_FLICKER_EMBED },
{ "REMOVE_FLICKER_APPLET", REMOVE_FLICKER_APPLET },
{ "REMOVE_FLICKER_ANIMATED_GIF", REMOVE_FLICKER_ANIMATED_GIF },
{ "REMOVE_BLINK_MARQUEE", REMOVE_BLINK_MARQUEE },
{ "REMOVE_AUTO_REFRESH", REMOVE_AUTO_REFRESH },
{ "REMOVE_AUTO_REDIRECT", REMOVE_AUTO_REDIRECT },
{ "ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_SCRIPT", ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_SCRIPT },
{ "ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_OBJECT", ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_OBJECT },
{ "ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_APPLET", ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_APPLET },
{ "ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_EMBED", ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_EMBED },
{ "IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION", IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION },
{ "SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_DOWN", SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_DOWN },
{ "SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_UP", SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_UP },
{ "SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_CLICK", SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_CLICK },
{ "SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OVER", SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OVER },
{ "SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OUT", SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OUT },
{ "SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_MOVE", SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_MOVE },
{ "NEW_WINDOWS_REQUIRE_WARNING_NEW", NEW_WINDOWS_REQUIRE_WARNING_NEW },
{ "NEW_WINDOWS_REQUIRE_WARNING_BLANK", NEW_WINDOWS_REQUIRE_WARNING_BLANK },
{ "LABEL_NEEDS_REPOSITIONING_BEFORE_INPUT", LABEL_NEEDS_REPOSITIONING_BEFORE_INPUT },
{ "LABEL_NEEDS_REPOSITIONING_AFTER_INPUT", LABEL_NEEDS_REPOSITIONING_AFTER_INPUT },
{ "FORM_CONTROL_REQUIRES_DEFAULT_TEXT", FORM_CONTROL_REQUIRES_DEFAULT_TEXT },
{ "FORM_CONTROL_DEFAULT_TEXT_INVALID_NULL", FORM_CONTROL_DEFAULT_TEXT_INVALID_NULL },
{ "FORM_CONTROL_DEFAULT_TEXT_INVALID_SPACES", FORM_CONTROL_DEFAULT_TEXT_INVALID_SPACES },
{ "REPLACE_DEPRECATED_HTML_APPLET", REPLACE_DEPRECATED_HTML_APPLET },
{ "REPLACE_DEPRECATED_HTML_BASEFONT", REPLACE_DEPRECATED_HTML_BASEFONT },
{ "REPLACE_DEPRECATED_HTML_CENTER", REPLACE_DEPRECATED_HTML_CENTER },
{ "REPLACE_DEPRECATED_HTML_DIR", REPLACE_DEPRECATED_HTML_DIR },
{ "REPLACE_DEPRECATED_HTML_FONT", REPLACE_DEPRECATED_HTML_FONT },
{ "REPLACE_DEPRECATED_HTML_ISINDEX", REPLACE_DEPRECATED_HTML_ISINDEX },
{ "REPLACE_DEPRECATED_HTML_MENU", REPLACE_DEPRECATED_HTML_MENU },
{ "REPLACE_DEPRECATED_HTML_S", REPLACE_DEPRECATED_HTML_S },
{ "REPLACE_DEPRECATED_HTML_STRIKE", REPLACE_DEPRECATED_HTML_STRIKE },
{ "REPLACE_DEPRECATED_HTML_U", REPLACE_DEPRECATED_HTML_U },
{ "FRAME_MISSING_TITLE", FRAME_MISSING_TITLE },
{ "FRAME_TITLE_INVALID_NULL", FRAME_TITLE_INVALID_NULL },
{ "FRAME_TITLE_INVALID_SPACES", FRAME_TITLE_INVALID_SPACES },
{ "ASSOCIATE_LABELS_EXPLICITLY", ASSOCIATE_LABELS_EXPLICITLY },
{ "ASSOCIATE_LABELS_EXPLICITLY_FOR", ASSOCIATE_LABELS_EXPLICITLY_FOR },
{ "ASSOCIATE_LABELS_EXPLICITLY_ID", ASSOCIATE_LABELS_EXPLICITLY_ID },
{ "LINK_TEXT_NOT_MEANINGFUL", LINK_TEXT_NOT_MEANINGFUL },
{ "LINK_TEXT_MISSING", LINK_TEXT_MISSING },
{ "LINK_TEXT_TOO_LONG", LINK_TEXT_TOO_LONG },
{ "LINK_TEXT_NOT_MEANINGFUL_CLICK_HERE", LINK_TEXT_NOT_MEANINGFUL_CLICK_HERE },
{ "LINK_TEXT_NOT_MEANINGFUL_MORE", LINK_TEXT_NOT_MEANINGFUL_MORE },
{ "LINK_TEXT_NOT_MEANINGFUL_FOLLOW_THIS", LINK_TEXT_NOT_MEANINGFUL_FOLLOW_THIS },
{ "METADATA_MISSING", METADATA_MISSING },
{ "METADATA_MISSING_LINK", METADATA_MISSING_LINK },
{ "METADATA_MISSING_REDIRECT_AUTOREFRESH", METADATA_MISSING_REDIRECT_AUTOREFRESH },
{ "SKIPOVER_ASCII_ART", SKIPOVER_ASCII_ART },
{ "LAST_ACCESS_ERR", LAST_ACCESS_ERR },
#endif
/* This blocks of codes comes from `tidyMessagesMisc` enum. */
{ "STRING_UNKNOWN_OPTION", STRING_UNKNOWN_OPTION },
{ "STRING_MISSING_MALFORMED", STRING_MISSING_MALFORMED },
{ "STRING_DOCTYPE_GIVEN", STRING_DOCTYPE_GIVEN },
{ "STRING_HTML_PROPRIETARY", STRING_HTML_PROPRIETARY },
{ "STRING_CONTENT_LOOKS", STRING_CONTENT_LOOKS },
{ "STRING_NO_SYSID", STRING_NO_SYSID },
{ NULL, 0 },
};
/**
* Given an error code, return the string associated with it.
*/
ctmbstr tidyErrorCodeAsString(uint code)
{
uint i = 0;
while (tidyErrorFilterKeysStruct[i].key) {
if ( tidyErrorFilterKeysStruct[i].value == code )
return tidyErrorFilterKeysStruct[i].key;
i++;
}
return "UNDEFINED";
}
/** /**
* The real string lookup function. * The real string lookup function.
*/ */
ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definition, uint plural ) static ctmbstr tidyLocalizedStringImpl( uint messageType, languageDefinition *definition, uint plural )
{ {
int i; int i;
languageDictionary *dictionary = &definition->messages; languageDictionary *dictionary = &definition->messages;
@ -523,27 +252,27 @@ ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definiti
* of infrastructure to use hash lookups is a preferred * of infrastructure to use hash lookups is a preferred
* future optimization. * future optimization.
*/ */
ctmbstr tidyLocalizedStringN( uint messageType, uint quantity ) ctmbstr TY_(tidyLocalizedStringN)( uint messageType, uint quantity )
{ {
ctmbstr result; ctmbstr result;
result = TY_(tidyLocalizedString)( messageType, tidyLanguages.currentLanguage, quantity); result = tidyLocalizedStringImpl( messageType, tidyLanguages.currentLanguage, quantity);
if (!result && tidyLanguages.fallbackLanguage ) if (!result && tidyLanguages.fallbackLanguage )
{ {
result = TY_(tidyLocalizedString)( messageType, tidyLanguages.fallbackLanguage, quantity); result = tidyLocalizedStringImpl( messageType, tidyLanguages.fallbackLanguage, quantity);
} }
if (!result) if (!result)
{ {
/* Fallback to en which is built in. */ /* Fallback to en which is built in. */
result = TY_(tidyLocalizedString)( messageType, &language_en, quantity); result = tidyLocalizedStringImpl( messageType, &language_en, quantity);
} }
if (!result) if (!result)
{ {
/* Last resort: Fallback to en singular which is built in. */ /* Last resort: Fallback to en singular which is built in. */
result = TY_(tidyLocalizedString)( messageType, &language_en, 1); result = tidyLocalizedStringImpl( messageType, &language_en, 1);
} }
return result; return result;
@ -558,9 +287,9 @@ ctmbstr tidyLocalizedStringN( uint messageType, uint quantity )
* of infrastructure to use hash lookups is a preferred * of infrastructure to use hash lookups is a preferred
* future optimization. * future optimization.
*/ */
ctmbstr tidyLocalizedString( uint messageType ) ctmbstr TY_(tidyLocalizedString)( uint messageType )
{ {
return tidyLocalizedStringN( messageType, 1 ); return TY_(tidyLocalizedStringN)( messageType, 1 );
} }
@ -572,7 +301,7 @@ ctmbstr tidyLocalizedString( uint messageType )
** Returns NULL on failure. ** Returns NULL on failure.
** @return The same buffer for convenience. ** @return The same buffer for convenience.
*/ */
tmbstr tidySystemLocale(tmbstr result) tmbstr TY_(tidySystemLocale)(tmbstr result)
{ {
ctmbstr temp; ctmbstr temp;
@ -599,7 +328,7 @@ tmbstr tidySystemLocale(tmbstr result)
* don't try to free it. If the name looks like a cc_ll identifier, we will * don't try to free it. If the name looks like a cc_ll identifier, we will
* return it if there's no other match. * return it if there's no other match.
*/ */
tmbstr tidyNormalizedLocaleName( ctmbstr locale ) tmbstr TY_(tidyNormalizedLocaleName)( ctmbstr locale )
{ {
uint i; uint i;
uint len; uint len;
@ -686,14 +415,14 @@ languageDefinition *TY_(tidyTestLanguage)( ctmbstr languageCode )
* true. However the opposite is not true; if es is requested but * true. However the opposite is not true; if es is requested but
* not present, Tidy will not try to select from the es_XX variants. * not present, Tidy will not try to select from the es_XX variants.
*/ */
Bool tidySetLanguage( ctmbstr languageCode ) Bool TY_(tidySetLanguage)( ctmbstr languageCode )
{ {
languageDefinition *dict1 = NULL; languageDefinition *dict1 = NULL;
languageDefinition *dict2 = NULL; languageDefinition *dict2 = NULL;
tmbstr wantCode = NULL; tmbstr wantCode = NULL;
char lang[3] = ""; char lang[3] = "";
if ( !languageCode || !(wantCode = tidyNormalizedLocaleName( languageCode )) ) if ( !languageCode || !(wantCode = TY_(tidyNormalizedLocaleName)( languageCode )) )
{ {
return no; return no;
} }
@ -739,7 +468,7 @@ Bool tidySetLanguage( ctmbstr languageCode )
/** /**
* Gets the current language used by Tidy. * Gets the current language used by Tidy.
*/ */
ctmbstr tidyGetLanguage() ctmbstr TY_(tidyGetLanguage)()
{ {
languageDefinition *langDef = tidyLanguages.currentLanguage; languageDefinition *langDef = tidyLanguages.currentLanguage;
languageDictionary *langDict = &langDef->messages; languageDictionary *langDict = &langDef->messages;
@ -751,9 +480,9 @@ ctmbstr tidyGetLanguage()
* Provides a string given `messageType` in the default * Provides a string given `messageType` in the default
* localization (which is `en`), for single plural form. * localization (which is `en`), for single plural form.
*/ */
ctmbstr tidyDefaultString( uint messageType ) ctmbstr TY_(tidyDefaultString)( uint messageType )
{ {
return TY_(tidyLocalizedString)( messageType, &language_en, 1); return tidyLocalizedStringImpl( messageType, &language_en, 1);
} }
@ -761,7 +490,7 @@ ctmbstr tidyDefaultString( uint messageType )
* Determines the true size of the `language_en` array indicating the * Determines the true size of the `language_en` array indicating the
* number of items in the array, _not_ the highest index. * number of items in the array, _not_ the highest index.
*/ */
const uint TY_(tidyStringKeyListSize)() static const uint tidyStringKeyListSize()
{ {
static uint array_size = 0; static uint array_size = 0;
@ -782,7 +511,7 @@ const uint TY_(tidyStringKeyListSize)()
* these are provided for documentation generation purposes * these are provided for documentation generation purposes
* and probably aren't useful for LibTidy implementors. * and probably aren't useful for LibTidy implementors.
*/ */
TidyIterator getStringKeyList() TidyIterator TY_(getStringKeyList)()
{ {
return (TidyIterator)(size_t)1; return (TidyIterator)(size_t)1;
} }
@ -793,7 +522,7 @@ TidyIterator getStringKeyList()
* generation purposes and probably aren't useful to * generation purposes and probably aren't useful to
* libtidy implementors. * libtidy implementors.
*/ */
uint getNextStringKey( TidyIterator* iter ) uint TY_(getNextStringKey)( TidyIterator* iter )
{ {
uint item = 0; uint item = 0;
size_t itemIndex; size_t itemIndex;
@ -801,13 +530,13 @@ uint getNextStringKey( TidyIterator* iter )
itemIndex = (size_t)*iter; itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyStringKeyListSize)() ) if ( itemIndex > 0 && itemIndex <= tidyStringKeyListSize() )
{ {
item = language_en.messages[ itemIndex - 1 ].key; item = language_en.messages[ itemIndex - 1 ].key;
itemIndex++; itemIndex++;
} }
*iter = (TidyIterator)( itemIndex <= TY_(tidyStringKeyListSize)() ? itemIndex : (size_t)0 ); *iter = (TidyIterator)( itemIndex <= tidyStringKeyListSize() ? itemIndex : (size_t)0 );
return item; return item;
} }
@ -816,7 +545,7 @@ uint getNextStringKey( TidyIterator* iter )
* Determines the true size of the `localeMappings` array indicating the * Determines the true size of the `localeMappings` array indicating the
* number of items in the array, _not_ the highest index. * number of items in the array, _not_ the highest index.
*/ */
const uint TY_(tidyLanguageListSize)() static const uint tidyLanguageListSize()
{ {
static uint array_size = 0; static uint array_size = 0;
@ -835,7 +564,7 @@ const uint TY_(tidyLanguageListSize)()
* in Tidy's structure of Windows<->POSIX local mapping. * in Tidy's structure of Windows<->POSIX local mapping.
* Items can be retrieved with getNextWindowsLanguage(); * Items can be retrieved with getNextWindowsLanguage();
*/ */
TidyIterator getWindowsLanguageList() TidyIterator TY_(getWindowsLanguageList)()
{ {
return (TidyIterator)(size_t)1; return (TidyIterator)(size_t)1;
} }
@ -844,29 +573,47 @@ TidyIterator getWindowsLanguageList()
* Returns the next record of type `localeMapItem` in * Returns the next record of type `localeMapItem` in
* Tidy's structure of Windows<->POSIX local mapping. * Tidy's structure of Windows<->POSIX local mapping.
*/ */
const tidyLocaleMapItem *getNextWindowsLanguage( TidyIterator *iter ) const tidyLocaleMapItemImpl *TY_(getNextWindowsLanguage)( TidyIterator *iter )
{ {
const tidyLocaleMapItem *item = NULL; const tidyLocaleMapItemImpl *item = NULL;
size_t itemIndex; size_t itemIndex;
assert( iter != NULL ); assert( iter != NULL );
itemIndex = (size_t)*iter; itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyLanguageListSize)() ) if ( itemIndex > 0 && itemIndex <= tidyLanguageListSize() )
{ {
item = &localeMappings[ itemIndex -1 ]; item = &localeMappings[ itemIndex -1 ];
itemIndex++; itemIndex++;
} }
*iter = (TidyIterator)( itemIndex <= TY_(tidyLanguageListSize)() ? itemIndex : (size_t)0 ); *iter = (TidyIterator)( itemIndex <= tidyLanguageListSize() ? itemIndex : (size_t)0 );
return item; return item;
} }
/**
* Given a `tidyLocalMapItemImpl, return the Windows name.
*/
const ctmbstr TY_(TidyLangWindowsName)( const tidyLocaleMapItemImpl *item )
{
return item->winName;
}
/**
* Given a `tidyLocalMapItemImpl, return the POSIX name.
*/
const ctmbstr TY_(TidyLangPosixName)( const tidyLocaleMapItemImpl *item )
{
return item->POSIXName;
}
/** /**
* Determines the number of languages installed in Tidy. * Determines the number of languages installed in Tidy.
*/ */
const uint TY_(tidyInstalledLanguageListSize)() static const uint tidyInstalledLanguageListSize()
{ {
static uint array_size = 0; static uint array_size = 0;
@ -885,7 +632,7 @@ const uint TY_(tidyInstalledLanguageListSize)()
* in Tidy's list of installed language codes. * in Tidy's list of installed language codes.
* Items can be retrieved with getNextInstalledLanguage(); * Items can be retrieved with getNextInstalledLanguage();
*/ */
TidyIterator getInstalledLanguageList() TidyIterator TY_(getInstalledLanguageList)()
{ {
return (TidyIterator)(size_t)1; return (TidyIterator)(size_t)1;
} }
@ -893,7 +640,7 @@ TidyIterator getInstalledLanguageList()
/** /**
* Returns the next installed language. * Returns the next installed language.
*/ */
ctmbstr getNextInstalledLanguage( TidyIterator* iter ) ctmbstr TY_(getNextInstalledLanguage)( TidyIterator* iter )
{ {
ctmbstr item = NULL; ctmbstr item = NULL;
size_t itemIndex; size_t itemIndex;
@ -901,62 +648,12 @@ ctmbstr getNextInstalledLanguage( TidyIterator* iter )
itemIndex = (size_t)*iter; itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyInstalledLanguageListSize)() ) if ( itemIndex > 0 && itemIndex <= tidyInstalledLanguageListSize() )
{ {
item = tidyLanguages.languages[itemIndex - 1]->messages[0].value; item = tidyLanguages.languages[itemIndex - 1]->messages[0].value;
itemIndex++; itemIndex++;
} }
*iter = (TidyIterator)( itemIndex <= TY_(tidyInstalledLanguageListSize)() ? itemIndex : (size_t)0 ); *iter = (TidyIterator)( itemIndex <= tidyInstalledLanguageListSize() ? itemIndex : (size_t)0 );
return item;
}
/**
* Determines the number of error codes used by Tidy.
*/
const uint TY_(tidyErrorCodeListSize)()
{
static uint array_size = 0;
if ( array_size == 0 )
{
while ( tidyErrorFilterKeysStruct[array_size].key ) {
array_size++;
}
}
return array_size;
}
/**
* Initializes the TidyIterator to point to the first item
* in Tidy's list of error codes that can be return with
* `TidyReportFilter3`.
* Items can be retrieved with getNextErrorCode();
*/
TidyIterator getErrorCodeList()
{
return (TidyIterator)(size_t)1;
}
/**
* Returns the next error code.
*/
const tidyErrorFilterKeyItem *getNextErrorCode( TidyIterator* iter )
{
const tidyErrorFilterKeyItem *item = NULL;
size_t itemIndex;
assert( iter != NULL );
itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyErrorCodeListSize)() )
{
item = &tidyErrorFilterKeysStruct[itemIndex - 1];
itemIndex++;
}
*iter = (TidyIterator)( itemIndex <= TY_(tidyErrorCodeListSize)() ? itemIndex : (size_t)0 );
return item; return item;
} }

View file

@ -1,25 +1,41 @@
#ifndef language_h #ifndef language_h
#define language_h #define language_h
/*
* language.h /*********************************************************************
* Localization support for HTML Tidy. * Localization support for HTML Tidy.
* This header provides the public (within libtidy) interface *
* to basic localization support. To add your own localization * This header provides the public (within libtidy) interface to
* create a new `language_xx.h` file and add it to the struct * basic localization support. To add your own localization, create
* in `language.c`. * a new `language_xx.h` file and add it to the struct in
* `language.c`.
* *
* (c) 2015 HTACG * (c) 2015 HTACG
* See tidy.h and access.h for the copyright notice. * See `tidy.h` for the copyright notice.
* *********************************************************************/
* Created by Jim Derry on 11/28/15.
*/
#include "tidyplatform.h" #include "forward.h"
/** @name Exposed Data Structures */ /** @name Exposed Data Structures */
/** @{ */ /** @{ */
/**
* These enumerations are used within instances of `languageDefinition`
* structures to provide additional metadata, and are localizable
* therein.
*/
typedef enum {
/* Specifies the language code for a particular language. */
TIDY_LANGUAGE = 400,
/* Marker for the last key in the structure. */
TIDY_MESSAGE_TYPE_LAST
} tidyLanguage;
/** /**
* Describes a record for a localization string. * Describes a record for a localization string.
* - key must correspond with one of Tidy's enums (see `tidyMessageTypes` * - key must correspond with one of Tidy's enums (see `tidyMessageTypes`
@ -60,159 +76,10 @@ typedef struct languageDefinition {
* it gives LibTidy implementors the ability to determine how Windows * it gives LibTidy implementors the ability to determine how Windows
* locale names are mapped to POSIX language codes. * locale names are mapped to POSIX language codes.
*/ */
typedef struct tidyLocaleMapItem { typedef struct tidyLocaleMapItemImpl {
ctmbstr winName; ctmbstr winName;
ctmbstr POSIXName; ctmbstr POSIXName;
} tidyLocaleMapItem; } tidyLocaleMapItemImpl;
/**
* The function getNextErrorCode() returns pointers to this type; it gives
* LibTidy implementors the ability to know what errors can be returned
* via `TidyReportFilter3`.
* Provides the mapping for LibTidy users to map between an opaque key
* and an error message value. See `tidyErrorFilterKeys[]` in `language.c`.
* The `key` string is guaranteed by the API (unless deleted entirely). The
* `value` is suitable for use in looking up Tidy's strings, but its value
* is not guaranteed between releases.
*/
typedef struct tidyErrorFilterKeyItem {
ctmbstr key;
int value;
} tidyErrorFilterKeyItem;
/**
* Defines all of the possible dictionary keys.
* The starting value is arbitrary but must prevent overlaps
* with other enums that are used for retrieving strings. The
* comprehensive list of enums for which we provides strings
* is as follows:
* - `tidyMessageTypes` in this file, start == 4096.
* - `tidyErrorCodes` from `message.h`, start == 200.
* - `accessErrorCodes` from `access.h`, start == CODES_TIDY_ERROR_LAST+1.
* - `tidyMessagesMisc` from `message.h`, start == 2048.
* - `TidyOptionId` from `tidyEnum.h`, start == 0 (important!).
* - `TidyReportLevelKeys` from `tidyEnum.h`, start == 600.
* - ...
* You should never count on the value of a label being
* constant. Accordingly feel free to arrange new enum
* values in the most appropriate grouping below.
*/
typedef enum
{
/* This MUST be present and first. */
TIDY_MESSAGE_TYPE_FIRST = 4096,
/* Specify the code for this language. */
TIDY_LANGUAGE,
/* Localization test strings. */
TEST_PRESENT_IN_BASE,
TEST_PRESENT_IN_REGION,
/* Strings for the console application. */
TC_CAT_DIAGNOSTICS,
TC_CAT_ENCODING,
TC_CAT_MARKUP,
TC_CAT_MISC,
TC_CAT_PRETTYPRINT,
TC_LABEL_COL,
TC_LABEL_FILE,
TC_LABEL_LANG,
TC_LABEL_LEVL,
TC_LABEL_OPT,
TC_MAIN_ERROR_LOAD_CONFIG,
TC_OPT_ACCESS,
TC_OPT_ASCII,
TC_OPT_ASHTML,
TC_OPT_ASXML,
TC_OPT_BARE,
TC_OPT_BIG5,
TC_OPT_CLEAN,
TC_OPT_CONFIG,
TC_OPT_ERRORS,
TC_OPT_FILE,
TC_OPT_GDOC,
TC_OPT_HELP,
TC_OPT_HELPCFG,
TC_OPT_HELPOPT,
TC_OPT_IBM858,
TC_OPT_INDENT,
TC_OPT_ISO2022,
TC_OPT_LANGUAGE,
TC_OPT_LATIN0,
TC_OPT_LATIN1,
TC_OPT_MAC,
TC_OPT_MODIFY,
TC_OPT_NUMERIC,
TC_OPT_OMIT,
TC_OPT_OUTPUT,
TC_OPT_QUIET,
TC_OPT_RAW,
TC_OPT_SHIFTJIS,
TC_OPT_SHOWCFG,
TC_OPT_UPPER,
TC_OPT_UTF16,
TC_OPT_UTF16BE,
TC_OPT_UTF16LE,
TC_OPT_UTF8,
TC_OPT_VERSION,
TC_OPT_WIN1252,
TC_OPT_WRAP,
TC_OPT_XML,
TC_OPT_XMLCFG,
TC_OPT_XMLSTRG,
TC_OPT_XMLERRS,
TC_OPT_XMLOPTS,
TC_OPT_XMLHELP,
TC_STRING_CONF_HEADER,
TC_STRING_CONF_NAME,
TC_STRING_CONF_TYPE,
TC_STRING_CONF_VALUE,
TC_STRING_CONF_NOTE,
TC_STRING_OPT_NOT_DOCUMENTED,
TC_STRING_OUT_OF_MEMORY,
TC_STRING_FATAL_ERROR,
TC_STRING_FILE_MANIP,
TC_STRING_LANG_MUST_SPECIFY,
TC_STRING_LANG_NOT_FOUND,
TC_STRING_MUST_SPECIFY,
TC_STRING_PROCESS_DIRECTIVES,
TC_STRING_CHAR_ENCODING,
TC_STRING_MISC,
TC_STRING_XML,
TC_STRING_UNKNOWN_OPTION,
TC_STRING_UNKNOWN_OPTION_B,
TC_STRING_VERS_A,
TC_STRING_VERS_B,
TC_TXT_HELP_1,
TC_TXT_HELP_2A,
TC_TXT_HELP_2B,
TC_TXT_HELP_3,
TC_TXT_HELP_CONFIG,
TC_TXT_HELP_CONFIG_NAME,
TC_TXT_HELP_CONFIG_TYPE,
TC_TXT_HELP_CONFIG_ALLW,
TC_TXT_HELP_LANG_1,
TC_TXT_HELP_LANG_2,
TC_TXT_HELP_LANG_3,
/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST
} tidyMessageTypes;
/**
* LibTidy users may want to use `TidyReportFilter3` to enable their own
* localization lookup features. Because Tidy's errors codes are enums the
* specific values can change over time. This function returns a string
* representing the enum value name that can be used as a lookup key
* independent of changing string values (TidyReportFiler2 is vulnerable
* to changing strings). `TidyReportFilter3` will return this general
* string as the error message indicator.
*/
ctmbstr tidyErrorCodeAsString(uint code);
/** @} */ /** @} */
@ -228,7 +95,7 @@ ctmbstr tidyErrorCodeAsString(uint code);
** Returns NULL on failure. ** Returns NULL on failure.
** @return The same buffer for convenience. ** @return The same buffer for convenience.
*/ */
tmbstr tidySystemLocale(tmbstr result); tmbstr TY_(tidySystemLocale)(tmbstr result);
/** /**
* Tells Tidy to use a different language for output. * Tells Tidy to use a different language for output.
@ -241,35 +108,36 @@ tmbstr tidySystemLocale(tmbstr result);
* true. However the opposite is not true; if es is requested but * true. However the opposite is not true; if es is requested but
* not present, Tidy will not try to select from the es_XX variants. * not present, Tidy will not try to select from the es_XX variants.
*/ */
Bool tidySetLanguage( ctmbstr languageCode ); Bool TY_(tidySetLanguage)( ctmbstr languageCode );
/** /**
* Gets the current language used by Tidy. * Gets the current language used by Tidy.
*/ */
ctmbstr tidyGetLanguage(); ctmbstr TY_(tidyGetLanguage)();
/** /**
* Provides a string given `messageType` in the current * Provides a string given `messageType` in the current
* localization for `quantity`. * localization for `quantity`.
*/ */
ctmbstr tidyLocalizedStringN( uint messageType, uint quantity ); ctmbstr TY_(tidyLocalizedStringN)( uint messageType, uint quantity );
/** /**
* Provides a string given `messageType` in the current * Provides a string given `messageType` in the current
* localization for the single case. * localization for the single case.
*/ */
ctmbstr tidyLocalizedString( uint messageType ); ctmbstr TY_(tidyLocalizedString)( uint messageType );
/** @} */ /** @} */
/** @name Documentation Generation */ /** @name Documentation Generation */
/** @{ */ /** @{ */
/** /**
* Provides a string given `messageType` in the default * Provides a string given `messageType` in the default
* localization (which is `en`). * localization (which is `en`).
*/ */
ctmbstr tidyDefaultString( uint messageType ); ctmbstr TY_(tidyDefaultString)( uint messageType );
/* /*
* Initializes the TidyIterator to point to the first item * Initializes the TidyIterator to point to the first item
@ -277,7 +145,7 @@ ctmbstr tidyDefaultString( uint messageType );
* these are provided for documentation generation purposes * these are provided for documentation generation purposes
* and probably aren't useful for LibTidy implementors. * and probably aren't useful for LibTidy implementors.
*/ */
TidyIterator getStringKeyList(); TidyIterator TY_(getStringKeyList)();
/* /*
* Provides the next key value in Tidy's list of localized * Provides the next key value in Tidy's list of localized
@ -285,46 +153,42 @@ TidyIterator getStringKeyList();
* generation purposes and probably aren't useful to * generation purposes and probably aren't useful to
* libtidy implementors. * libtidy implementors.
*/ */
uint getNextStringKey( TidyIterator* iter ); uint TY_(getNextStringKey)( TidyIterator* iter );
/** /**
* Initializes the TidyIterator to point to the first item * Initializes the TidyIterator to point to the first item
* in Tidy's structure of Windows<->POSIX local mapping. * in Tidy's structure of Windows<->POSIX local mapping.
* Items can be retrieved with getNextWindowsLanguage(); * Items can be retrieved with getNextWindowsLanguage();
*/ */
TidyIterator getWindowsLanguageList(); TidyIterator TY_(getWindowsLanguageList)();
/** /**
* Returns the next record of type `localeMapItem` in * Returns the next record of type `localeMapItem` in
* Tidy's structure of Windows<->POSIX local mapping. * Tidy's structure of Windows<->POSIX local mapping.
*/ */
const tidyLocaleMapItem *getNextWindowsLanguage( TidyIterator* iter ); const tidyLocaleMapItemImpl *TY_(getNextWindowsLanguage)( TidyIterator* iter );
/**
* Given a `tidyLocalMapItemImpl, return the Windows name.
*/
const ctmbstr TY_(TidyLangWindowsName)( const tidyLocaleMapItemImpl *item );
/**
* Given a `tidyLocalMapItemImpl, return the POSIX name.
*/
const ctmbstr TY_(TidyLangPosixName)( const tidyLocaleMapItemImpl *item );
/** /**
* Initializes the TidyIterator to point to the first item * Initializes the TidyIterator to point to the first item
* in Tidy's list of installed language codes. * in Tidy's list of installed language codes.
* Items can be retrieved with getNextInstalledLanguage(); * Items can be retrieved with getNextInstalledLanguage();
*/ */
TidyIterator getInstalledLanguageList(); TidyIterator TY_(getInstalledLanguageList)();
/** /**
* Returns the next installed language. * Returns the next installed language.
*/ */
ctmbstr getNextInstalledLanguage( TidyIterator* iter ); ctmbstr TY_(getNextInstalledLanguage)( TidyIterator* iter );
/**
* Initializes the TidyIterator to point to the first item
* in Tidy's list of error codes that can be return with
* `TidyReportFilter3`.
* Items can be retrieved with getNextErrorCode();
*/
TidyIterator getErrorCodeList();
/**
* Returns the next error code.
*/
const tidyErrorFilterKeyItem *getNextErrorCode( TidyIterator* iter );
/** @} */ /** @} */

View file

@ -12,7 +12,7 @@
* language localizations. As such do not edit PO files for this language; * language localizations. As such do not edit PO files for this language;
* modify this file directly. * modify this file directly.
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Created by Jim Derry on 11/28/15. * Created by Jim Derry on 11/28/15.
@ -22,10 +22,6 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm
@ -99,9 +95,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
{/* For example, "you should avoid using the specified encoding." */ {/* For example, "you should avoid using the specified encoding." */
STRING_SPECIFIED, 0, "specified" STRING_SPECIFIED, 0, "specified"
}, },
{ STRING_UNKNOWN_FILE, 0, "%s: can't open file \"%s\"\n" },
{ STRING_UNKNOWN_OPTION, 0, "unknown option: %s" }, { STRING_UNKNOWN_OPTION, 0, "unknown option: %s" },
{ STRING_UNRECZD_OPTION, 0, "unrecognized option -%c use -help to list options\n" },
{ STRING_XML_DECLARATION, 0, "XML declaration" }, { STRING_XML_DECLARATION, 0, "XML declaration" },
{/* This console output should be limited to 78 characters per line. */ {/* This console output should be limited to 78 characters per line. */
@ -314,13 +308,13 @@ static languageDefinition language_en = { whichPluralForm_en, {
/*************************************** /***************************************
** Message Severity Level ** Message Severity Level
***************************************/ ***************************************/
{ TidyInfoString, 0, "Info: " }, { TidyInfo, 0, "Info: " },
{ TidyWarningString, 0, "Warning: " }, { TidyWarning, 0, "Warning: " },
{ TidyConfigString, 0, "Config: " }, { TidyConfig, 0, "Config: " },
{ TidyAccessString, 0, "Access: " }, { TidyAccess, 0, "Access: " },
{ TidyErrorString, 0, "Error: " }, { TidyError, 0, "Error: " },
{ TidyBadDocumentString, 0, "Document: " }, { TidyBadDocument, 0, "Document: " },
{ TidyFatalString, 0, "Panic: " }, { TidyFatal, 0, "Panic: " },
/*************************************** /***************************************
** Warnings and Errors ** Warnings and Errors
@ -2084,6 +2078,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
"to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this." "to <code>&lt;\\/g</code>. Set this option to 'no' if you do not want this."
}, },
#if SUPPORT_CONSOLE_APP
/******************************************************** /********************************************************
** Console Application ** Console Application
** Although these strings are not used within LibTidy ** Although these strings are not used within LibTidy
@ -2091,11 +2086,11 @@ static languageDefinition language_en = { whichPluralForm_en, {
** provided as part of LibTidy for convenience to ** provided as part of LibTidy for convenience to
** developers. ** developers.
********************************************************/ ********************************************************/
{ TC_CAT_DIAGNOSTICS, 0, "diagnostics" }, { TidyDiagnostics, 0, "diagnostics" },
{ TC_CAT_ENCODING, 0, "encoding" }, { TidyEncoding, 0, "encoding" },
{ TC_CAT_MARKUP, 0, "markup" }, { TidyMarkup, 0, "markup" },
{ TC_CAT_MISC, 0, "misc" }, { TidyMiscellaneous, 0, "misc" },
{ TC_CAT_PRETTYPRINT, 0, "print" }, { TidyPrettyPrint, 0, "print" },
{ TC_LABEL_COL, 0, "column" }, { TC_LABEL_COL, 0, "column" },
{ TC_LABEL_FILE, 0, "file" }, { TC_LABEL_FILE, 0, "file" },
{ TC_LABEL_LANG, 0, "lang" }, { TC_LABEL_LANG, 0, "lang" },
@ -2345,7 +2340,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
"Tidy is currently using locale %s. \n" "Tidy is currently using locale %s. \n"
"\n" "\n"
}, },
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */ {/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL TIDY_MESSAGE_TYPE_LAST, 0, NULL

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_en_gb.h` (our own * `poconvert.rb msgunfmt language_en_gb.h` (our own
* conversion tool) to generate a fresh PO from this file first! * conversion tool) to generate a fresh PO from this file first!
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Template Created by Jim Derry on 01/14/2016. * Template Created by Jim Derry on 01/14/2016.
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-03-24 10:59:55 * PO_REVISION_DATE=2017-02-17 14:46:38
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_es.h` (our own * `poconvert.rb msgunfmt language_es.h` (our own
* conversion tool) to generate a fresh PO from this file first! * conversion tool) to generate a fresh PO from this file first!
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Template Created by Jim Derry on 01/14/2016. * Template Created by Jim Derry on 01/14/2016.
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-03-24 10:59:55 * PO_REVISION_DATE=2017-02-17 14:46:38
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm
@ -83,6 +79,8 @@ static languageDefinition language_es = { whichPluralForm_es, {
{ TidyNCR, 0, "Esta opción especifica si Tidy debe permitir referencias de caracteres numéricos. " }, { TidyNCR, 0, "Esta opción especifica si Tidy debe permitir referencias de caracteres numéricos. " },
#endif /* SUPPORT_ASIAN_ENCODINGS */ #endif /* SUPPORT_ASIAN_ENCODINGS */
#if SUPPORT_CONSOLE_APP
{ TC_TXT_HELP_LANG_1, 0, { TC_TXT_HELP_LANG_1, 0,
"\n" "\n"
"La opción --language (o --lang) indica el lenguaje Tidy debe \n" "La opción --language (o --lang) indica el lenguaje Tidy debe \n"
@ -127,6 +125,7 @@ static languageDefinition language_es = { whichPluralForm_es, {
"Tidy está utilizando la configuración regional %s. \n" "Tidy está utilizando la configuración regional %s. \n"
"\n" "\n"
}, },
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */ {/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL TIDY_MESSAGE_TYPE_LAST, 0, NULL

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_es_mx.h` (our own * `poconvert.rb msgunfmt language_es_mx.h` (our own
* conversion tool) to generate a fresh PO from this file first! * conversion tool) to generate a fresh PO from this file first!
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Template Created by Jim Derry on 01/14/2016. * Template Created by Jim Derry on 01/14/2016.
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-03-24 10:59:55 * PO_REVISION_DATE=2017-02-17 14:46:38
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_fr.h` (our own * `poconvert.rb msgunfmt language_fr.h` (our own
* conversion tool) to generate a fresh PO from this file first! * conversion tool) to generate a fresh PO from this file first!
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Template Created by Jim Derry on 01/14/2016. * Template Created by Jim Derry on 01/14/2016.
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR= * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE= * PO_REVISION_DATE=2017-02-17 14:46:38
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm
@ -65,7 +61,6 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
{/* Specify the ll or ll_cc language code here. */ {/* Specify the ll or ll_cc language code here. */
TIDY_LANGUAGE, 0, "fr" TIDY_LANGUAGE, 0, "fr"
}, },
{ ACCESS_URL, 0, "http://www.w3.org/WAI/GL" },
{ ATRC_ACCESS_URL, 0, "http://www.html-tidy.org/Accessibility/" }, { ATRC_ACCESS_URL, 0, "http://www.html-tidy.org/Accessibility/" },
{ FILE_CANT_OPEN, 0, "Impossible d'ouvrir « %s »\n" }, { FILE_CANT_OPEN, 0, "Impossible d'ouvrir « %s »\n" },
{ LINE_COLUMN_STRING, 0, "Ligne: %d Col: %d - " }, { LINE_COLUMN_STRING, 0, "Ligne: %d Col: %d - " },
@ -78,7 +73,6 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
{ STRING_ERROR_COUNT_WARNING, 0, "alarme" }, { STRING_ERROR_COUNT_WARNING, 0, "alarme" },
{ STRING_ERROR_COUNT_WARNING, 1, "alarmes" }, { STRING_ERROR_COUNT_WARNING, 1, "alarmes" },
{ STRING_HELLO_ACCESS, 0, "Contrôles d'accessibilité: version 0.1" }, { STRING_HELLO_ACCESS, 0, "Contrôles d'accessibilité: version 0.1" },
{ STRING_HTML_PROPRIETARY, 0, "HTML Proprietary" },
{ STRING_MISSING_MALFORMED, 0, "argument manquant ou incorrect pour l'option: %s" }, { STRING_MISSING_MALFORMED, 0, "argument manquant ou incorrect pour l'option: %s" },
{ STRING_NO_ERRORS, 0, "Aucun avertissement ou les erreurs ne trouvées." }, { STRING_NO_ERRORS, 0, "Aucun avertissement ou les erreurs ne trouvées." },
{ STRING_NO_SYSID, 0, "Aucun identificateur de système dans le doctype émis" }, { STRING_NO_SYSID, 0, "Aucun identificateur de système dans le doctype émis" },
@ -86,9 +80,7 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
{ STRING_PLAIN_TEXT, 0, "le texte brut" }, { STRING_PLAIN_TEXT, 0, "le texte brut" },
{ STRING_REPLACING, 0, "remplaçant" }, { STRING_REPLACING, 0, "remplaçant" },
{ STRING_SPECIFIED, 0, "spécifié" }, { STRING_SPECIFIED, 0, "spécifié" },
{ STRING_UNKNOWN_FILE, 0, "%s: Impossible d'ouvrir le fichier \"%s\"\n" },
{ STRING_UNKNOWN_OPTION, 0, "option inconnue: %s" }, { STRING_UNKNOWN_OPTION, 0, "option inconnue: %s" },
{ STRING_UNRECZD_OPTION, 0, "option non reconnue -%c utiliser -help pour lister les options\n" },
{ STRING_XML_DECLARATION, 0, "déclaration XML" }, { STRING_XML_DECLARATION, 0, "déclaration XML" },
{ TEXT_HTML_T_ALGORITHM, 0, { TEXT_HTML_T_ALGORITHM, 0,
"\n" "\n"
@ -278,13 +270,13 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"vous plaît voir\n" "vous plaît voir\n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n" "https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
}, },
{ TidyInfoString, 0, "Info:" }, { TidyInfo, 0, "Info:" },
{ TidyWarningString, 0, "Attention:" }, { TidyWarning, 0, "Attention:" },
{ TidyConfigString, 0, "Config:" }, { TidyConfig, 0, "Config:" },
{ TidyAccessString, 0, "Accès:" }, { TidyAccess, 0, "Accès:" },
{ TidyErrorString, 0, "Erreur:" }, { TidyError, 0, "Erreur:" },
{ TidyBadDocumentString, 0, "Document:" }, { TidyBadDocument, 0, "Document:" },
{ TidyFatalString, 0, "Panique:" }, { TidyFatal, 0, "Panique:" },
{ ENCODING_MISMATCH, 0, "codage d'entrée spécifiée (%s) ne correspond pas réelle encodage d'entrée (%s)" }, { ENCODING_MISMATCH, 0, "codage d'entrée spécifiée (%s) ne correspond pas réelle encodage d'entrée (%s)" },
{ VENDOR_SPECIFIC_CHARS, 0, "%s de code de caractère invalide l'%s" }, { VENDOR_SPECIFIC_CHARS, 0, "%s de code de caractère invalide l'%s" },
{ INVALID_SGML_CHARS, 0, "%s de code de caractère invalide l'%s" }, { INVALID_SGML_CHARS, 0, "%s de code de caractère invalide l'%s" },
@ -457,11 +449,13 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"Cette option spécifie que Tidy doit ignorer les balises imbriquées lors de l'analyse " "Cette option spécifie que Tidy doit ignorer les balises imbriquées lors de l'analyse "
"des données de script et de style." "des données de script et de style."
}, },
{ TC_CAT_DIAGNOSTICS, 0, "diagnostics" },
{ TC_CAT_ENCODING, 0, "encoding" }, #if SUPPORT_CONSOLE_APP
{ TC_CAT_MARKUP, 0, "markup" }, { TidyDiagnostics, 0, "diagnostics" },
{ TC_CAT_MISC, 0, "misc" }, { TidyEncoding, 0, "encoding" },
{ TC_CAT_PRETTYPRINT, 0, "imprimer" }, { TidyMarkup, 0, "markup" },
{ TidyMiscellaneous, 0, "misc" },
{ TidyPrettyPrint, 0, "imprimer" },
{ TC_LABEL_COL, 0, "colonne" }, { TC_LABEL_COL, 0, "colonne" },
{ TC_LABEL_FILE, 0, "fichier" }, { TC_LABEL_FILE, 0, "fichier" },
{ TC_LABEL_LANG, 0, "lang" }, { TC_LABEL_LANG, 0, "lang" },
@ -562,6 +556,7 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"du système pour plus d'informations.\n" "du système pour plus d'informations.\n"
"\n" "\n"
}, },
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */ {/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL TIDY_MESSAGE_TYPE_LAST, 0, NULL

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_zh_cn.h` (our own * `poconvert.rb msgunfmt language_zh_cn.h` (our own
* conversion tool) to generate a fresh PO from this file first! * conversion tool) to generate a fresh PO from this file first!
* *
* (c) 2015 HTACG * (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice. * See tidy.h and access.h for the copyright notice.
* *
* Template Created by Jim Derry on 01/14/2016. * Template Created by Jim Derry on 01/14/2016.
* *
* Orginating PO file metadata: * Orginating PO file metadata:
* PO_LAST_TRANSLATOR=jderry * PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2016-03-24 10:59:55 * PO_REVISION_DATE=2017-02-17 14:46:38
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#endif #endif
#include "language.h"
#include "access.h"
#include "message.h"
/** /**
* This language-specific function returns the correct pluralForm * This language-specific function returns the correct pluralForm
@ -68,8 +64,11 @@ static languageDefinition language_zh_cn = { whichPluralForm_zh_cn, {
{ FILE_CANT_OPEN, 0, "无法打开”%s”\n" }, { FILE_CANT_OPEN, 0, "无法打开”%s”\n" },
{ LINE_COLUMN_STRING, 0, "行 %d 列 %d - " }, { LINE_COLUMN_STRING, 0, "行 %d 列 %d - " },
{ STRING_CONTENT_LOOKS, 0, "文档内容看起来像 %s" }, { STRING_CONTENT_LOOKS, 0, "文档内容看起来像 %s" },
#if SUPPORT_CONSOLE_APP
{ TC_STRING_VERS_A, 0, "HTML Tidy 用于 %s 版本 %s" }, { TC_STRING_VERS_A, 0, "HTML Tidy 用于 %s 版本 %s" },
{ TC_STRING_VERS_B, 0, "HTML Tidy 版本 %s" }, { TC_STRING_VERS_B, 0, "HTML Tidy 版本 %s" },
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */ {/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL TIDY_MESSAGE_TYPE_LAST, 0, NULL

File diff suppressed because it is too large Load diff

View file

@ -1,253 +1,119 @@
#ifndef __MESSAGE_H__ #ifndef __MESSAGE_H__
#define __MESSAGE_H__ #define __MESSAGE_H__
/* message.h -- general message writing routines /*********************************************************************
* General Message Writing Routines
(c) 1998-2007 (W3C) MIT, ERCIM, Keio University *
See tidy.h for the copyright notice. * This module handles LibTidy's high level output routines, as well
* as provides some data structures for the console application.
*/ *
* It also provides lookup functions and management for keys used
* for retrieval of these messages.
*
* LibTidy emits two general types of output:
*
* - Reports, which contain data relating to what Tidy discovered
* in your source file, and/or what Tidy did to your source file.
* In some cases general information about your source file is
* emitted as well. Reports are emitted in the current output
* buffer, but LibTidy users will probably prefer to hook into
* a callback in order to take advantage of the data that are
* available in a more flexible way.
*
* - Dialogue, consisting of general information that's not related
* to your source file in particular, is also written to the current
* output buffer when appropriate.
*
* Report information typically takes the form of a warning, an
* error, info., etc., and the output routines keep track of the
* count of these and are make them available in the API.
*
* The preferred way of handling Tidy diagnostics output is either
* - define a new output sink, or
* - use a message filter callback routine.
* *
* (c) 1998-2017 (W3C) MIT, ERCIM, Keio University, University of
* Toronto, HTACG
* See tidy.h for the copyright notice.
*********************************************************************/
#include "forward.h" #include "forward.h"
#include "tidy.h" /* For TidyReportLevel */
#include "language.h"
/* General message writing routines. /* Release Information */
** Each message is a single warning, error, etc.
**
** These routines keep track of counts and,
** if the caller has set a filter, it will be
** called. The new preferred way of handling
** Tidy diagnostics output is either a) define
** a new output sink or b) install a message
** filter routine.
**
** Keep track of ShowWarnings, ShowErrors, etc.
*/
ctmbstr TY_(ReleaseDate)(void); ctmbstr TY_(ReleaseDate)(void);
ctmbstr TY_(tidyLibraryVersion)(void);
void TY_(ReportUnknownOption)( TidyDocImpl* doc, ctmbstr option ); /* High Level Message Writing Functions - General */
void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option );
void TY_(NeedsAuthorIntervention)( TidyDocImpl* doc );
void TY_(ReportMarkupVersion)( TidyDocImpl* doc );
void TY_(ReportNumWarnings)( TidyDocImpl* doc );
void TY_(GeneralInfo)( TidyDocImpl* doc );
/* void TY_(UnknownOption)( TidyDocImpl* doc, char c ); */
/* void TY_(UnknownFile)( TidyDocImpl* doc, ctmbstr program, ctmbstr file ); */
void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level );
void TY_(ErrorSummary)( TidyDocImpl* doc );
void TY_(ReportEncodingWarning)(TidyDocImpl* doc, uint code, uint encoding);
void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded);
void TY_(ReportEntityError)( TidyDocImpl* doc, uint code, ctmbstr entity, int c );
void TY_(ReportAttrError)( TidyDocImpl* doc, Node* node, AttVal* av, uint code );
void TY_(ReportMissingAttr)( TidyDocImpl* doc, Node* node, ctmbstr name );
void TY_(ReportSurrogateError)(TidyDocImpl* doc, uint code, uint c1, uint c2);
#if SUPPORT_ACCESSIBILITY_CHECKS
void TY_(ReportAccessWarning)( TidyDocImpl* doc, Node* node, uint code );
void TY_(ReportAccessError)( TidyDocImpl* doc, Node* node, uint code );
#endif
void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code); void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code);
void TY_(ReportWarning)(TidyDocImpl* doc, Node *element, Node *node, uint code); void TY_(ReportWarning)(TidyDocImpl* doc, Node *element, Node *node, uint code);
void TY_(ReportError)(TidyDocImpl* doc, Node* element, Node* node, uint code); void TY_(ReportError)(TidyDocImpl* doc, Node* element, Node* node, uint code);
void TY_(ReportFatal)(TidyDocImpl* doc, Node* element, Node* node, uint code); void TY_(ReportFatal)(TidyDocImpl* doc, Node* element, Node* node, uint code);
/* High Level Message Writing Functions - Specific */
void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level );
void TY_(ReportAttrError)( TidyDocImpl* doc, Node* node, AttVal* av, uint code );
void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option );
void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded);
void TY_(ReportEncodingWarning)(TidyDocImpl* doc, uint code, uint encoding);
void TY_(ReportEntityError)( TidyDocImpl* doc, uint code, ctmbstr entity, int c );
void TY_(ReportMarkupVersion)( TidyDocImpl* doc );
void TY_(ReportMissingAttr)( TidyDocImpl* doc, Node* node, ctmbstr name );
void TY_(ReportSurrogateError)(TidyDocImpl* doc, uint code, uint c1, uint c2);
void TY_(ReportUnknownOption)( TidyDocImpl* doc, ctmbstr option );
#if SUPPORT_ACCESSIBILITY_CHECKS
void TY_(ReportAccessError)( TidyDocImpl* doc, Node* node, uint code );
void TY_(ReportAccessWarning)( TidyDocImpl* doc, Node* node, uint code );
#endif
/* Output Dialogue Information */
void TY_(ErrorSummary)( TidyDocImpl* doc );
void TY_(GeneralInfo)( TidyDocImpl* doc );
void TY_(NeedsAuthorIntervention)( TidyDocImpl* doc );
void TY_(ReportNumWarnings)( TidyDocImpl* doc );
/** @name Key Discovery */
/** @{ */
/** /**
* These tidyErrorCodes are used throughout libtidy, and also * LibTidy users may want to use `TidyReportFilter3` to enable their own
* have associated localized strings to describe them. * localization lookup features. Because Tidy's errors codes are enums the
* * specific values can change over time. This function returns a string
* IMPORTANT: to maintain compatability with TidyMessageFilter3, if you add * representing the enum value name that can be used as a lookup key
* or remove keys from this enum, ALSO add/remove the corresponding key * independent of changing string values (TidyReportFiler2 is vulnerable
* in language.c:tidyErrorFilterKeysStruct[]! * to changing strings). `TidyReportFilter3` will return this general
* string as the error message indicator.
*/ */
typedef enum { ctmbstr TY_(tidyErrorCodeAsKey)(uint code);
/* This MUST be present and first. */
CODES_TIDY_ERROR_FIRST = 200,
/* error codes for entities/numeric character references */
MISSING_SEMICOLON,
MISSING_SEMICOLON_NCR,
UNKNOWN_ENTITY,
UNESCAPED_AMPERSAND,
APOS_UNDEFINED,
/* error codes for element messages */
MISSING_ENDTAG_FOR,
MISSING_ENDTAG_BEFORE,
DISCARDING_UNEXPECTED,
NESTED_EMPHASIS,
NON_MATCHING_ENDTAG,
TAG_NOT_ALLOWED_IN,
MISSING_STARTTAG,
UNEXPECTED_ENDTAG,
USING_BR_INPLACE_OF,
INSERTING_TAG,
SUSPECTED_MISSING_QUOTE,
MISSING_TITLE_ELEMENT,
DUPLICATE_FRAMESET,
CANT_BE_NESTED,
OBSOLETE_ELEMENT,
PROPRIETARY_ELEMENT,
ELEMENT_VERS_MISMATCH_ERROR,
ELEMENT_VERS_MISMATCH_WARN,
UNKNOWN_ELEMENT,
TRIM_EMPTY_ELEMENT,
COERCE_TO_ENDTAG,
ILLEGAL_NESTING,
NOFRAMES_CONTENT,
CONTENT_AFTER_BODY,
INCONSISTENT_VERSION,
MALFORMED_COMMENT,
BAD_COMMENT_CHARS,
BAD_XML_COMMENT,
BAD_CDATA_CONTENT,
INCONSISTENT_NAMESPACE,
DOCTYPE_AFTER_TAGS,
MALFORMED_DOCTYPE,
UNEXPECTED_END_OF_FILE,
DTYPE_NOT_UPPER_CASE,
TOO_MANY_ELEMENTS,
UNESCAPED_ELEMENT,
NESTED_QUOTATION,
ELEMENT_NOT_EMPTY,
ENCODING_IO_CONFLICT,
MIXED_CONTENT_IN_BLOCK,
MISSING_DOCTYPE,
SPACE_PRECEDING_XMLDECL,
TOO_MANY_ELEMENTS_IN,
UNEXPECTED_ENDTAG_IN,
REPLACING_ELEMENT,
REPLACING_UNEX_ELEMENT,
COERCE_TO_ENDTAG_WARN,
/* error codes used for attribute messages */
UNKNOWN_ATTRIBUTE,
INSERTING_ATTRIBUTE,
INSERTING_AUTO_ATTRIBUTE,
MISSING_ATTR_VALUE,
BAD_ATTRIBUTE_VALUE,
UNEXPECTED_GT,
PROPRIETARY_ATTRIBUTE,
MISMATCHED_ATTRIBUTE_ERROR,
MISMATCHED_ATTRIBUTE_WARN,
PROPRIETARY_ATTR_VALUE,
REPEATED_ATTRIBUTE,
MISSING_IMAGEMAP,
XML_ATTRIBUTE_VALUE,
UNEXPECTED_QUOTEMARK,
MISSING_QUOTEMARK,
ID_NAME_MISMATCH,
BACKSLASH_IN_URI,
FIXED_BACKSLASH,
ILLEGAL_URI_REFERENCE,
ESCAPED_ILLEGAL_URI,
NEWLINE_IN_URI,
ANCHOR_NOT_UNIQUE,
JOINING_ATTRIBUTE,
UNEXPECTED_EQUALSIGN,
ATTR_VALUE_NOT_LCASE,
XML_ID_SYNTAX,
INVALID_ATTRIBUTE,
BAD_ATTRIBUTE_VALUE_REPLACED,
INVALID_XML_ID,
UNEXPECTED_END_OF_FILE_ATTR,
MISSING_ATTRIBUTE,
WHITE_IN_URI,
REMOVED_HTML5, /* this element removed from HTML5 */
BAD_SUMMARY_HTML5, /* use of summary attr removed from HTML5 */
PREVIOUS_LOCATION, /* last */
/* character encoding errors */
VENDOR_SPECIFIC_CHARS,
INVALID_SGML_CHARS,
INVALID_UTF8,
INVALID_UTF16,
ENCODING_MISMATCH,
INVALID_URI,
INVALID_NCR,
BAD_SURROGATE_PAIR,
BAD_SURROGATE_TAIL,
BAD_SURROGATE_LEAD,
/* This MUST be present and last. */
CODES_TIDY_ERROR_LAST
} tidyErrorCodes;
/** /**
* These tidyMessagesMisc are used throughout libtidy, and also * Initializes the TidyIterator to point to the first item
* have associated localized strings to describe them. * in Tidy's list of error codes that can be return with
* `TidyReportFilter3`.
* Items can be retrieved with getNextErrorCode();
*/ */
typedef enum { TidyIterator TY_(getErrorCodeList)();
ACCESS_URL = 2048, /* Used to point to Web Accessibility Guidelines. */
ATRC_ACCESS_URL, /* Points to Tidy's accessibility page. */ /**
FILE_CANT_OPEN, /* For retrieving a string when a file can't be opened. */ * Returns the next error code having initialized the iterator
LINE_COLUMN_STRING, /* For retrieving localized `line %d column %d` text. */ * with `getErrorCodeList()`. You can use tidyErrorCodeAsKey
STRING_CONTENT_LOOKS, /* `Document content looks like %s`. */ * to determine the key for this value.
STRING_DISCARDING, /* For `discarding`. */ */
STRING_DOCTYPE_GIVEN, /* `Doctype given is \"%s\". */ uint TY_(getNextErrorCode)( TidyIterator* iter );
STRING_ERROR_COUNT, /* `%u %s, %u %s were found!`. */
STRING_ERROR_COUNT_ERROR, /* `error` and `errors`. */
STRING_ERROR_COUNT_WARNING, /* `warning` and `warnings`. */ /** @} */
STRING_HELLO_ACCESS, /* Accessibility hello message. */
STRING_HTML_PROPRIETARY, /* `HTML Proprietary`/ */
STRING_MISSING_MALFORMED, /* For `missing or malformed argument for option: %s`. */
STRING_NO_ERRORS, /* `No warnings or errors were found.\n\n`. */
STRING_NO_SYSID, /* `No system identifier in emitted doctype`. */
STRING_NOT_ALL_SHOWN, /* ` Not all warnings/errors were shown.\n\n`. */
STRING_PLAIN_TEXT, /* For retrieving a string `plain text`. */
STRING_REPLACING, /* For `replacing`. */
STRING_SPECIFIED, /* For `specified`. */
STRING_UNKNOWN_FILE, /* `%s: can't open file \"%s\"\n`. */
STRING_UNKNOWN_OPTION, /* For retrieving a string `unknown option: %s`. */
STRING_UNRECZD_OPTION, /* `unrecognized option -%c use -help to list options\n`. */
STRING_XML_DECLARATION, /* For retrieving a string `XML declaration`. */
TEXT_ACCESS_ADVICE1, /* Explanatory text. */
TEXT_ACCESS_ADVICE2, /* Explanatory text. */
TEXT_BAD_FORM, /* Explanatory text. */
TEXT_BAD_MAIN, /* Explanatory text. */
TEXT_GENERAL_INFO, /* Explanatory text. */
TEXT_GENERAL_INFO_PLEA, /* Explanatory text. */
TEXT_HTML_T_ALGORITHM, /* Paragraph for describing the HTML table algorithm. */
TEXT_INVALID_URI, /* Explanatory text. */
TEXT_INVALID_UTF16, /* Explanatory text. */
TEXT_INVALID_UTF8, /* Explanatory text. */
TEXT_M_IMAGE_ALT, /* Explanatory text. */
TEXT_M_IMAGE_MAP, /* Explanatory text. */
TEXT_M_LINK_ALT, /* Explanatory text. */
TEXT_M_SUMMARY, /* Explanatory text. */
TEXT_NEEDS_INTERVENTION, /* Explanatory text. */
TEXT_SGML_CHARS, /* Explanatory text. */
TEXT_USING_BODY, /* Explanatory text. */
TEXT_USING_FONT, /* Explanatory text. */
TEXT_USING_FRAMES, /* Explanatory text. */
TEXT_USING_LAYER, /* Explanatory text. */
TEXT_USING_NOBR, /* Explanatory text. */
TEXT_USING_SPACER, /* Explanatory text. */
TEXT_VENDOR_CHARS, /* Explanatory text. */
TEXT_WINDOWS_CHARS /* Explanatory text. */
} tidyMessagesMisc;
/* accessibility flaws */ /* accessibility flaws */

View file

@ -31,6 +31,7 @@
#include "tmbstr.h" #include "tmbstr.h"
#include "utf8.h" #include "utf8.h"
#include "mappedio.h" #include "mappedio.h"
#include "language.h"
#ifdef TIDY_WIN32_MLANG_SUPPORT #ifdef TIDY_WIN32_MLANG_SUPPORT
#include "win32tc.h" #include "win32tc.h"
@ -211,6 +212,11 @@ ctmbstr TIDY_CALL tidyReleaseDate(void)
return TY_(ReleaseDate)(); return TY_(ReleaseDate)();
} }
ctmbstr TIDY_CALL tidyLibraryVersion(void)
{
return TY_(tidyLibraryVersion)();
}
/* Get/set configuration options /* Get/set configuration options
*/ */
@ -519,6 +525,8 @@ ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc ARG_UNUSED(tdoc), TidyOption opt )
return tidyLocalizedString(optId); return tidyLocalizedString(optId);
} }
#if SUPPORT_CONSOLE_APP
/* TODO - GROUP ALL CONSOLE-ONLY FUNCTIONS */
TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc ARG_UNUSED(tdoc), TidyOption opt ) TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc ARG_UNUSED(tdoc), TidyOption opt )
{ {
const TidyOptionId optId = tidyOptGetId( opt ); const TidyOptionId optId = tidyOptGetId( opt );
@ -527,6 +535,7 @@ TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc ARG_UNUSED(tdoc), TidyOpt
return (TidyIterator)docDesc->links; return (TidyIterator)docDesc->links;
return (TidyIterator)NULL; return (TidyIterator)NULL;
} }
#endif /* SUPPORT_CONSOLE_APP */
TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc, TidyIterator* pos ) TidyOption TIDY_CALL tidyOptGetNextDocLinks( TidyDoc tdoc, TidyIterator* pos )
{ {
@ -675,7 +684,7 @@ Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc, TidyReportFilter2 filt
/* TidyReportFilter3 functions similar to TidyReportFilter, but provides the /* TidyReportFilter3 functions similar to TidyReportFilter, but provides the
* string version of the internal enum name so that LibTidy users can use * string version of the internal enum name so that LibTidy users can use
** the string as a lookup key for providing their own error localizations. ** the string as a lookup key for providing their own error localizations.
** See the string definitions in language.h ** See the string key definitions in tidyenum.h.
*/ */
Bool TIDY_CALL tidySetReportFilter3( TidyDoc tdoc, TidyReportFilter3 filt ) Bool TIDY_CALL tidySetReportFilter3( TidyDoc tdoc, TidyReportFilter3 filt )
{ {
@ -2346,6 +2355,115 @@ Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr )
return no; return no;
} }
/*******************************************************************
** Message Key Management
*******************************************************************/
ctmbstr TIDY_CALL tidyErrorCodeAsKey(uint code)
{
return TY_(tidyErrorCodeAsKey)( code );
}
TidyIterator TIDY_CALL getErrorCodeList()
{
return TY_(getErrorCodeList)();
}
uint TIDY_CALL getNextErrorCode( TidyIterator* iter )
{
return TY_(getNextErrorCode)(iter);
}
/*******************************************************************
** Localization Support
*******************************************************************/
tmbstr TIDY_CALL tidySystemLocale(tmbstr result)
{
return TY_(tidySystemLocale)( result );
}
Bool TIDY_EXPORT tidySetLanguage( ctmbstr languageCode )
{
return TY_(tidySetLanguage)( languageCode );
}
ctmbstr TIDY_EXPORT tidyGetLanguage()
{
return TY_(tidyGetLanguage)();
}
ctmbstr TIDY_CALL tidyLocalizedStringN( uint messageType, uint quantity )
{
return TY_(tidyLocalizedStringN)( messageType, quantity);
}
ctmbstr TIDY_CALL tidyLocalizedString( uint messageType )
{
return TY_(tidyLocalizedString)( messageType );
}
ctmbstr TIDY_CALL tidyDefaultString( uint messageType )
{
return TY_(tidyDefaultString)( messageType );
}
TidyIterator TIDY_CALL getStringKeyList()
{
return TY_(getStringKeyList)();
}
uint TIDY_CALL getNextStringKey( TidyIterator* iter )
{
return TY_(getNextStringKey)( iter );
}
TidyIterator TIDY_CALL getWindowsLanguageList()
{
return TY_(getWindowsLanguageList)();
}
//#define tidyOptionToImpl( topt ) ((const TidyOptionImpl*)(topt))
//#define tidyImplToOption( option ) ((TidyOption)(option))
const tidyLocaleMapItem* TIDY_CALL getNextWindowsLanguage( TidyIterator* iter )
{
/* Get a real structure */
const tidyLocaleMapItemImpl *item = TY_(getNextWindowsLanguage)( iter );
/* Return it as the opaque version */
return ((tidyLocaleMapItem*)(item));
}
const ctmbstr TIDY_CALL TidyLangWindowsName( const tidyLocaleMapItem *item )
{
return TY_(TidyLangWindowsName)( (tidyLocaleMapItemImpl*)(item) );
}
const ctmbstr TIDY_CALL TidyLangPosixName( const tidyLocaleMapItem *item )
{
return TY_(TidyLangPosixName)( (tidyLocaleMapItemImpl*)(item) );
}
TidyIterator TIDY_CALL getInstalledLanguageList()
{
return TY_(getInstalledLanguageList)();
}
ctmbstr TIDY_CALL getNextInstalledLanguage( TidyIterator* iter )
{
return TY_(getNextInstalledLanguage)( iter );
}
/* /*
* local variables: * local variables:
* mode: c * mode: c