Several foundational changes preparing for release of 5.4 and future 5.5:

- Consolidated all output string definitions enums into `tidyenum.h`, which
    is where they belong, and where they have proper visibility.
  - Re-arranged `messages.c/h` with several comments useful to developers.
  - Properly added the key lookup functions and the language localization
    functions into tidy.h/tidylib.c with proper name-spacing.
  - Previous point restored a *lot* of sanity to the #include pollution that's
    been introduced in light of these.
  - Note that opaque types have been (properly) introduced. Look at the updated
    headers for `language.h`. In particular only an opaque structure is passed
    outside of LibTidy, and so use TidyLangWindowsName and TidyLangPosixName
    to poll these objects.
  - Console application updated as a result of this.
  - Removed dead code:
    - void TY_(UnknownOption)( TidyDocImpl* doc, char c );
    - void TY_(UnknownFile)( TidyDocImpl* doc, ctmbstr program, ctmbstr file );
  - Redundant strings were removed with the removal of this dead code.
  - Several enums were given fixed starting values. YOUR PROGRAMS SHOULD NEVER
    depend on enum values. `TidyReportLevel` is an example of such.
  - Some enums were removed as a result of this. `TidyReportLevel` now has
    matching strings, so the redundant `TidyReportLevelStrings` was removed.
  - All of the PO's and language header files were regenerated as a result of
    the string cleanup and header cleanup.
  - Made the interface to the library version and release date consistent.
  - CMakeLists.txt now supports SUPPORT_CONSOLE_APP. The intention is to
    be able to remove console-only code from LibTidy (for LibTidy users).
  - Updated README/MESSAGES.md, which is *vastly* more simple now.
This commit is contained in:
Jim Derry 2017-02-13 14:29:47 -05:00
parent 0bd6ba30b4
commit 165acc4f3e
28 changed files with 3700 additions and 2808 deletions

View file

@ -60,6 +60,16 @@ else ()
add_definitions ( -DSUPPORT_LOCALIZATIONS=0 )
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)
set( WARNING_FLAGS -Wall )
endif(CMAKE_COMPILER_IS_GNUCXX)
@ -136,7 +146,7 @@ set ( CFILES
${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c
${SRCDIR}/language.c )
${SRCDIR}/language.c )
set ( HFILES
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
${INCDIR}/tidybuffio.h )
@ -214,18 +224,20 @@ endif ()
##########################################################
### main executable - linked with STATIC/SHARED library
set(name ${LIB_NAME})
set ( BINDIR console )
add_executable( ${name} ${BINDIR}/tidy.c )
target_link_libraries( ${name} ${add_LIBS} )
if (MSVC)
set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d )
if (SUPPORT_CONSOLE_APP)
set(name ${LIB_NAME})
set ( BINDIR console )
add_executable( ${name} ${BINDIR}/tidy.c )
target_link_libraries( ${name} ${add_LIBS} )
if (MSVC)
set_target_properties( ${name} PROPERTIES DEBUG_POSTFIX d )
endif ()
if (NOT TIDY_CONSOLE_SHARED)
set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DTIDY_STATIC" )
endif ()
install (TARGETS ${name} DESTINATION bin)
endif ()
if (NOT TIDY_CONSOLE_SHARED)
set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DTIDY_STATIC" )
endif ()
install (TARGETS ${name} DESTINATION bin)
if (BUILD_TAB2SPACE)
set(name tab2space)
@ -250,7 +262,7 @@ endif ()
#==========================================================
# Create man pages
#==========================================================
if (UNIX)
if (UNIX AND SUPPORT_CONSOLE_APP)
find_program( XSLTPROC_FOUND xsltproc )
if (XSLTPROC_FOUND)
## NOTE: man name must match exe ie currently `${LIB_NAME}.1` not `tidy.1`

View file

@ -2,40 +2,28 @@
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.
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.
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.
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
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
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.
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.
Depending on which of the output routines you use (consult `message.c`) you may be able to use parameters such as `%u` and `%s` in your format strings. The available data is currently limited to the available message output routines, but perhaps generalizing this in order to make more data available will be a nice focus of Tidy 5.5. Please don't use `printf` for message output within **libTidy**.
In this case I want to add showing the code point(s) in hex, so I need to add that also. **(jim --??)**
eof;

View file

@ -9,7 +9,6 @@
*/
#include "tidy.h"
#include "language.h"
#include "locale.h"
#if defined(_WIN32)
#include <windows.h> /* Force console to UTF8. */
@ -554,19 +553,9 @@ static Bool isAutoBool( TidyOption topt )
*/
static ctmbstr ConfigCategoryName( TidyConfigCategory id )
{
switch( 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 );
}
if (id >= TidyMarkup && id <= TidyMiscellaneous)
return tidyLocalizedString(id);
fprintf(stderr, tidyLocalizedString(TC_STRING_FATAL_ERROR), (int)id);
fprintf(stderr, "\n");
@ -884,13 +873,17 @@ void tidyPrintWindowsLanguageNames( ctmbstr format )
{
const tidyLocaleMapItem *item;
TidyIterator i = getWindowsLanguageList();
ctmbstr winName;
ctmbstr posixName;
while (i) {
item = getNextWindowsLanguage(&i);
winName = TidyLangWindowsName( item );
posixName = TidyLangPosixName( item );
if ( format )
printf( format, item->winName, item->POSIXName );
printf( format, winName, posixName );
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 )
{
const tidyErrorFilterKeyItem *item;
uint errorCode;
ctmbstr localizedString;
TidyIterator j = getErrorCodeList();
@ -1432,10 +1425,10 @@ static void xml_error_strings( TidyDoc tdoc )
printf( "<error_strings version=\"%s\">\n", tidyLibraryVersion());
while (j) {
item = getNextErrorCode(&j);
localizedString = tidyLocalizedString(item->value);
errorCode = getNextErrorCode(&j);
localizedString = tidyLocalizedString(errorCode);
printf( " <error_string>\n" );
printf( " <name>%s</name>\n",item->key);
printf( " <name>%s</name>\n", tidyErrorCodeAsKey(errorCode));
if ( localizedString )
printf( " <string class=\"%s\"><![CDATA[%s]]></string>\n", tidyGetLanguage(), localizedString );
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
** diff the language header files directly.
** **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 )
{
@ -1465,6 +1460,7 @@ static void xml_strings( void )
TidyIterator j;
ctmbstr current_language = tidyGetLanguage();
ctmbstr current_label;
Bool skip_current = strcmp( current_language, "en" ) == 0;
Bool matches_base;
@ -1474,7 +1470,10 @@ static void xml_strings( void )
j = getStringKeyList();
while (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("%s", tidyDefaultString(i));
printf( "</string>\n" );

View file

@ -1,15 +1,11 @@
#ifndef __TIDY_H__
#define __TIDY_H__
/** @file tidy.h - Defines HTML Tidy API implemented by tidy library.
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.
/** @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 without changing the
interface.
Copyright (c) 1998-2016 World Wide Web Consortium
(Massachusetts Institute of Technology, European Research
@ -20,45 +16,43 @@
Dave Raggett <dsr@w3.org>
The contributing author(s) would like to thank all those who
helped with testing, bug fixes and suggestions for improvements.
This wouldn't have been possible without your help.
The contributing author(s) would like to thank all those who helped with
testing, bug fixes and suggestions for improvements. This wouldn't have been
possible without your help.
COPYRIGHT NOTICE:
This software and documentation is provided "as is," and
the copyright holders and contributing author(s) make no
representations or warranties, express or implied, including
but not limited to, warranties of merchantability or fitness
for any particular purpose or that the use of the software or
documentation will not infringe any third party patents,
copyrights, trademarks or other rights.
This software and documentation is provided "as is," and the copyright holders
and contributing author(s) make no representations or warranties, express or
implied, including but not limited to, warranties of merchantability or
fitness for any particular purpose or that the use of the software or
documentation will not infringe any third party patents, copyrights,
trademarks or other rights.
The copyright holders and contributing author(s) will not be held
liable for any direct, indirect, special or consequential damages
arising out of any use of the software or documentation, even if
advised of the possibility of such damage.
The copyright holders and contributing author(s) will not be held liable for
any direct, indirect, special or consequential damages arising out of any use
of the software or documentation, even if advised of the possibility of such
damage.
Permission is hereby granted to use, copy, modify, and distribute
this source code, or portions hereof, documentation and executables,
for any purpose, without fee, subject to the following restrictions:
Permission is hereby granted to use, copy, modify, and distribute this source
code, or portions hereof, documentation and executables, for any purpose,
without fee, subject to the following restrictions:
1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must
not be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any
source or 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.
2. Altered versions must be plainly marked as such and must not be
misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any source or
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.
Created 2001-05-20 by Charles Reitzel
Updated 2002-07-01 by Charles Reitzel - 1st Implementation
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
**
** 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.
** 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 */
TIDY_STRUCT struct _TidyBuffer;
typedef struct _TidyBuffer TidyBuffer;
/** @defgroup Memory Memory Allocation
**
** Tidy uses a user provided allocator for all
** memory allocations. If this allocator is
** not provided, then a default allocator is
** used which simply wraps standard C malloc/free
** calls. These wrappers call the panic function
** upon any failure. The default panic function
** prints an out of memory message to stderr, and
** calls exit(2).
** Tidy uses a user provided allocator for all memory allocations. If this
** allocator is not provided, then a default allocator is used which simply
** wraps standard C malloc/free calls. These wrappers call the panic function
** 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
** abort in the case of memory allocation, then the
** panic function can be replaced with one which
** longjmps() out of the tidy code. For this to
** clean up completely, you should be careful not
** to use any tidy methods that open files as these
** will not be closed before panic() is called.
** For applications in which it is unacceptable to abort in the case of memory
** allocation, then the panic function can be replaced with one which longjmps()
** out of the LibTidy code. For this to clean up completely, you should be
** careful not 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
** ensure that tidyDocRelease() can close them all.
** TODO: associate file handles with tidyDoc and ensure that tidyDocRelease()
** can close them all.
**
** Calling the withAllocator() family (
** tidyCreateWithAllocator, tidyBufInitWithAllocator,
** tidyBufAllocWithAllocator) allow settings custom
** allocators).
** Calling the xWithAllocator() family (tidyCreateWithAllocator,
** tidyBufInitWithAllocator, tidyBufAllocWithAllocator) allow setting custom
** allocators.
**
** All parts of the document use the same allocator.
** Calls that require a user provided buffer can
** optionally use a different allocator.
** All parts of the document use the same allocator. Calls that require a user
** provided buffer can optionally use a different allocator.
**
** For reference in designing a plug-in allocator,
** most allocations made by tidy are less than 100
** bytes, corresponding to attribute names/values, etc.
** For reference in designing a plug-in allocator, most allocations made by
** LibTidy are less than 100 bytes, corresponding to attribute names and
** values, etc.
**
** There is also an additional class of much larger
** allocations which are where most of the data from
** the lexer is stored. (It is not currently possible
** to use a separate allocator for the lexer, this
** would be a useful extension).
** There is also an additional class of much larger allocations which are where
** most of the data from the lexer is stored. It is not currently possible to
** use a separate allocator for the lexer; this would be a useful extension.
**
** In general, approximately 1/3rd of the memory
** used by tidy is freed during the parse, so if
** memory usage is an issue then an allocator that
** can reuse this memory is a good idea.
** In general, approximately 1/3rd of the memory used by LibTidy is freed during
** the parse, so if memory usage is an issue then an allocator that can reuse
** this memory is a good idea.
**
** @{
*/
@ -161,8 +152,7 @@ struct _TidyAllocator;
/** The allocator **/
typedef struct _TidyAllocator TidyAllocator;
/** An allocator's function table. All functions here must
be provided.
/** An allocator's function table. All functions here must be provided.
*/
struct _TidyAllocatorVtbl {
/** 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 );
/** Called to free a previously allocated block of memory */
void (TIDY_CALL *free)( TidyAllocator *self, void *block);
/** Called when a panic condition is detected. Must support
block == NULL. This function is not called if either alloc
or realloc fails; it is up to the allocator to do this.
Currently this function can only be called if an error is
detected in the tree integrity via the internal function
CheckNodeIntegrity(). This is a situation that can
only arise in the case of a programming error in tidylib.
You can turn off node integrity checking by defining
the constant NO_NODE_INTEGRITY_CHECK during the build.
/** Called when a panic condition is detected. Must support block == NULL.
This function is not called if either alloc or realloc fails; it is up
to the allocator to do this. Currently this function can only be called
if an error is detected in the tree integrity via the internal function
CheckNodeIntegrity(). This is a situation that can only arise in the
case of a programming error in LibTidy. You can turn off node integrity
checking by defining the constant NO_NODE_INTEGRITY_CHECK during the
build.
**/
void (TIDY_CALL *panic)( TidyAllocator *self, ctmbstr msg );
};
@ -249,73 +238,20 @@ TIDY_EXPORT Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic );
/** @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.
** This must be the first call before most of the Tidy API which require the TidyDoc parameter.
** When completed tidyRelease( TidyDoc tdoc ); should be called to release all memory
/** The primary creation of a TidyDoc. This must be the first call before most
** of the Tidy API which require the TidyDoc parameter. When completed,
** tidyRelease( TidyDoc tdoc ); should be called to release all memory
*/
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 );
/** 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);
/** Get version number for the current library */
@ -1138,6 +1071,137 @@ TIDY_EXPORT TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod );
/** @} 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
} /* extern "C" */
#endif

View file

@ -1,18 +1,31 @@
#ifndef __TIDYENUM_H__
#define __TIDYENUM_H__
/** @file tidyenum.h - Separated public enumerations header
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.
Created 2001-05-20 by Charles Reitzel
Updated 2002-07-01 by Charles Reitzel - 1st Implementation
*/
/*********************************************************************
* Separated public enumerations header
*
* Simplifies enum re-use in various wrappers, e.g. SWIG, generated
* wrappers, and COM IDL files.
*
* This file also contains macros to generate additional enums for
* use in Tidy's language localizations. See detailed information in
* comments.
*
* Enumeration use: LibTidy does *not* guarantee the integer value
* of any enumeration label, including the starting integer value.
* Always use enums by label in your code, and never by value.
*
* Enums that have starting values have starting values for a good
* reason, mainly to prevent message overlap, because many of these
* enums are used for string retrieval.
*
* (c) 1998-2017 (W3C) MIT, ERCIM, Keio University, HTACG
* See tidy.h for the full copyright notice.
*
* Created 2001-05-20 by Charles Reitzel
* Updated 2002-07-01 by Charles Reitzel - 1st Implementation
* Further modifications: consult git log.
*********************************************************************/
#ifdef __cplusplus
extern "C" {
@ -21,11 +34,13 @@ extern "C" {
/* 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
{
TidyMarkup, /**< Markup options: (X)HTML version, etc */
TidyMarkup = 300, /**< Markup options: (X)HTML version, etc */
TidyDiagnostics, /**< Diagnostics */
TidyPrettyPrint, /**< Output layout */
TidyEncoding, /**< Character encodings */
@ -37,127 +52,124 @@ typedef enum
These TidyOptionId are used throughout libtidy, and also
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
{
TidyUnknownOption, /**< Unknown option! */
TidyIndentSpaces, /**< Indentation n spaces/tabs */
TidyWrapLen, /**< Wrap margin */
TidyTabSize, /**< Expand tabs to n spaces */
TidyUnknownOption = 0, /**< Unknown option! */
TidyIndentSpaces, /**< Indentation n spaces/tabs */
TidyWrapLen, /**< Wrap margin */
TidyTabSize, /**< Expand tabs to n spaces */
TidyCharEncoding, /**< In/out character encoding */
TidyInCharEncoding, /**< Input character encoding (if different) */
TidyOutCharEncoding, /**< Output character encoding (if different) */
TidyNewline, /**< Output line ending (default to platform) */
TidyCharEncoding, /**< In/out character encoding */
TidyInCharEncoding, /**< Input character encoding (if different) */
TidyOutCharEncoding, /**< Output character encoding (if different) */
TidyNewline, /**< Output line ending (default to platform) */
TidyDoctypeMode, /**< See doctype property */
TidyDoctype, /**< User specified doctype */
TidyDoctypeMode, /**< See doctype property */
TidyDoctype, /**< User specified doctype */
TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */
TidyAltText, /**< Default text for alt attribute */
TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */
TidyAltText, /**< Default text for alt attribute */
/* obsolete */
TidySlideStyle, /**< Style sheet for slides: not used for anything yet */
TidySlideStyle, /**< Style sheet for slides: not used for anything yet */
TidyErrFile, /**< File name to write errors to */
TidyOutFile, /**< File name to write markup to */
TidyWriteBack, /**< If true then output tidied markup */
TidyShowMarkup, /**< If false, normal output is suppressed */
TidyShowInfo, /**< If true, info-level messages are shown */
TidyShowWarnings, /**< However errors are always shown */
TidyQuiet, /**< No 'Parsing X', guessed DTD or summary */
TidyIndentContent, /**< Indent content of appropriate tags */
/**< "auto" does text/block level content indentation */
TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */
TidyOmitOptionalTags,/**< Suppress optional start tags and end tags */
TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */
TidyXmlTags, /**< Treat input as XML */
TidyXmlOut, /**< Create output as XML */
TidyXhtmlOut, /**< Output extensible HTML */
TidyHtmlOut, /**< Output plain HTML, even for XHTML input.
Yes means set explicitly. */
TidyXmlDecl, /**< Add <?xml?> for XML docs */
TidyUpperCaseTags, /**< Output tags in upper not lower case */
TidyUpperCaseAttrs, /**< Output attributes in upper not lower case */
TidyMakeBare, /**< Make bare HTML: remove Microsoft cruft */
TidyMakeClean, /**< Replace presentational clutter by style rules */
TidyGDocClean, /**< Clean up HTML exported from Google Docs */
TidyLogicalEmphasis, /**< Replace i by em and b by strong */
TidyDropPropAttrs, /**< Discard proprietary attributes */
TidyDropFontTags, /**< Discard presentation tags */
TidyDropEmptyElems, /**< Discard empty elements */
TidyDropEmptyParas, /**< Discard empty p elements */
TidyFixComments, /**< Fix comments with adjacent hyphens */
TidyBreakBeforeBR, /**< Output newline before <br> or not? */
TidyErrFile, /**< File name to write errors to */
TidyOutFile, /**< File name to write markup to */
TidyWriteBack, /**< If true then output tidied markup */
TidyShowMarkup, /**< If false, normal output is suppressed */
TidyShowInfo, /**< If true, info-level messages are shown */
TidyShowWarnings, /**< However errors are always shown */
TidyQuiet, /**< No 'Parsing X', guessed DTD or summary */
TidyIndentContent, /**< Indent content of appropriate tags */
/**< "auto" does text/block level content indentation */
TidyCoerceEndTags, /**< Coerce end tags from start tags where probably intended */
TidyOmitOptionalTags, /**< Suppress optional start tags and end tags */
TidyHideEndTags, /**< Legacy name for TidyOmitOptionalTags */
TidyXmlTags, /**< Treat input as XML */
TidyXmlOut, /**< Create output as XML */
TidyXhtmlOut, /**< Output extensible HTML */
TidyHtmlOut, /**< Output plain HTML, even for XHTML input.
Yes means set explicitly. */
TidyXmlDecl, /**< Add <?xml?> for XML docs */
TidyUpperCaseTags, /**< Output tags in upper not lower case */
TidyUpperCaseAttrs, /**< Output attributes in upper not lower case */
TidyMakeBare, /**< Make bare HTML: remove Microsoft cruft */
TidyMakeClean, /**< Replace presentational clutter by style rules */
TidyGDocClean, /**< Clean up HTML exported from Google Docs */
TidyLogicalEmphasis, /**< Replace i by em and b by strong */
TidyDropPropAttrs, /**< Discard proprietary attributes */
TidyDropFontTags, /**< Discard presentation tags */
TidyDropEmptyElems, /**< Discard empty elements */
TidyDropEmptyParas, /**< Discard empty p elements */
TidyFixComments, /**< Fix comments with adjacent hyphens */
TidyBreakBeforeBR, /**< Output newline before <br> or not? */
/* obsolete */
TidyBurstSlides, /**< Create slides on each h2 element */
TidyBurstSlides, /**< Create slides on each h2 element */
TidyNumEntities, /**< Use numeric entities */
TidyQuoteMarks, /**< Output " marks as &quot; */
TidyQuoteNbsp, /**< Output non-breaking space as entity */
TidyQuoteAmpersand, /**< Output naked ampersand as &amp; */
TidyWrapAttVals, /**< Wrap within attribute values */
TidyWrapScriptlets, /**< Wrap within JavaScript string literals */
TidyWrapSection, /**< Wrap within <![ ... ]> section tags */
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
TidyWrapJste, /**< Wrap within JSTE pseudo elements */
TidyWrapPhp, /**< Wrap within PHP pseudo elements */
TidyFixBackslash, /**< Fix URLs by replacing \ with / */
TidyIndentAttributes,/**< Newline+indent before each attribute */
TidyXmlPIs, /**< If set to yes PIs must end with ?> */
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */
TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */
TidyEncloseBlockText,/**< If yes text in blocks is wrapped in P's */
TidyKeepFileTimes, /**< If yes last modied time is preserved */
TidyWord2000, /**< Draconian cleaning for Word2000 */
TidyMark, /**< Add meta element indicating tidied doc */
TidyEmacs, /**< If true format error output for GNU Emacs */
TidyEmacsFile, /**< Name of current Emacs file */
TidyLiteralAttribs, /**< If true attributes may use newlines */
TidyBodyOnly, /**< Output BODY content only */
TidyFixUri, /**< Applies URI encoding if necessary */
TidyLowerLiterals, /**< Folds known attribute values to lower case */
TidyHideComments, /**< Hides all (real) comments in output */
TidyIndentCdata, /**< Indent <!CDATA[ ... ]]> section */
TidyForceOutput, /**< Output document even if errors were found */
TidyShowErrors, /**< Number of errors to put out */
TidyAsciiChars, /**< Convert quotes and dashes to nearest ASCII char */
TidyJoinClasses, /**< Join multiple class attributes */
TidyJoinStyles, /**< Join multiple style attributes */
TidyEscapeCdata, /**< Replace <![CDATA[]]> sections with escaped text */
TidyNumEntities, /**< Use numeric entities */
TidyQuoteMarks, /**< Output " marks as &quot; */
TidyQuoteNbsp, /**< Output non-breaking space as entity */
TidyQuoteAmpersand, /**< Output naked ampersand as &amp; */
TidyWrapAttVals, /**< Wrap within attribute values */
TidyWrapScriptlets, /**< Wrap within JavaScript string literals */
TidyWrapSection, /**< Wrap within <![ ... ]> section tags */
TidyWrapAsp, /**< Wrap within ASP pseudo elements */
TidyWrapJste, /**< Wrap within JSTE pseudo elements */
TidyWrapPhp, /**< Wrap within PHP pseudo elements */
TidyFixBackslash, /**< Fix URLs by replacing \ with / */
TidyIndentAttributes, /**< Newline+indent before each attribute */
TidyXmlPIs, /**< If set to yes PIs must end with ?> */
TidyXmlSpace, /**< If set to yes adds xml:space attr as needed */
TidyEncloseBodyText, /**< If yes text at body is wrapped in P's */
TidyEncloseBlockText, /**< If yes text in blocks is wrapped in P's */
TidyKeepFileTimes, /**< If yes last modied time is preserved */
TidyWord2000, /**< Draconian cleaning for Word2000 */
TidyMark, /**< Add meta element indicating tidied doc */
TidyEmacs, /**< If true format error output for GNU Emacs */
TidyEmacsFile, /**< Name of current Emacs file */
TidyLiteralAttribs, /**< If true attributes may use newlines */
TidyBodyOnly, /**< Output BODY content only */
TidyFixUri, /**< Applies URI encoding if necessary */
TidyLowerLiterals, /**< Folds known attribute values to lower case */
TidyHideComments, /**< Hides all (real) comments in output */
TidyIndentCdata, /**< Indent <!CDATA[ ... ]]> section */
TidyForceOutput, /**< Output document even if errors were found */
TidyShowErrors, /**< Number of errors to put out */
TidyAsciiChars, /**< Convert quotes and dashes to nearest ASCII char */
TidyJoinClasses, /**< Join multiple class attributes */
TidyJoinStyles, /**< Join multiple style attributes */
TidyEscapeCdata, /**< Replace <![CDATA[]]> sections with escaped text */
#if SUPPORT_ASIAN_ENCODINGS
TidyLanguage, /**< Language property: not used for anything yet */
TidyNCR, /**< Allow numeric character references */
TidyLanguage, /**< Language property: not used for anything yet */
TidyNCR, /**< Allow numeric character references */
#else
TidyLanguageNotUsed,
TidyNCRNotUsed,
#endif
#if SUPPORT_UTF16_ENCODINGS
TidyOutputBOM, /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */
/**< auto: if input stream has BOM, we output a BOM */
TidyOutputBOM, /**< Output a Byte Order Mark (BOM) for UTF-16 encodings */
/**< auto: if input stream has BOM, we output a BOM */
#else
TidyOutputBOMNotUsed,
#endif
TidyReplaceColor, /**< Replace hex color attribute values with names */
TidyCSSPrefix, /**< CSS class naming for -clean option */
TidyReplaceColor, /**< Replace hex color attribute values with names */
TidyCSSPrefix, /**< CSS class naming for -clean option */
TidyInlineTags, /**< Declared inline tags */
TidyBlockTags, /**< Declared block tags */
TidyEmptyTags, /**< Declared empty tags */
TidyPreTags, /**< Declared pre tags */
TidyInlineTags, /**< Declared inline tags */
TidyBlockTags, /**< Declared block tags */
TidyEmptyTags, /**< Declared empty tags */
TidyPreTags, /**< Declared pre tags */
TidyAccessibilityCheckLevel, /**< Accessibility check level
0 (old style), or 1, 2, 3 */
TidyVertSpace, /**< degree to which markup is spread out vertically */
TidyVertSpace, /**< degree to which markup is spread out vertically */
#if SUPPORT_ASIAN_ENCODINGS
TidyPunctWrap, /**< consider punctuation and breaking spaces for wrapping */
TidyPunctWrap, /**< consider punctuation and breaking spaces for wrapping */
#else
TidyPunctWrapNotUsed,
#endif
@ -237,26 +249,20 @@ typedef enum
/* I/O and Message handling interface
**
** By default, Tidy will define, create and use
** instances of input and output handlers for
** standard C buffered I/O (i.e. FILE* stdin,
** FILE* stdout and FILE* stderr for content
** input, content output and diagnostic output,
** respectively. A FILE* cfgFile input handler
** will be used for config files. Command line
** options will just be set directly.
** By default, Tidy will define, create and use instances of input and output
** handlers for standard C buffered I/O (i.e. FILE* stdin, ** FILE* stdout and
** FILE* stderr for content input, content output and diagnostic output,
** respectively. A FILE* cfgFile input handler will be used for config files.
** Command line options will just be set directly.
*/
/** Message severity level
* These TidyReportLevel are used throughout libtidy, but don't
* have associated localized strings to describe them because
* TidyReportLevel is externally-facing, and changing the enum
* starting int can break existing API's for poorly-written
* applications using libtidy. See enum `TidyReportLevelKeys`.
*/
/** Message severity level. These are used throughout LibTidy to indicate the
* severity of a message, and they also have associated localized strings to
* describe them.
*/
typedef enum
{
TidyInfo, /**< Information about markup usage */
TidyInfo = 350, /**< Information about markup usage */
TidyWarning, /**< Warning message */
TidyConfig, /**< Configuration error */
TidyAccess, /**< Accessibility message */
@ -265,22 +271,6 @@ typedef enum
TidyFatal /**< Crash! */
} 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
*/
@ -813,6 +803,495 @@ typedef enum
N_TIDY_ATTRIBS /**< Must be last */
} 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
} /* extern "C" */
#endif

View file

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

View file

@ -21,7 +21,7 @@
* `poconvert.rb msgunfmt language_<%= po_content.language %>.h` (our own
* 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.
*
* Template Created by Jim Derry on 01/14/2016.
@ -35,10 +35,6 @@
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* 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' ))
@@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
fuzzy_list = nil
pwd = File.expand_path( File.join(Dir.getwd, '..') )
if options[:sha]
pwd = File.expand_path( File.join(Dir.getwd, '..') )
sha = options[:sha]
temp_file = "~#{sha}.h"
project = Git.open(pwd)

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\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"
"Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s"
msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration"
msgstr ""
@ -381,31 +372,31 @@ msgstr ""
"helping us to localise HTML Tidy. For details please see \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
msgctxt "TidyInfoString"
msgctxt "TidyInfo"
msgid "Info: "
msgstr ""
msgctxt "TidyWarningString"
msgctxt "TidyWarning"
msgid "Warning: "
msgstr ""
msgctxt "TidyConfigString"
msgctxt "TidyConfig"
msgid "Config: "
msgstr ""
msgctxt "TidyAccessString"
msgctxt "TidyAccess"
msgid "Access: "
msgstr ""
msgctxt "TidyErrorString"
msgctxt "TidyError"
msgid "Error: "
msgstr ""
msgctxt "TidyBadDocumentString"
msgctxt "TidyBadDocument"
msgid "Document: "
msgstr ""
msgctxt "TidyFatalString"
msgctxt "TidyFatal"
msgid "Panic: "
msgstr ""
@ -439,6 +430,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s"
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
msgctxt "MISSING_SEMICOLON"
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."
msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS"
msgctxt "TidyDiagnostics"
msgid "diagnostics"
msgstr ""
msgctxt "TC_CAT_ENCODING"
msgctxt "TidyEncoding"
msgid "encoding"
msgstr ""
msgctxt "TC_CAT_MARKUP"
msgctxt "TidyMarkup"
msgid "markup"
msgstr ""
msgctxt "TC_CAT_MISC"
msgctxt "TidyMiscellaneous"
msgid "misc"
msgstr ""
msgctxt "TC_CAT_PRETTYPRINT"
msgctxt "TidyPrettyPrint"
msgid "print"
msgstr ""

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\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"
"Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s"
msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration"
msgstr ""
@ -377,31 +368,31 @@ msgstr ""
"ayudarnos a localizar HTML Tidy. Para más detalles consulte \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n"
msgctxt "TidyInfoString"
msgctxt "TidyInfo"
msgid "Info: "
msgstr ""
msgctxt "TidyWarningString"
msgctxt "TidyWarning"
msgid "Warning: "
msgstr ""
msgctxt "TidyConfigString"
msgctxt "TidyConfig"
msgid "Config: "
msgstr ""
msgctxt "TidyAccessString"
msgctxt "TidyAccess"
msgid "Access: "
msgstr ""
msgctxt "TidyErrorString"
msgctxt "TidyError"
msgid "Error: "
msgstr ""
msgctxt "TidyBadDocumentString"
msgctxt "TidyBadDocument"
msgid "Document: "
msgstr ""
msgctxt "TidyFatalString"
msgctxt "TidyFatal"
msgid "Panic: "
msgstr ""
@ -435,6 +426,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s"
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
msgctxt "MISSING_SEMICOLON"
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."
msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS"
msgctxt "TidyDiagnostics"
msgid "diagnostics"
msgstr ""
msgctxt "TC_CAT_ENCODING"
msgctxt "TidyEncoding"
msgid "encoding"
msgstr ""
msgctxt "TC_CAT_MARKUP"
msgctxt "TidyMarkup"
msgid "markup"
msgstr ""
msgctxt "TC_CAT_MISC"
msgctxt "TidyMiscellaneous"
msgid "misc"
msgstr ""
msgctxt "TC_CAT_PRETTYPRINT"
msgctxt "TidyPrettyPrint"
msgid "print"
msgstr ""

View file

@ -5,10 +5,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\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"
"Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s"
msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration"
msgstr ""
@ -377,31 +368,31 @@ msgstr ""
"ayudarnos a localizar HTML Tidy. Para más detalles consulte \n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md \n"
msgctxt "TidyInfoString"
msgctxt "TidyInfo"
msgid "Info: "
msgstr ""
msgctxt "TidyWarningString"
msgctxt "TidyWarning"
msgid "Warning: "
msgstr ""
msgctxt "TidyConfigString"
msgctxt "TidyConfig"
msgid "Config: "
msgstr ""
msgctxt "TidyAccessString"
msgctxt "TidyAccess"
msgid "Access: "
msgstr ""
msgctxt "TidyErrorString"
msgctxt "TidyError"
msgid "Error: "
msgstr ""
msgctxt "TidyBadDocumentString"
msgctxt "TidyBadDocument"
msgid "Document: "
msgstr ""
msgctxt "TidyFatalString"
msgctxt "TidyFatal"
msgid "Panic: "
msgstr ""
@ -435,6 +426,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s"
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
msgctxt "MISSING_SEMICOLON"
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."
msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS"
msgctxt "TidyDiagnostics"
msgid "diagnostics"
msgstr ""
msgctxt "TC_CAT_ENCODING"
msgctxt "TidyEncoding"
msgid "encoding"
msgstr ""
msgctxt "TC_CAT_MARKUP"
msgctxt "TidyMarkup"
msgid "markup"
msgstr ""
msgctxt "TC_CAT_MISC"
msgctxt "TidyMiscellaneous"
msgid "misc"
msgstr ""
msgctxt "TC_CAT_PRETTYPRINT"
msgctxt "TidyPrettyPrint"
msgid "print"
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"
"X-Generator: HTML Tidy poconvert.rb\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"
"Language-Team: \n"
"BAD"
#. Only translate if a URL to the target language can be found.
msgctxt "ACCESS_URL"
msgid "http://www.w3.org/WAI/GL"
@ -100,20 +100,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s"
msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration"
msgstr ""
@ -371,31 +362,31 @@ msgid ""
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
msgstr ""
msgctxt "TidyInfoString"
msgctxt "TidyInfo"
msgid "Info: "
msgstr ""
msgctxt "TidyWarningString"
msgctxt "TidyWarning"
msgid "Warning: "
msgstr ""
msgctxt "TidyConfigString"
msgctxt "TidyConfig"
msgid "Config: "
msgstr ""
msgctxt "TidyAccessString"
msgctxt "TidyAccess"
msgid "Access: "
msgstr ""
msgctxt "TidyErrorString"
msgctxt "TidyError"
msgid "Error: "
msgstr ""
msgctxt "TidyBadDocumentString"
msgctxt "TidyBadDocument"
msgid "Document: "
msgstr ""
msgctxt "TidyFatalString"
msgctxt "TidyFatal"
msgid "Panic: "
msgstr ""
@ -429,6 +420,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s"
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
msgctxt "MISSING_SEMICOLON"
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."
msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS"
msgctxt "TidyDiagnostics"
msgid "diagnostics"
msgstr ""
msgctxt "TC_CAT_ENCODING"
msgctxt "TidyEncoding"
msgid "encoding"
msgstr ""
msgctxt "TC_CAT_MARKUP"
msgctxt "TidyMarkup"
msgid "markup"
msgstr ""
msgctxt "TC_CAT_MISC"
msgctxt "TidyMiscellaneous"
msgid "misc"
msgstr ""
msgctxt "TC_CAT_PRETTYPRINT"
msgctxt "TidyPrettyPrint"
msgid "print"
msgstr ""

View file

@ -5,7 +5,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: HTML Tidy poconvert.rb\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"
"Language-Team: \n"
@ -102,20 +102,11 @@ msgctxt "STRING_SPECIFIED"
msgid "specified"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_FILE"
msgid "%s: can't open file \"%s\"\n"
msgstr ""
#, c-format
msgctxt "STRING_UNKNOWN_OPTION"
msgid "unknown option: %s"
msgstr ""
msgctxt "STRING_UNRECZD_OPTION"
msgid "unrecognized option -%c use -help to list options\n"
msgstr ""
msgctxt "STRING_XML_DECLARATION"
msgid "XML declaration"
msgstr ""
@ -373,31 +364,31 @@ msgid ""
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
msgstr ""
msgctxt "TidyInfoString"
msgctxt "TidyInfo"
msgid "Info: "
msgstr ""
msgctxt "TidyWarningString"
msgctxt "TidyWarning"
msgid "Warning: "
msgstr ""
msgctxt "TidyConfigString"
msgctxt "TidyConfig"
msgid "Config: "
msgstr ""
msgctxt "TidyAccessString"
msgctxt "TidyAccess"
msgid "Access: "
msgstr ""
msgctxt "TidyErrorString"
msgctxt "TidyError"
msgid "Error: "
msgstr ""
msgctxt "TidyBadDocumentString"
msgctxt "TidyBadDocument"
msgid "Document: "
msgstr ""
msgctxt "TidyFatalString"
msgctxt "TidyFatal"
msgid "Panic: "
msgstr ""
@ -431,6 +422,18 @@ msgctxt "INVALID_NCR"
msgid "%s invalid numeric character reference %s"
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
msgctxt "MISSING_SEMICOLON"
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."
msgstr ""
msgctxt "TC_CAT_DIAGNOSTICS"
msgctxt "TidyDiagnostics"
msgid "diagnostics"
msgstr ""
msgctxt "TC_CAT_ENCODING"
msgctxt "TidyEncoding"
msgid "encoding"
msgstr ""
msgctxt "TC_CAT_MARKUP"
msgctxt "TidyMarkup"
msgid "markup"
msgstr ""
msgctxt "TC_CAT_MISC"
msgctxt "TidyMiscellaneous"
msgid "misc"
msgstr ""
msgctxt "TC_CAT_PRETTYPRINT"
msgctxt "TidyPrettyPrint"
msgid "print"
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"

View file

@ -1,56 +1,44 @@
#ifndef __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
*
* 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)
*
*********************************************************************/
* carry out accessibility checks
*
* This module is an add-on to HTML Tidy and is enabled or disabled via
* the SUPPORT_ACCESSIBILITY_CHECKS macro, which is defined by default
* in `tidyplatform.h`. Search this code for this macro to determine
* other locations supporting code exists.
*
* This module carries out processes for all accessibility checks. It
* 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 or configuration file, there is no
* specification of which accessibility priorities to check, then no
* 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 "message.h"
#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 {
TEXTBUF_SIZE=128u
@ -62,7 +50,7 @@ typedef struct _TidyAccessImpl TidyAccessImpl;
struct _TidyAccessImpl
{
/* gets set from Tidy variable AccessibilityCheckLevel */
int PRIORITYCHK;
int PRIORITYCHK; /**< */
/* Number of characters that are found within the concatenated text */
int counter;
@ -100,180 +88,11 @@ struct _TidyAccessImpl
Bool HasInvalidColumnHeader;
int ForID;
/* List containing map-links
AreaLinks* links;
AreaLinks* start;
AreaLinks* current;
*/
};
/*
Determines which error/warning message should be displayed,
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_(AccessibilityHelloMessage)( TidyDocImpl* doc ); /* impl. message.c */
void TY_(DisplayHTMLTableAlgorithm)( TidyDocImpl* doc ); /* impl. message.c */
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 );
ctmbstr TY_(getNextOptionPick)( const TidyOptionImpl* option, TidyIterator* iter );
#if SUPPORT_CONSOLE_APP
const TidyOptionDoc* TY_(OptGetDocDesc)( TidyOptionId optId );
#endif /* SUPPORT_CONSOLE_APP */
void TY_(InitConfig)( TidyDocImpl* doc );
void TY_(FreeConfig)( TidyDocImpl* doc );

View file

@ -1,15 +1,15 @@
/*
* language.c
* Localization support for HTML Tidy.
*
* (c) 2015 HTACG
* See tidy.h and access.h for the copyright notice.
*
* Created by Jim Derry on 11/28/15.
/* language.c -- localization support for HTML Tidy.
Copyright 2015 HTACG
See tidy.h for the copyright notice.
*/
#include "language.h"
#include "language_en.h"
#include "tmbstr.h"
#include "locale.h"
#if SUPPORT_LOCALIZATIONS
#include "language_en_gb.h"
#include "language_es.h"
@ -17,8 +17,6 @@
#include "language_zh_cn.h"
#include "language_fr.h"
#endif
#include "tmbstr.h"
#include "locale.h"
/**
@ -59,7 +57,7 @@ static tidyLanguagesType tidyLanguages = {
* to proper POSIX names (modern Windows already uses
* POSIX names).
*/
static const tidyLocaleMapItem localeMappings[] = {
static const tidyLocaleMapItemImpl localeMappings[] = {
{ "america", "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.
*/
ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definition, uint plural )
static ctmbstr tidyLocalizedStringImpl( uint messageType, languageDefinition *definition, uint plural )
{
int i;
languageDictionary *dictionary = &definition->messages;
@ -523,27 +252,27 @@ ctmbstr TY_(tidyLocalizedString)( uint messageType, languageDefinition *definiti
* of infrastructure to use hash lookups is a preferred
* future optimization.
*/
ctmbstr tidyLocalizedStringN( uint messageType, uint quantity )
ctmbstr TY_(tidyLocalizedStringN)( uint messageType, uint quantity )
{
ctmbstr result;
result = TY_(tidyLocalizedString)( messageType, tidyLanguages.currentLanguage, quantity);
result = tidyLocalizedStringImpl( messageType, tidyLanguages.currentLanguage, quantity);
if (!result && tidyLanguages.fallbackLanguage )
{
result = TY_(tidyLocalizedString)( messageType, tidyLanguages.fallbackLanguage, quantity);
result = tidyLocalizedStringImpl( messageType, tidyLanguages.fallbackLanguage, quantity);
}
if (!result)
{
/* Fallback to en which is built in. */
result = TY_(tidyLocalizedString)( messageType, &language_en, quantity);
result = tidyLocalizedStringImpl( messageType, &language_en, quantity);
}
if (!result)
{
/* 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;
@ -558,9 +287,9 @@ ctmbstr tidyLocalizedStringN( uint messageType, uint quantity )
* of infrastructure to use hash lookups is a preferred
* 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.
** @return The same buffer for convenience.
*/
tmbstr tidySystemLocale(tmbstr result)
tmbstr TY_(tidySystemLocale)(tmbstr result)
{
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
* return it if there's no other match.
*/
tmbstr tidyNormalizedLocaleName( ctmbstr locale )
tmbstr TY_(tidyNormalizedLocaleName)( ctmbstr locale )
{
uint i;
uint len;
@ -686,14 +415,14 @@ languageDefinition *TY_(tidyTestLanguage)( ctmbstr languageCode )
* 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.
*/
Bool tidySetLanguage( ctmbstr languageCode )
Bool TY_(tidySetLanguage)( ctmbstr languageCode )
{
languageDefinition *dict1 = NULL;
languageDefinition *dict2 = NULL;
tmbstr wantCode = NULL;
char lang[3] = "";
if ( !languageCode || !(wantCode = tidyNormalizedLocaleName( languageCode )) )
if ( !languageCode || !(wantCode = TY_(tidyNormalizedLocaleName)( languageCode )) )
{
return no;
}
@ -739,7 +468,7 @@ Bool tidySetLanguage( ctmbstr languageCode )
/**
* Gets the current language used by Tidy.
*/
ctmbstr tidyGetLanguage()
ctmbstr TY_(tidyGetLanguage)()
{
languageDefinition *langDef = tidyLanguages.currentLanguage;
languageDictionary *langDict = &langDef->messages;
@ -751,9 +480,9 @@ ctmbstr tidyGetLanguage()
* Provides a string given `messageType` in the default
* 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
* number of items in the array, _not_ the highest index.
*/
const uint TY_(tidyStringKeyListSize)()
static const uint tidyStringKeyListSize()
{
static uint array_size = 0;
@ -782,7 +511,7 @@ const uint TY_(tidyStringKeyListSize)()
* these are provided for documentation generation purposes
* and probably aren't useful for LibTidy implementors.
*/
TidyIterator getStringKeyList()
TidyIterator TY_(getStringKeyList)()
{
return (TidyIterator)(size_t)1;
}
@ -793,7 +522,7 @@ TidyIterator getStringKeyList()
* generation purposes and probably aren't useful to
* libtidy implementors.
*/
uint getNextStringKey( TidyIterator* iter )
uint TY_(getNextStringKey)( TidyIterator* iter )
{
uint item = 0;
size_t itemIndex;
@ -801,13 +530,13 @@ uint getNextStringKey( TidyIterator* iter )
itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyStringKeyListSize)() )
if ( itemIndex > 0 && itemIndex <= tidyStringKeyListSize() )
{
item = language_en.messages[ itemIndex - 1 ].key;
itemIndex++;
}
*iter = (TidyIterator)( itemIndex <= TY_(tidyStringKeyListSize)() ? itemIndex : (size_t)0 );
*iter = (TidyIterator)( itemIndex <= tidyStringKeyListSize() ? itemIndex : (size_t)0 );
return item;
}
@ -816,7 +545,7 @@ uint getNextStringKey( TidyIterator* iter )
* Determines the true size of the `localeMappings` array indicating the
* number of items in the array, _not_ the highest index.
*/
const uint TY_(tidyLanguageListSize)()
static const uint tidyLanguageListSize()
{
static uint array_size = 0;
@ -835,7 +564,7 @@ const uint TY_(tidyLanguageListSize)()
* in Tidy's structure of Windows<->POSIX local mapping.
* Items can be retrieved with getNextWindowsLanguage();
*/
TidyIterator getWindowsLanguageList()
TidyIterator TY_(getWindowsLanguageList)()
{
return (TidyIterator)(size_t)1;
}
@ -844,29 +573,47 @@ TidyIterator getWindowsLanguageList()
* Returns the next record of type `localeMapItem` in
* 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;
assert( iter != NULL );
itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyLanguageListSize)() )
if ( itemIndex > 0 && itemIndex <= tidyLanguageListSize() )
{
item = &localeMappings[ itemIndex -1 ];
itemIndex++;
}
*iter = (TidyIterator)( itemIndex <= TY_(tidyLanguageListSize)() ? itemIndex : (size_t)0 );
*iter = (TidyIterator)( itemIndex <= tidyLanguageListSize() ? itemIndex : (size_t)0 );
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.
*/
const uint TY_(tidyInstalledLanguageListSize)()
static const uint tidyInstalledLanguageListSize()
{
static uint array_size = 0;
@ -885,7 +632,7 @@ const uint TY_(tidyInstalledLanguageListSize)()
* in Tidy's list of installed language codes.
* Items can be retrieved with getNextInstalledLanguage();
*/
TidyIterator getInstalledLanguageList()
TidyIterator TY_(getInstalledLanguageList)()
{
return (TidyIterator)(size_t)1;
}
@ -893,7 +640,7 @@ TidyIterator getInstalledLanguageList()
/**
* Returns the next installed language.
*/
ctmbstr getNextInstalledLanguage( TidyIterator* iter )
ctmbstr TY_(getNextInstalledLanguage)( TidyIterator* iter )
{
ctmbstr item = NULL;
size_t itemIndex;
@ -901,62 +648,12 @@ ctmbstr getNextInstalledLanguage( TidyIterator* iter )
itemIndex = (size_t)*iter;
if ( itemIndex > 0 && itemIndex <= TY_(tidyInstalledLanguageListSize)() )
if ( itemIndex > 0 && itemIndex <= tidyInstalledLanguageListSize() )
{
item = tidyLanguages.languages[itemIndex - 1]->messages[0].value;
itemIndex++;
}
*iter = (TidyIterator)( itemIndex <= TY_(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 );
*iter = (TidyIterator)( itemIndex <= tidyInstalledLanguageListSize() ? itemIndex : (size_t)0 );
return item;
}

View file

@ -1,25 +1,41 @@
#ifndef language_h
#define language_h
/*
* language.h
/*********************************************************************
* Localization support for HTML Tidy.
* This header provides the public (within libtidy) interface
* to basic localization support. To add your own localization
* create a new `language_xx.h` file and add it to the struct
* in `language.c`.
*
* This header provides the public (within libtidy) interface to
* basic localization support. To add your own localization, create
* a new `language_xx.h` file and add it to the struct in
* `language.c`.
*
* (c) 2015 HTACG
* See tidy.h and access.h for the copyright notice.
*
* Created by Jim Derry on 11/28/15.
*/
* See `tidy.h` for the copyright notice.
*********************************************************************/
#include "tidyplatform.h"
#include "forward.h"
/** @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.
* - 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
* locale names are mapped to POSIX language codes.
*/
typedef struct tidyLocaleMapItem {
typedef struct tidyLocaleMapItemImpl {
ctmbstr winName;
ctmbstr POSIXName;
} tidyLocaleMapItem;
/**
* 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);
} tidyLocaleMapItemImpl;
/** @} */
@ -228,7 +95,7 @@ ctmbstr tidyErrorCodeAsString(uint code);
** Returns NULL on failure.
** @return The same buffer for convenience.
*/
tmbstr tidySystemLocale(tmbstr result);
tmbstr TY_(tidySystemLocale)(tmbstr result);
/**
* 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
* 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.
*/
ctmbstr tidyGetLanguage();
ctmbstr TY_(tidyGetLanguage)();
/**
* Provides a string given `messageType` in the current
* localization for `quantity`.
*/
ctmbstr tidyLocalizedStringN( uint messageType, uint quantity );
ctmbstr TY_(tidyLocalizedStringN)( uint messageType, uint quantity );
/**
* Provides a string given `messageType` in the current
* localization for the single case.
*/
ctmbstr tidyLocalizedString( uint messageType );
ctmbstr TY_(tidyLocalizedString)( uint messageType );
/** @} */
/** @name Documentation Generation */
/** @{ */
/**
* Provides a string given `messageType` in the default
* localization (which is `en`).
*/
ctmbstr tidyDefaultString( uint messageType );
ctmbstr TY_(tidyDefaultString)( uint messageType );
/*
* Initializes the TidyIterator to point to the first item
@ -277,7 +145,7 @@ ctmbstr tidyDefaultString( uint messageType );
* these are provided for documentation generation purposes
* and probably aren't useful for LibTidy implementors.
*/
TidyIterator getStringKeyList();
TidyIterator TY_(getStringKeyList)();
/*
* 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
* libtidy implementors.
*/
uint getNextStringKey( TidyIterator* iter );
uint TY_(getNextStringKey)( TidyIterator* iter );
/**
* Initializes the TidyIterator to point to the first item
* in Tidy's structure of Windows<->POSIX local mapping.
* Items can be retrieved with getNextWindowsLanguage();
*/
TidyIterator getWindowsLanguageList();
TidyIterator TY_(getWindowsLanguageList)();
/**
* Returns the next record of type `localeMapItem` in
* 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
* in Tidy's list of installed language codes.
* Items can be retrieved with getNextInstalledLanguage();
*/
TidyIterator getInstalledLanguageList();
TidyIterator TY_(getInstalledLanguageList)();
/**
* Returns the next installed language.
*/
ctmbstr 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 );
ctmbstr TY_(getNextInstalledLanguage)( TidyIterator* iter );
/** @} */

View file

@ -12,7 +12,7 @@
* language localizations. As such do not edit PO files for this language;
* modify this file directly.
*
* (c) 2015 HTACG
* (c) 2015-2017 HTACG
* See tidy.h and access.h for the copyright notice.
*
* Created by Jim Derry on 11/28/15.
@ -22,10 +22,6 @@
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* 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." */
STRING_SPECIFIED, 0, "specified"
},
{ STRING_UNKNOWN_FILE, 0, "%s: can't open file \"%s\"\n" },
{ 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" },
{/* This console output should be limited to 78 characters per line. */
@ -314,13 +308,13 @@ static languageDefinition language_en = { whichPluralForm_en, {
/***************************************
** Message Severity Level
***************************************/
{ TidyInfoString, 0, "Info: " },
{ TidyWarningString, 0, "Warning: " },
{ TidyConfigString, 0, "Config: " },
{ TidyAccessString, 0, "Access: " },
{ TidyErrorString, 0, "Error: " },
{ TidyBadDocumentString, 0, "Document: " },
{ TidyFatalString, 0, "Panic: " },
{ TidyInfo, 0, "Info: " },
{ TidyWarning, 0, "Warning: " },
{ TidyConfig, 0, "Config: " },
{ TidyAccess, 0, "Access: " },
{ TidyError, 0, "Error: " },
{ TidyBadDocument, 0, "Document: " },
{ TidyFatal, 0, "Panic: " },
/***************************************
** 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."
},
#if SUPPORT_CONSOLE_APP
/********************************************************
** Console Application
** 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
** developers.
********************************************************/
{ TC_CAT_DIAGNOSTICS, 0, "diagnostics" },
{ TC_CAT_ENCODING, 0, "encoding" },
{ TC_CAT_MARKUP, 0, "markup" },
{ TC_CAT_MISC, 0, "misc" },
{ TC_CAT_PRETTYPRINT, 0, "print" },
{ TidyDiagnostics, 0, "diagnostics" },
{ TidyEncoding, 0, "encoding" },
{ TidyMarkup, 0, "markup" },
{ TidyMiscellaneous, 0, "misc" },
{ TidyPrettyPrint, 0, "print" },
{ TC_LABEL_COL, 0, "column" },
{ TC_LABEL_FILE, 0, "file" },
{ TC_LABEL_LANG, 0, "lang" },
@ -2345,7 +2340,7 @@ static languageDefinition language_en = { whichPluralForm_en, {
"Tidy is currently using locale %s. \n"
"\n"
},
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_en_gb.h` (our own
* 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.
*
* Template Created by Jim Derry on 01/14/2016.
*
* Orginating PO file metadata:
* 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
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* This language-specific function returns the correct pluralForm

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_es.h` (our own
* 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.
*
* Template Created by Jim Derry on 01/14/2016.
*
* Orginating PO file metadata:
* 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
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* 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. " },
#endif /* SUPPORT_ASIAN_ENCODINGS */
#if SUPPORT_CONSOLE_APP
{ TC_TXT_HELP_LANG_1, 0,
"\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"
"\n"
},
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_es_mx.h` (our own
* 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.
*
* Template Created by Jim Derry on 01/14/2016.
*
* Orginating PO file metadata:
* 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
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* This language-specific function returns the correct pluralForm

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_fr.h` (our own
* 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.
*
* Template Created by Jim Derry on 01/14/2016.
*
* Orginating PO file metadata:
* PO_LAST_TRANSLATOR=
* PO_REVISION_DATE=
* PO_LAST_TRANSLATOR=jderry
* PO_REVISION_DATE=2017-02-17 14:46:38
*/
#ifdef _MSC_VER
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* This language-specific function returns the correct pluralForm
@ -65,31 +61,27 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
{/* Specify the ll or ll_cc language code here. */
TIDY_LANGUAGE, 0, "fr"
},
{ ACCESS_URL, 0, "http://www.w3.org/WAI/GL" },
{ ATRC_ACCESS_URL, 0, "http://www.html-tidy.org/Accessibility/" },
{ FILE_CANT_OPEN, 0, "Impossible d'ouvrir « %s »\n" },
{ LINE_COLUMN_STRING, 0, "Ligne: %d Col: %d - " },
{ STRING_CONTENT_LOOKS, 0, "Le contenu du document ressemble à %s" },
{ STRING_DISCARDING, 0, "dépose" },
{ STRING_DOCTYPE_GIVEN, 0, "DOCTYPE donné est «%s»" },
{ STRING_ERROR_COUNT, 0, "%u %s, %u %s trouvées!" },
{ STRING_ERROR_COUNT_ERROR, 0, "erreur" },
{ STRING_ERROR_COUNT_ERROR, 1, "erreurs" },
{ STRING_ERROR_COUNT_WARNING, 0, "alarme" },
{ STRING_ERROR_COUNT_WARNING, 1, "alarmes" },
{ 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_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_NOT_ALL_SHOWN, 0, "Pas tous les avertissements/erreurs ont été présentés." },
{ STRING_PLAIN_TEXT, 0, "le texte brut" },
{ STRING_REPLACING, 0, "remplaçant" },
{ 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_UNRECZD_OPTION, 0, "option non reconnue -%c utiliser -help pour lister les options\n" },
{ STRING_XML_DECLARATION, 0, "déclaration XML" },
{ ATRC_ACCESS_URL, 0, "http://www.html-tidy.org/Accessibility/" },
{ FILE_CANT_OPEN, 0, "Impossible d'ouvrir « %s »\n" },
{ LINE_COLUMN_STRING, 0, "Ligne: %d Col: %d - " },
{ STRING_CONTENT_LOOKS, 0, "Le contenu du document ressemble à %s" },
{ STRING_DISCARDING, 0, "dépose" },
{ STRING_DOCTYPE_GIVEN, 0, "DOCTYPE donné est «%s»" },
{ STRING_ERROR_COUNT, 0, "%u %s, %u %s trouvées!" },
{ STRING_ERROR_COUNT_ERROR, 0, "erreur" },
{ STRING_ERROR_COUNT_ERROR, 1, "erreurs" },
{ STRING_ERROR_COUNT_WARNING, 0, "alarme" },
{ STRING_ERROR_COUNT_WARNING, 1, "alarmes" },
{ STRING_HELLO_ACCESS, 0, "Contrôles d'accessibilité: version 0.1" },
{ 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_SYSID, 0, "Aucun identificateur de système dans le doctype émis" },
{ STRING_NOT_ALL_SHOWN, 0, "Pas tous les avertissements/erreurs ont été présentés." },
{ STRING_PLAIN_TEXT, 0, "le texte brut" },
{ STRING_REPLACING, 0, "remplaçant" },
{ STRING_SPECIFIED, 0, "spécifié" },
{ STRING_UNKNOWN_OPTION, 0, "option inconnue: %s" },
{ STRING_XML_DECLARATION, 0, "déclaration XML" },
{ TEXT_HTML_T_ALGORITHM, 0,
"\n"
" - D'abord, cherchez à gauche de la position de la cellule de trouver \n"
@ -227,7 +219,7 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"Pour plus d'informations sur la façon de rendre vos pages\n"
"accessibles, voir http://www.w3.org/WAI/GL"
},
{ TEXT_ACCESS_ADVICE2, 0, "et http://www.html-tidy.org/Accessibility/" },
{ TEXT_ACCESS_ADVICE2, 0, "et http://www.html-tidy.org/Accessibility/" },
{ TEXT_USING_LAYER, 0,
"Les Cascading Style Sheets (CSS) mécanisme de positionnement\n"
"Il est recommandé de préférence à la propriétaire <LAYER>\n"
@ -278,101 +270,101 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"vous plaît voir\n"
"https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md\n"
},
{ TidyInfoString, 0, "Info:" },
{ TidyWarningString, 0, "Attention:" },
{ TidyConfigString, 0, "Config:" },
{ TidyAccessString, 0, "Accès:" },
{ TidyErrorString, 0, "Erreur:" },
{ TidyBadDocumentString, 0, "Document:" },
{ TidyFatalString, 0, "Panique:" },
{ TidyInfo, 0, "Info:" },
{ TidyWarning, 0, "Attention:" },
{ TidyConfig, 0, "Config:" },
{ TidyAccess, 0, "Accès:" },
{ TidyError, 0, "Erreur:" },
{ TidyBadDocument, 0, "Document:" },
{ TidyFatal, 0, "Panique:" },
{ 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" },
{ INVALID_SGML_CHARS, 0, "%s de code de caractère invalide l'%s" },
{ INVALID_UTF8, 0, "%s invalides octets UTF-8 de (char. codes %s)" },
{ INVALID_UTF16, 0, "paire de substitution non valide UTF-16 (code de caract. %s) %s" },
{ INVALID_NCR, 0, "Référence de caractère numérique non valide de %s %s" },
{ MISSING_SEMICOLON, 0, "entité « %s » ne s'arrête pas à «; »" },
{ MISSING_SEMICOLON_NCR, 0, "Référence de caractère numérique « %s » n'est pas se terminer par «; »" },
{ UNESCAPED_AMPERSAND, 0, "sans séquence d'échappement & qui devrait être écrit comme &amp;" },
{ 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_UTF8, 0, "%s invalides octets UTF-8 de (char. codes %s)" },
{ INVALID_UTF16, 0, "paire de substitution non valide UTF-16 (code de caract. %s) %s" },
{ INVALID_NCR, 0, "Référence de caractère numérique non valide de %s %s" },
{ MISSING_SEMICOLON, 0, "entité « %s » ne s'arrête pas à «; »" },
{ MISSING_SEMICOLON_NCR, 0, "Référence de caractère numérique « %s » n'est pas se terminer par «; »" },
{ UNESCAPED_AMPERSAND, 0, "sans séquence d'échappement & qui devrait être écrit comme &amp;" },
{ UNKNOWN_ENTITY, 0, "sans séquence d'échappement & ou entité inconnue « %s »" },
{ APOS_UNDEFINED, 0, "nommée l'entité ' seulement défini en XML/XHTML" },
{ INSERTING_ATTRIBUTE, 0, "%s insérer l'attribut « %s »" },
{ INSERTING_AUTO_ATTRIBUTE, 0, "%s insérer l'attribut « %s », à l'aide de la valeur « %s »" },
{ MISSING_ATTR_VALUE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ UNKNOWN_ATTRIBUTE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ PROPRIETARY_ATTRIBUTE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ APOS_UNDEFINED, 0, "nommée l'entité ' seulement défini en XML/XHTML" },
{ INSERTING_ATTRIBUTE, 0, "%s insérer l'attribut « %s »" },
{ INSERTING_AUTO_ATTRIBUTE, 0, "%s insérer l'attribut « %s », à l'aide de la valeur « %s »" },
{ MISSING_ATTR_VALUE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ UNKNOWN_ATTRIBUTE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ PROPRIETARY_ATTRIBUTE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ JOINING_ATTRIBUTE, 0, "%s rejoignant les valeurs d'attribut répétée « %s »" },
{ XML_ATTRIBUTE_VALUE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ XML_ID_SYNTAX, 0, "ID de %s « %s » utilise la syntaxe XML ID" },
{ ATTR_VALUE_NOT_LCASE, 0, "valeur d'attribut de %s « %s » doit être en minuscules pour XHTML" },
{ PROPRIETARY_ATTR_VALUE, 0, "valeur d'attribut propriétaire de %s « %s »" },
{ ANCHOR_NOT_UNIQUE, 0, "%s anchor \"%s\" déjà défini" },
{ BAD_ATTRIBUTE_VALUE, 0, "L'attribut %s \"%s\" a une valeur non valide \"%s\"" },
{ BAD_ATTRIBUTE_VALUE_REPLACED, 0, "%s attribut « %s » a une valeur non valide « %s » et a été remplacé" },
{ INVALID_ATTRIBUTE, 0, "nom d'attribut de %s « %s » (valeur = « %s ») n'est pas valide" },
{ REPEATED_ATTRIBUTE, 0, "%s laissant tomber la valeur « %s » pour l'attribut répétée « %s »" },
{ INVALID_XML_ID, 0, "%s ne peut pas copier le nom attribut id" },
{ UNEXPECTED_GT, 0, "manquant '>' pour tag: %s" },
{ UNEXPECTED_QUOTEMARK, 0, "%s inattendue ou double quote mark" },
{ MISSING_QUOTEMARK, 0, "%s attribut manquant apostrophe droite" },
{ UNEXPECTED_END_OF_FILE_ATTR, 0, "%s fin de fichier lors de l'analyse d'attributs" },
{ ID_NAME_MISMATCH, 0, "%s id et le nom valeur d'attribut mismatch" },
{ BACKSLASH_IN_URI, 0, "référence URI %s contient des anti-slash. Faute de frappe ?" },
{ FIXED_BACKSLASH, 0, "%s conversion de barre oblique inverse d'URI de slash" },
{ ILLEGAL_URI_REFERENCE, 0, "%s mal échappé référence URI" },
{ ESCAPED_ILLEGAL_URI, 0, "%s échapper malformé référence URI" },
{ NEWLINE_IN_URI, 0, "rejeter la nouvelle ligne de %s en référence URI" },
{ WHITE_IN_URI, 0, "jeter le espaces de %s en référence URI" },
{ UNEXPECTED_EQUALSIGN, 0, "%s unexpected '=', nom d'attribut attendu" },
{ MISSING_IMAGEMAP, 0, "%s doivent utiliser côté client image map" },
{ MISSING_ATTRIBUTE, 0, "%s manque attribut \"%s\"" },
{ NESTED_EMPHASIS, 0, "accent imbriquée %s" },
{ NESTED_QUOTATION, 0, "imbriqué \"q\" éléments, typo possible" },
{ OBSOLETE_ELEMENT, 0, "remplaçant élément obsolète %s avec %s" },
{ COERCE_TO_ENDTAG_WARN, 0, "<%s> est probablement destinée en tant que </%s>" },
{ REMOVED_HTML5, 0, "L'élément de %s retiré HTML5" },
{ BAD_SUMMARY_HTML5, 0, "L'attribut summary sur l'élément du %s est obsolète dans HTML5" },
{ TRIM_EMPTY_ELEMENT, 0, "rognage vide %s" },
{ REPLACING_ELEMENT, 0, "remplaçant %s avec %s" },
{ COERCE_TO_ENDTAG, 0, "<%s> est probablement destinée en tant que </%s>" },
{ REPLACING_UNEX_ELEMENT, 0, "remplacement inattendu %s avec %s" },
{ MISSING_ENDTAG_FOR, 0, "manquant </%s>" },
{ MISSING_ENDTAG_BEFORE, 0, "manquante </%s> avant %s" },
{ DISCARDING_UNEXPECTED, 0, "rejet inattendu %s" },
{ NON_MATCHING_ENDTAG, 0, "remplacement inattendu %s avec </%s>" },
{ TAG_NOT_ALLOWED_IN, 0, "%s n'est pas autorisé dans <%s> éléments" },
{ MISSING_STARTTAG, 0, "manquant <%s>" },
{ UNEXPECTED_ENDTAG, 0, "rejet inattendu </%s>" },
{ TOO_MANY_ELEMENTS, 0, "trop de %s éléments" },
{ USING_BR_INPLACE_OF, 0, "utilisant <br> à la place de %s" },
{ INSERTING_TAG, 0, "insertion implicite <%s>" },
{ CANT_BE_NESTED, 0, "%s ne peut pas être imbriquée" },
{ PROPRIETARY_ELEMENT, 0, "%s n'est pas approuvé par le W3C" },
{ ILLEGAL_NESTING, 0, "%s ne doivent pas être imbriqués" },
{ NOFRAMES_CONTENT, 0, "%s non à l'intérieur 'noframes'" },
{ UNEXPECTED_END_OF_FILE, 0, "fin inattendue du fichier %s" },
{ ELEMENT_NOT_EMPTY, 0, "%s élément non vide ou pas fermée" },
{ UNEXPECTED_ENDTAG_IN, 0, "inattendus </%s> dans <%s>" },
{ TOO_MANY_ELEMENTS_IN, 0, "trop de %s éléments dans <%s>" },
{ UNESCAPED_ELEMENT, 0, "unescaped %s dans le contenu pre" },
{ DOCTYPE_AFTER_TAGS, 0, "<! DOCTYPE> est pas autorisé après éléments" },
{ MISSING_TITLE_ELEMENT, 0, "insertion manquante élément 'title'" },
{ INCONSISTENT_VERSION, 0, "DOCTYPE HTML ne correspond pas à un contenu" },
{ MISSING_DOCTYPE, 0, "manquante <!DOCTYPE> déclaration" },
{ CONTENT_AFTER_BODY, 0, "contenu se produit après la fin du body" },
{ MALFORMED_COMMENT, 0, "tirets adjacents dans un commentaire" },
{ BAD_COMMENT_CHARS, 0, "attendre -- ou >" },
{ BAD_CDATA_CONTENT, 0, "'<' + '/' + lettre non permis ici" },
{ INCONSISTENT_NAMESPACE, 0, "le namespace HTML ne correspond pas au contenu" },
{ SPACE_PRECEDING_XMLDECL, 0, "supprimant l'espace blanc précédent Déclaration XML" },
{ MALFORMED_DOCTYPE, 0, "en rejetant malformé <!DOCTYPE>" },
{ BAD_XML_COMMENT, 0, "commentaires XML ne peut pas contenir --" },
{ DTYPE_NOT_UPPER_CASE, 0, "SYSTEM, PUBLIC, W3C, DTD, EN doit être en majuscules" },
{ ENCODING_IO_CONFLICT, 0, "encodage de sortie ne fonctionne pas avec la sortie standard" },
{ SUSPECTED_MISSING_QUOTE, 0, "manquant guillemet pour la valeur d'attribut" },
{ XML_ATTRIBUTE_VALUE, 0, "L'attribut %s a une valeur non valide \"%s\"" },
{ XML_ID_SYNTAX, 0, "ID de %s « %s » utilise la syntaxe XML ID" },
{ ATTR_VALUE_NOT_LCASE, 0, "valeur d'attribut de %s « %s » doit être en minuscules pour XHTML" },
{ PROPRIETARY_ATTR_VALUE, 0, "valeur d'attribut propriétaire de %s « %s »" },
{ ANCHOR_NOT_UNIQUE, 0, "%s anchor \"%s\" déjà défini" },
{ BAD_ATTRIBUTE_VALUE, 0, "L'attribut %s \"%s\" a une valeur non valide \"%s\"" },
{ BAD_ATTRIBUTE_VALUE_REPLACED, 0, "%s attribut « %s » a une valeur non valide « %s » et a été remplacé" },
{ INVALID_ATTRIBUTE, 0, "nom d'attribut de %s « %s » (valeur = « %s ») n'est pas valide" },
{ REPEATED_ATTRIBUTE, 0, "%s laissant tomber la valeur « %s » pour l'attribut répétée « %s »" },
{ INVALID_XML_ID, 0, "%s ne peut pas copier le nom attribut id" },
{ UNEXPECTED_GT, 0, "manquant '>' pour tag: %s" },
{ UNEXPECTED_QUOTEMARK, 0, "%s inattendue ou double quote mark" },
{ MISSING_QUOTEMARK, 0, "%s attribut manquant apostrophe droite" },
{ UNEXPECTED_END_OF_FILE_ATTR, 0, "%s fin de fichier lors de l'analyse d'attributs" },
{ ID_NAME_MISMATCH, 0, "%s id et le nom valeur d'attribut mismatch" },
{ BACKSLASH_IN_URI, 0, "référence URI %s contient des anti-slash. Faute de frappe ?" },
{ FIXED_BACKSLASH, 0, "%s conversion de barre oblique inverse d'URI de slash" },
{ ILLEGAL_URI_REFERENCE, 0, "%s mal échappé référence URI" },
{ ESCAPED_ILLEGAL_URI, 0, "%s échapper malformé référence URI" },
{ NEWLINE_IN_URI, 0, "rejeter la nouvelle ligne de %s en référence URI" },
{ WHITE_IN_URI, 0, "jeter le espaces de %s en référence URI" },
{ UNEXPECTED_EQUALSIGN, 0, "%s unexpected '=', nom d'attribut attendu" },
{ MISSING_IMAGEMAP, 0, "%s doivent utiliser côté client image map" },
{ MISSING_ATTRIBUTE, 0, "%s manque attribut \"%s\"" },
{ NESTED_EMPHASIS, 0, "accent imbriquée %s" },
{ NESTED_QUOTATION, 0, "imbriqué \"q\" éléments, typo possible" },
{ OBSOLETE_ELEMENT, 0, "remplaçant élément obsolète %s avec %s" },
{ COERCE_TO_ENDTAG_WARN, 0, "<%s> est probablement destinée en tant que </%s>" },
{ REMOVED_HTML5, 0, "L'élément de %s retiré HTML5" },
{ BAD_SUMMARY_HTML5, 0, "L'attribut summary sur l'élément du %s est obsolète dans HTML5" },
{ TRIM_EMPTY_ELEMENT, 0, "rognage vide %s" },
{ REPLACING_ELEMENT, 0, "remplaçant %s avec %s" },
{ COERCE_TO_ENDTAG, 0, "<%s> est probablement destinée en tant que </%s>" },
{ REPLACING_UNEX_ELEMENT, 0, "remplacement inattendu %s avec %s" },
{ MISSING_ENDTAG_FOR, 0, "manquant </%s>" },
{ MISSING_ENDTAG_BEFORE, 0, "manquante </%s> avant %s" },
{ DISCARDING_UNEXPECTED, 0, "rejet inattendu %s" },
{ NON_MATCHING_ENDTAG, 0, "remplacement inattendu %s avec </%s>" },
{ TAG_NOT_ALLOWED_IN, 0, "%s n'est pas autorisé dans <%s> éléments" },
{ MISSING_STARTTAG, 0, "manquant <%s>" },
{ UNEXPECTED_ENDTAG, 0, "rejet inattendu </%s>" },
{ TOO_MANY_ELEMENTS, 0, "trop de %s éléments" },
{ USING_BR_INPLACE_OF, 0, "utilisant <br> à la place de %s" },
{ INSERTING_TAG, 0, "insertion implicite <%s>" },
{ CANT_BE_NESTED, 0, "%s ne peut pas être imbriquée" },
{ PROPRIETARY_ELEMENT, 0, "%s n'est pas approuvé par le W3C" },
{ ILLEGAL_NESTING, 0, "%s ne doivent pas être imbriqués" },
{ NOFRAMES_CONTENT, 0, "%s non à l'intérieur 'noframes'" },
{ UNEXPECTED_END_OF_FILE, 0, "fin inattendue du fichier %s" },
{ ELEMENT_NOT_EMPTY, 0, "%s élément non vide ou pas fermée" },
{ UNEXPECTED_ENDTAG_IN, 0, "inattendus </%s> dans <%s>" },
{ TOO_MANY_ELEMENTS_IN, 0, "trop de %s éléments dans <%s>" },
{ UNESCAPED_ELEMENT, 0, "unescaped %s dans le contenu pre" },
{ DOCTYPE_AFTER_TAGS, 0, "<! DOCTYPE> est pas autorisé après éléments" },
{ MISSING_TITLE_ELEMENT, 0, "insertion manquante élément 'title'" },
{ INCONSISTENT_VERSION, 0, "DOCTYPE HTML ne correspond pas à un contenu" },
{ MISSING_DOCTYPE, 0, "manquante <!DOCTYPE> déclaration" },
{ CONTENT_AFTER_BODY, 0, "contenu se produit après la fin du body" },
{ MALFORMED_COMMENT, 0, "tirets adjacents dans un commentaire" },
{ BAD_COMMENT_CHARS, 0, "attendre -- ou >" },
{ BAD_CDATA_CONTENT, 0, "'<' + '/' + lettre non permis ici" },
{ INCONSISTENT_NAMESPACE, 0, "le namespace HTML ne correspond pas au contenu" },
{ SPACE_PRECEDING_XMLDECL, 0, "supprimant l'espace blanc précédent Déclaration XML" },
{ MALFORMED_DOCTYPE, 0, "en rejetant malformé <!DOCTYPE>" },
{ BAD_XML_COMMENT, 0, "commentaires XML ne peut pas contenir --" },
{ DTYPE_NOT_UPPER_CASE, 0, "SYSTEM, PUBLIC, W3C, DTD, EN doit être en majuscules" },
{ ENCODING_IO_CONFLICT, 0, "encodage de sortie ne fonctionne pas avec la sortie standard" },
{ SUSPECTED_MISSING_QUOTE, 0, "manquant guillemet pour la valeur d'attribut" },
{ DUPLICATE_FRAMESET, 0, "élément répété FRAMESET" },
{ UNKNOWN_ELEMENT, 0, "%s n'est pas reconnue !" },
{ PREVIOUS_LOCATION, 0, "<%s> précédemment mentionnés" },
{ UNKNOWN_ELEMENT, 0, "%s n'est pas reconnue !" },
{ PREVIOUS_LOCATION, 0, "<%s> précédemment mentionnés" },
{ TidyXmlDecl, 0,
"Cette option spécifie si Tidy devrait ajouter la déclaration XML lors de la sortie "
"XML ou XHTML. <br/> Notez que si l'entrée comprend déjà un <code> & lt;?xml ... &&gt;"
@ -436,8 +428,8 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"navigateurs de traitement. Tidy quitte le DOCTYPE pour les documents XML génériques "
"inchangés. <br/> Cette option ne permet pas une validation du document de conformité."
},
{ TidyDropEmptyElems, 0, "Cette option spécifie si Tidy doit jeter des éléments vides." },
{ TidyDropEmptyParas, 0, "Cette option spécifie si Tidy doit jeter des paragraphes vides." },
{ TidyDropEmptyElems, 0, "Cette option spécifie si Tidy doit jeter des éléments vides." },
{ TidyDropEmptyParas, 0, "Cette option spécifie si Tidy doit jeter des paragraphes vides." },
{ TidyFixUri, 0,
"Cette option spécifie si Tidy doit vérifier les valeurs d'attributs qui portent URI "
"pour des caractères illégaux et si ce sont trouvés, leur échapper en HTML 4 "
@ -457,23 +449,25 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"Cette option spécifie que Tidy doit ignorer les balises imbriquées lors de l'analyse "
"des données de script et de style."
},
{ TC_CAT_DIAGNOSTICS, 0, "diagnostics" },
{ TC_CAT_ENCODING, 0, "encoding" },
{ TC_CAT_MARKUP, 0, "markup" },
{ TC_CAT_MISC, 0, "misc" },
{ TC_CAT_PRETTYPRINT, 0, "imprimer" },
{ TC_LABEL_COL, 0, "colonne" },
{ TC_LABEL_FILE, 0, "fichier" },
{ TC_LABEL_LANG, 0, "lang" },
{ TC_LABEL_LEVL, 0, "niveau" },
{ TC_LABEL_OPT, 0, "option" },
{ TC_MAIN_ERROR_LOAD_CONFIG, 0, "Chargement du fichier de configuration \"%s\" a échoué, err =%d" },
#if SUPPORT_CONSOLE_APP
{ TidyDiagnostics, 0, "diagnostics" },
{ TidyEncoding, 0, "encoding" },
{ TidyMarkup, 0, "markup" },
{ TidyMiscellaneous, 0, "misc" },
{ TidyPrettyPrint, 0, "imprimer" },
{ TC_LABEL_COL, 0, "colonne" },
{ TC_LABEL_FILE, 0, "fichier" },
{ TC_LABEL_LANG, 0, "lang" },
{ TC_LABEL_LEVL, 0, "niveau" },
{ TC_LABEL_OPT, 0, "option" },
{ TC_MAIN_ERROR_LOAD_CONFIG, 0, "Chargement du fichier de configuration \"%s\" a échoué, err =%d" },
{ TC_OPT_ACCESS, 0,
"faire des vérifications d'accessibilité supplémentaires (<niveau> = 0, 1, 2, 3). 0 "
"est supposé si <niveau> est manquant."
},
{ TC_OPT_ASCII, 0, "utiliser ISO-8859-1 pour l'entrée, US-ASCII pour la sortie" },
{ TC_OPT_UPPER, 0, "balises de force en majuscules" },
{ TC_OPT_ASCII, 0, "utiliser ISO-8859-1 pour l'entrée, US-ASCII pour la sortie" },
{ TC_OPT_UPPER, 0, "balises de force en majuscules" },
{ TC_TXT_HELP_3, 0,
"\n"
"Options de configuration Tidy\n"
@ -522,9 +516,9 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"--wrap 72 --indent pas\n"
"\n"
},
{ TC_TXT_HELP_CONFIG_NAME, 0, "Nom" },
{ TC_TXT_HELP_CONFIG_TYPE, 0, "Type" },
{ TC_TXT_HELP_CONFIG_ALLW, 0, "Les valeurs autorisées" },
{ TC_TXT_HELP_CONFIG_NAME, 0, "Nom" },
{ TC_TXT_HELP_CONFIG_TYPE, 0, "Type" },
{ TC_TXT_HELP_CONFIG_ALLW, 0, "Les valeurs autorisées" },
{ TC_TXT_HELP_LANG_1, 0,
"\n"
"L'option --language (ou --lang) indique la langue Tidy\n"
@ -562,6 +556,7 @@ static languageDefinition language_fr = { whichPluralForm_fr, {
"du système pour plus d'informations.\n"
"\n"
},
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */
TIDY_MESSAGE_TYPE_LAST, 0, NULL

View file

@ -21,24 +21,20 @@
* `poconvert.rb msgunfmt language_zh_cn.h` (our own
* 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.
*
* Template Created by Jim Derry on 01/14/2016.
*
* Orginating PO file metadata:
* 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
#pragma execution_character_set("utf-8")
#endif
#include "language.h"
#include "access.h"
#include "message.h"
/**
* 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" },
{ LINE_COLUMN_STRING, 0, "行 %d 列 %d - " },
{ STRING_CONTENT_LOOKS, 0, "文档内容看起来像 %s" },
#if SUPPORT_CONSOLE_APP
{ TC_STRING_VERS_A, 0, "HTML Tidy 用于 %s 版本 %s" },
{ TC_STRING_VERS_B, 0, "HTML Tidy 版本 %s" },
#endif /* SUPPORT_CONSOLE_APP */
{/* This MUST be present and last. */
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__
#define __MESSAGE_H__
/* message.h -- general message writing routines
(c) 1998-2007 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
/*********************************************************************
* General Message Writing Routines
*
* 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 "tidy.h" /* For TidyReportLevel */
#include "language.h"
/* General message writing routines.
** 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.
*/
/* Release Information */
ctmbstr TY_(ReleaseDate)(void);
ctmbstr TY_(tidyLibraryVersion)(void);
void TY_(ReportUnknownOption)( TidyDocImpl* doc, ctmbstr option );
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
/* High Level Message Writing Functions - General */
void TY_(ReportNotice)(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_(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
* 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[]!
* 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.
*/
typedef enum {
/* This MUST be present and first. */
CODES_TIDY_ERROR_FIRST = 200,
ctmbstr TY_(tidyErrorCodeAsKey)(uint code);
/* 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
* have associated localized strings to describe them.
* 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();
*/
typedef enum {
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. */
LINE_COLUMN_STRING, /* For retrieving localized `line %d column %d` text. */
STRING_CONTENT_LOOKS, /* `Document content looks like %s`. */
STRING_DISCARDING, /* For `discarding`. */
STRING_DOCTYPE_GIVEN, /* `Doctype given is \"%s\". */
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;
TidyIterator TY_(getErrorCodeList)();
/**
* Returns the next error code having initialized the iterator
* with `getErrorCodeList()`. You can use tidyErrorCodeAsKey
* to determine the key for this value.
*/
uint TY_(getNextErrorCode)( TidyIterator* iter );
/** @} */
/* accessibility flaws */

View file

@ -31,6 +31,7 @@
#include "tmbstr.h"
#include "utf8.h"
#include "mappedio.h"
#include "language.h"
#ifdef TIDY_WIN32_MLANG_SUPPORT
#include "win32tc.h"
@ -211,6 +212,11 @@ ctmbstr TIDY_CALL tidyReleaseDate(void)
return TY_(ReleaseDate)();
}
ctmbstr TIDY_CALL tidyLibraryVersion(void)
{
return TY_(tidyLibraryVersion)();
}
/* Get/set configuration options
*/
@ -519,6 +525,8 @@ ctmbstr TIDY_CALL tidyOptGetDoc( TidyDoc ARG_UNUSED(tdoc), TidyOption opt )
return tidyLocalizedString(optId);
}
#if SUPPORT_CONSOLE_APP
/* TODO - GROUP ALL CONSOLE-ONLY FUNCTIONS */
TidyIterator TIDY_CALL tidyOptGetDocLinksList( TidyDoc ARG_UNUSED(tdoc), TidyOption 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)NULL;
}
#endif /* SUPPORT_CONSOLE_APP */
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
* 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.
** See the string definitions in language.h
** See the string key definitions in tidyenum.h.
*/
Bool TIDY_CALL tidySetReportFilter3( TidyDoc tdoc, TidyReportFilter3 filt )
{
@ -2346,6 +2355,115 @@ Bool TIDY_CALL tidyAttrIsProp( TidyAttr tattr )
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:
* mode: c