Browse Source

embedded HTML Tidy library

master
hrbrmstr 5 years ago
parent
commit
0a142afbd4
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. BIN
      .DS_Store
  2. 16
      DESCRIPTION
  3. 2
      NAMESPACE
  4. 6
      NEWS.md
  5. 6
      R/RcppExports.R
  6. 12
      README.Rmd
  7. 16
      README.md
  8. 6
      man/tidy_html.Rd
  9. BIN
      src/.DS_Store
  10. 3
      src/Makevars
  11. 16
      src/RcppExports.cpp
  12. 3305
      src/access.c
  13. 281
      src/access.h
  14. 118
      src/alloc.c
  15. 204
      src/attrask.c
  16. 3619
      src/attrdict.c
  17. 156
      src/attrdict.h
  18. 208
      src/attrget.c
  19. 2315
      src/attrs.c
  20. 458
      src/attrs.h
  21. 226
      src/buffio.c
  22. 6
      src/buffio.h
  23. 1031
      src/charsets.c
  24. 13
      src/charsets.h
  25. 2692
      src/clean.c
  26. 82
      src/clean.h
  27. 1788
      src/config.c
  28. 146
      src/config.h
  29. 424
      src/entities.c
  30. 18
      src/entities.h
  31. 116
      src/fileio.c
  32. 42
      src/fileio.h
  33. 63
      src/forward.h
  34. 174
      src/gdoc.c
  35. 19
      src/gdoc.h
  36. 20
      src/htmltidy.cpp
  37. 104
      src/iconvtc.c
  38. 14
      src/iconvtc.h
  39. 380
      src/istack.c
  40. 959
      src/language.c
  41. 332
      src/language.h
  42. 2353
      src/language_en.h
  43. 132
      src/language_en_gb.h
  44. 138
      src/language_es.h
  45. 82
      src/language_es_mx.h
  46. 573
      src/language_fr.h
  47. 81
      src/language_zh_cn.h
  48. 4289
      src/lexer.c
  49. 620
      src/lexer.h
  50. 343
      src/mappedio.c
  51. 15
      src/mappedio.h
  52. 1102
      src/message.c
  53. 282
      src/message.h
  54. 5057
      src/parser.c
  55. 70
      src/parser.h
  56. 6
      src/platform.h
  57. 2564
      src/pprint.c
  58. 94
      src/pprint.h
  59. 446
      src/sprtf.c
  60. 77
      src/sprtf.h
  61. 1392
      src/streamio.c
  62. 210
      src/streamio.h
  63. 285
      src/tagask.c
  64. 1123
      src/tags.c
  65. 247
      src/tags.h
  66. 159
      src/tidy-int.h
  67. 1153
      src/tidy.h
  68. 112
      src/tidybuffio.h
  69. 858
      src/tidyenum.h
  70. 2356
      src/tidylib.c
  71. 635
      src/tidyplatform.h
  72. 295
      src/tmbstr.c
  73. 86
      src/tmbstr.h
  74. 533
      src/utf8.c
  75. 46
      src/utf8.h
  76. 23
      src/version.h
  77. 794
      src/win32tc.c
  78. 18
      src/win32tc.h
  79. 6
      tests/testthat/test-htmltidy.R

BIN
.DS_Store

Binary file not shown.

16
DESCRIPTION

@ -1,12 +1,20 @@
Package: htmltidy
Title: Clean up gnarly HTML/XML
Version: 0.1.0.9000
Authors@R: c(person("Bob", "Rudis", email = "bob@rudis.net", role = c("aut", "cre")))
Description: Clean up gnarly HTML/XML
Title: Clean Up Gnarly HTML/XML
Version: 0.2.0.9000
Authors@R: c(
person("Bob", "Rudis", email = "bob@rudis.net", role = c("aut", "cre")),
person("Dave", "Dave", email = "dsr@w3.org", role = c("ctb", "aut"),
comment="HTML Tidy library")
)
Maintainer: Bob Rudis <bob@rud.is>
Description: HTML and XML documents can be beautiful and pristine. They can also be
wretched, evil, malformed hellspawn. Now, you can tidy up that HTML and XML before
processing it with your favorite angle-bracket parsing tools.
Depends:
R (>= 3.3.0)
License: AGPL + file LICENSE
LazyData: true
NeedsCompilation: yes
Suggests:
testthat,
xml2

2
NAMESPACE

@ -1,5 +1,5 @@
# Generated by roxygen2: do not edit by hand
export(tidy)
export(tidy_html)
importFrom(Rcpp,sourceCpp)
useDynLib(htmltidy)

6
NEWS.md

@ -1,3 +1,9 @@
# htmltidy 0.2.0.9000
* Bundled tidy-html5 library with the package
* Modified tests
# htmltidy 0.1.0.9000
* Added a `NEWS.md` file to track changes to the package.

6
R/RcppExports.R

@ -1,11 +1,11 @@
# This file was generated by Rcpp::compileAttributes
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Tidy HTML/XML
#'
#' @param source length 1 character vetor containing the HTML/XML source to process
#' @export
tidy <- function(source) {
.Call('htmltidy_tidy', PACKAGE = 'htmltidy', source)
tidy_html <- function(source) {
.Call('htmltidy_tidy_html', PACKAGE = 'htmltidy', source)
}

12
README.Rmd

@ -21,20 +21,16 @@ knitr::opts_chunk$set(
Inspired by [this SO question](http://stackoverflow.com/questions/37061873/identify-a-weblink-in-bold-in-r) and because there's a great deal of cruddy HTML out there that needs fixing to use properly when scraping data.
NOTE: Requires [`libtidy`](http://www.html-tidy.org/) and presently is super-basic (no way to set options and pretty much only does HTML)
You'll need to first do a `brew install tidy-html5` on MacOS or `apt-get install libtidy-dev` on Ubuntu/Debian to get this to work. NOTE that the linux libraries may be older and return slightly different (but no less tidy) HTML.
**SEEKING COLLABORATORS**
It relies on a locally included version of [`libtidy`](http://www.html-tidy.org/) and presently is super-basic (no way to set options and pretty much only does HTML)
This works enough for me to use in a pinch. It should be straightforward (but tedious) to:
- enable passing options in a `list`
- bundle `libtidy` _with the package_ and get it to work on Windows, linux & MacOS as the library compiles on all three with the necessary tools.
- Getting it to work on Windows.
The following functions are implemented:
- `tidy` : Clean up gnarly HTML/XML
- `tidy_html` : Clean up gnarly HTML/XML
### Installation
@ -54,7 +50,7 @@ library(htmltidy)
# current verison
packageVersion("htmltidy")
cat(tidy("<b><p><a href='http://google.com'>google &gt</a></p></b>"))
cat(tidy_html("<b><p><a href='http://google.com'>google &gt</a></p></b>"))
```
### Code of Conduct

16
README.md

@ -6,20 +6,16 @@
Inspired by [this SO question](http://stackoverflow.com/questions/37061873/identify-a-weblink-in-bold-in-r) and because there's a great deal of cruddy HTML out there that needs fixing to use properly when scraping data.
NOTE: Requires [`libtidy`](http://www.html-tidy.org/) and presently is super-basic (no way to set options and pretty much only does HTML)
You'll need to first do a `brew install tidy-html5` on MacOS or `apt-get install libtidy-dev` on Ubuntu/Debian to get this to work. NOTE that the linux libraries may be older and return slightly different (but no less tidy) HTML.
**SEEKING COLLABORATORS**
It relies on a locally included version of [`libtidy`](http://www.html-tidy.org/) and presently is super-basic (no way to set options and pretty much only does HTML)
This works enough for me to use in a pinch. It should be straightforward (but tedious) to:
- enable passing options in a `list`
- bundle `libtidy` *with the package* and get it to work on Windows, linux & MacOS as the library compiles on all three with the necessary tools.
- Getting it to work on Windows.
The following functions are implemented:
- `tidy` : Clean up gnarly HTML/XML
- `tidy_html` : Clean up gnarly HTML/XML
### Installation
@ -34,14 +30,14 @@ library(htmltidy)
# current verison
packageVersion("htmltidy")
#> [1] '0.1.0.9000'
#> [1] '0.2.0.9000'
cat(tidy("<b><p><a href='http://google.com'>google &gt</a></p></b>"))
cat(tidy_html("<b><p><a href='http://google.com'>google &gt</a></p></b>"))
#> <!DOCTYPE html>
#> <html xmlns="http://www.w3.org/1999/xhtml">
#> <head>
#> <meta name="generator" content=
#> "HTML Tidy for HTML5 for Mac OS X version 5.2.0" />
#> "HTML Tidy for HTML5 for R version 5.0.0" />
#> <title></title>
#> </head>
#> <body>

6
man/tidy.Rd → man/tidy_html.Rd

@ -1,10 +1,10 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/RcppExports.R
\name{tidy}
\alias{tidy}
\name{tidy_html}
\alias{tidy_html}
\title{Tidy HTML/XML}
\usage{
tidy(source)
tidy_html(source)
}
\arguments{
\item{source}{length 1 character vetor containing the HTML/XML source to process}

BIN
src/.DS_Store

Binary file not shown.

3
src/Makevars

@ -1 +1,2 @@
PKG_LIBS=-ltidy
PKG_CPPFLAGS = -I.
PKG_CXXFLAGS = -I.

16
src/RcppExports.cpp

@ -1,18 +1,18 @@
// This file was generated by Rcpp::compileAttributes
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#include <Rcpp.h>
using namespace Rcpp;
// tidy
std::string tidy(std::string source);
RcppExport SEXP htmltidy_tidy(SEXP sourceSEXP) {
// tidy_html
std::string tidy_html(std::string source);
RcppExport SEXP htmltidy_tidy_html(SEXP sourceSEXP) {
BEGIN_RCPP
Rcpp::RObject __result;
Rcpp::RNGScope __rngScope;
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< std::string >::type source(sourceSEXP);
__result = Rcpp::wrap(tidy(source));
return __result;
rcpp_result_gen = Rcpp::wrap(tidy_html(source));
return rcpp_result_gen;
END_RCPP
}

3305
src/access.c

File diff suppressed because it is too large

281
src/access.h

@ -0,0 +1,281 @@
#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)
*
*********************************************************************/
#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
};
struct _TidyAccessImpl;
typedef struct _TidyAccessImpl TidyAccessImpl;
struct _TidyAccessImpl
{
/* gets set from Tidy variable AccessibilityCheckLevel */
int PRIORITYCHK;
/* Number of characters that are found within the concatenated text */
int counter;
/* list of characters in the text nodes found within a container element */
tmbchar textNode[ TEXTBUF_SIZE ];
/* The list of characters found within one text node */
tmbchar text[ TEXTBUF_SIZE ];
/* Number of frame elements found within a frameset */
int numFrames;
/* Number of 'longdesc' attributes found within a frameset */
int HasCheckedLongDesc;
int CheckedHeaders;
int ListElements;
int OtherListElements;
/* For 'USEMAP' identifier */
Bool HasUseMap;
Bool HasName;
Bool HasMap;
/* For tracking nodes that are deleted from the original parse tree - TRT */
/* Node *access_tree; */
Bool HasTH;
Bool HasValidFor;
Bool HasValidId;
Bool HasValidRowHeaders;
Bool HasValidColumnHeaders;
Bool HasInvalidRowHeader;
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_(AccessibilityChecks)( TidyDocImpl* doc );
#endif /* SUPPORT_ACCESSIBILITY_CHECKS */
#endif /* __ACCESS_H__ */

118
src/alloc.c

@ -0,0 +1,118 @@
/* alloc.c -- Default memory allocation routines.
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
/* #define DEBUG_MEMORY very NOISY extra DEBUG of memory allocation, reallocation and free */
#include "tidy.h"
#include "forward.h"
#ifdef DEBUG_MEMORY
#include "sprtf.h"
#endif
static TidyMalloc g_malloc = NULL;
static TidyRealloc g_realloc = NULL;
static TidyFree g_free = NULL;
static TidyPanic g_panic = NULL;
Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc )
{
g_malloc = fmalloc;
return yes;
}
Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc )
{
g_realloc = frealloc;
return yes;
}
Bool TIDY_CALL tidySetFreeCall( TidyFree ffree )
{
g_free = ffree;
return yes;
}
Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic )
{
g_panic = fpanic;
return yes;
}
static void TIDY_CALL defaultPanic( TidyAllocator* ARG_UNUSED(allocator), ctmbstr msg )
{
if ( g_panic )
g_panic( msg );
else
{
/* 2 signifies a serious error */
fprintf( stderr, "Fatal error: %s\n", msg );
#ifdef _DEBUG
assert(0);
#endif
exit(2);
}
}
static void* TIDY_CALL defaultAlloc( TidyAllocator* allocator, size_t size )
{
void *p = ( g_malloc ? g_malloc(size) : malloc(size) );
if ( !p )
defaultPanic( allocator,"Out of memory!");
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY)
SPRTF("alloc MEM %p, size %d\n", p, (int)size );
if (size == 0) {
SPRTF("NOTE: An allocation of ZERO bytes!!!!!!\n");
}
#endif
return p;
}
static void* TIDY_CALL defaultRealloc( TidyAllocator* allocator, void* mem, size_t newsize )
{
void *p;
if ( mem == NULL )
return defaultAlloc( allocator, newsize );
p = ( g_realloc ? g_realloc(mem, newsize) : realloc(mem, newsize) );
if (!p)
defaultPanic( allocator, "Out of memory!");
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY)
SPRTF("realloc MEM %p, size %d\n", p, (int)newsize );
#endif
return p;
}
static void TIDY_CALL defaultFree( TidyAllocator* ARG_UNUSED(allocator), void* mem )
{
if ( mem )
{
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY)
SPRTF("free MEM %p\n", mem );
#endif
if ( g_free )
g_free( mem );
else
free( mem );
}
}
static const TidyAllocatorVtbl defaultVtbl = {
defaultAlloc,
defaultRealloc,
defaultFree,
defaultPanic
};
TidyAllocator TY_(g_default_allocator) = {
&defaultVtbl
};
/*
* local variables:
* mode: c
* indent-tabs-mode: nil
* c-basic-offset: 4
* eval: (c-set-offset 'substatement-open 0)
* end:
*/

204
src/attrask.c

@ -0,0 +1,204 @@
/* attrask.c -- Interrogate attribute type
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
#include "tidy-int.h"
#include "tidy.h"
#include "attrs.h"
Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr )
{
return attrIsHREF( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr )
{
return attrIsSRC( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr )
{
return attrIsID( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr )
{
return attrIsNAME( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr )
{
return attrIsSUMMARY( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr )
{
return attrIsALT( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr )
{
return attrIsLONGDESC( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr )
{
return attrIsUSEMAP( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr )
{
return attrIsISMAP( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr )
{
return attrIsLANGUAGE( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr )
{
return attrIsTYPE( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr )
{
return attrIsVALUE( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr )
{
return attrIsCONTENT( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr )
{
return attrIsTITLE( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr )
{
return attrIsXMLNS( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr )
{
return attrIsDATAFLD( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr )
{
return attrIsWIDTH( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr )
{
return attrIsHEIGHT( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr )
{
return attrIsFOR( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr )
{
return attrIsSELECTED( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr )
{
return attrIsCHECKED( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr )
{
return attrIsLANG( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr )
{
return attrIsTARGET( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr )
{
return attrIsHTTP_EQUIV( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr )
{
return attrIsREL( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr )
{
return TY_(attrIsEvent)( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr )
{
return attrIsOnMOUSEMOVE( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr )
{
return attrIsOnMOUSEDOWN( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr )
{
return attrIsOnMOUSEUP( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr )
{
return attrIsOnCLICK( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr )
{
return attrIsOnMOUSEOVER( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr )
{
return attrIsOnMOUSEOUT( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr )
{
return attrIsOnKEYDOWN( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr )
{
return attrIsOnKEYUP( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr )
{
return attrIsOnKEYPRESS( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr )
{
return attrIsOnFOCUS( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr )
{
return attrIsOnBLUR( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr )
{
return attrIsBGCOLOR( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr )
{
return attrIsLINK( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr )
{
return attrIsALINK( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr )
{
return attrIsVLINK( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr )
{
return attrIsTEXT( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr )
{
return attrIsSTYLE( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr )
{
return attrIsABBR( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr )
{
return attrIsCOLSPAN( tidyAttrToImpl(tattr) );
}
Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr )
{
return attrIsROWSPAN( tidyAttrToImpl(tattr) );
}
/*
* local variables:
* mode: c
* indent-tabs-mode: nil
* c-basic-offset: 4
* eval: (c-set-offset 'substatement-open 0)
* end:
*/

3619
src/attrdict.c

File diff suppressed because it is too large

156
src/attrdict.h

@ -0,0 +1,156 @@
#ifndef __ATTRDICT_H__
#define __ATTRDICT_H__
/* attrdict.h -- extended attribute information
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
#include "tidy.h"
typedef struct _AttrVersion
{
TidyAttrId attribute;
uint versions;
} AttrVersion;
extern const AttrVersion TY_(W3CAttrsFor_A)[];
extern const AttrVersion TY_(W3CAttrsFor_ABBR)[];
extern const AttrVersion TY_(W3CAttrsFor_ACRONYM)[];
extern const AttrVersion TY_(W3CAttrsFor_ADDRESS)[];
extern const AttrVersion TY_(W3CAttrsFor_APPLET)[];
extern const AttrVersion TY_(W3CAttrsFor_AREA)[];
extern const AttrVersion TY_(W3CAttrsFor_B)[];
extern const AttrVersion TY_(W3CAttrsFor_BASE)[];
extern const AttrVersion TY_(W3CAttrsFor_BASEFONT)[];
extern const AttrVersion TY_(W3CAttrsFor_BDO)[];
extern const AttrVersion TY_(W3CAttrsFor_BIG)[];
extern const AttrVersion TY_(W3CAttrsFor_BLOCKQUOTE)[];
extern const AttrVersion TY_(W3CAttrsFor_BODY)[];
extern const AttrVersion TY_(W3CAttrsFor_BR)[];
extern const AttrVersion TY_(W3CAttrsFor_BUTTON)[];
extern const AttrVersion TY_(W3CAttrsFor_CAPTION)[];
extern const AttrVersion TY_(W3CAttrsFor_CENTER)[];
extern const AttrVersion TY_(W3CAttrsFor_CITE)[];
extern const AttrVersion TY_(W3CAttrsFor_CODE)[];
extern const AttrVersion TY_(W3CAttrsFor_COL)[];
extern const AttrVersion TY_(W3CAttrsFor_COLGROUP)[];
extern const AttrVersion TY_(W3CAttrsFor_DD)[];
extern const AttrVersion TY_(W3CAttrsFor_DEL)[];
extern const AttrVersion TY_(W3CAttrsFor_DFN)[];
extern const AttrVersion TY_(W3CAttrsFor_DIR)[];
extern const AttrVersion TY_(W3CAttrsFor_DIV)[];
extern const AttrVersion TY_(W3CAttrsFor_DL)[];
extern const AttrVersion TY_(W3CAttrsFor_DT)[];
extern const AttrVersion TY_(W3CAttrsFor_EM)[];
extern const AttrVersion TY_(W3CAttrsFor_FIELDSET)[];
extern const AttrVersion TY_(W3CAttrsFor_FONT)[];
extern const AttrVersion TY_(W3CAttrsFor_FORM)[];
extern const AttrVersion TY_(W3CAttrsFor_FRAME)[];
extern const AttrVersion TY_(W3CAttrsFor_FRAMESET)[];
extern const AttrVersion TY_(W3CAttrsFor_H1)[];
extern const AttrVersion TY_(W3CAttrsFor_H2)[];
extern const AttrVersion TY_(W3CAttrsFor_H3)[];
extern const AttrVersion TY_(W3CAttrsFor_H4)[];
extern const AttrVersion TY_(W3CAttrsFor_H5)[];
extern const AttrVersion TY_(W3CAttrsFor_H6)[];
extern const AttrVersion TY_(W3CAttrsFor_HEAD)[];
extern const AttrVersion TY_(W3CAttrsFor_HR)[];
extern const AttrVersion TY_(W3CAttrsFor_HTML)[];
extern const AttrVersion TY_(W3CAttrsFor_I)[];
extern const AttrVersion TY_(W3CAttrsFor_IFRAME)[];
extern const AttrVersion TY_(W3CAttrsFor_IMG)[];
extern const AttrVersion TY_(W3CAttrsFor_INPUT)[];
extern const AttrVersion TY_(W3CAttrsFor_INS)[];
extern const AttrVersion TY_(W3CAttrsFor_ISINDEX)[];
extern const AttrVersion TY_(W3CAttrsFor_KBD)[];
extern const AttrVersion TY_(W3CAttrsFor_LABEL)[];
extern const AttrVersion TY_(W3CAttrsFor_LEGEND)[];
extern const AttrVersion TY_(W3CAttrsFor_LI)[];
extern const AttrVersion TY_(W3CAttrsFor_LINK)[];
extern const AttrVersion TY_(W3CAttrsFor_LISTING)[];
extern const AttrVersion TY_(W3CAttrsFor_MAP)[];
extern const AttrVersion TY_(W3CAttrsFor_MATHML)[]; /* [i_a]2 */
extern const AttrVersion TY_(W3CAttrsFor_MENU)[];
extern const AttrVersion TY_(W3CAttrsFor_META)[];
extern const AttrVersion TY_(W3CAttrsFor_NEXTID)[];
extern const AttrVersion TY_(W3CAttrsFor_NOFRAMES)[];
extern const AttrVersion TY_(W3CAttrsFor_NOSCRIPT)[];
extern const AttrVersion TY_(W3CAttrsFor_OBJECT)[];
extern const AttrVersion TY_(W3CAttrsFor_OL)[];
extern const AttrVersion TY_(W3CAttrsFor_OPTGROUP)[];
extern const AttrVersion TY_(W3CAttrsFor_OPTION)[];
extern const AttrVersion TY_(W3CAttrsFor_P)[];
extern const AttrVersion TY_(W3CAttrsFor_PARAM)[];
extern const AttrVersion TY_(W3CAttrsFor_PICTURE)[]; /* Issue #151 - html5 */
extern const AttrVersion TY_(W3CAttrsFor_PLAINTEXT)[];
extern const AttrVersion TY_(W3CAttrsFor_PRE)[];
extern const AttrVersion TY_(W3CAttrsFor_Q)[];
extern const AttrVersion TY_(W3CAttrsFor_RB)[];
extern const AttrVersion TY_(W3CAttrsFor_RBC)[];
extern const AttrVersion TY_(W3CAttrsFor_RP)[];
extern const AttrVersion TY_(W3CAttrsFor_RT)[];
extern const AttrVersion TY_(W3CAttrsFor_RTC)[];
extern const AttrVersion TY_(W3CAttrsFor_RUBY)[];
extern const AttrVersion TY_(W3CAttrsFor_S)[];
extern const AttrVersion TY_(W3CAttrsFor_SAMP)[];
extern const AttrVersion TY_(W3CAttrsFor_SCRIPT)[];
extern const AttrVersion TY_(W3CAttrsFor_SELECT)[];
extern const AttrVersion TY_(W3CAttrsFor_SMALL)[];
extern const AttrVersion TY_(W3CAttrsFor_SPAN)[];
extern const AttrVersion TY_(W3CAttrsFor_STRIKE)[];
extern const AttrVersion TY_(W3CAttrsFor_STRONG)[];
extern const AttrVersion TY_(W3CAttrsFor_STYLE)[];
extern const AttrVersion TY_(W3CAttrsFor_SUB)[];
extern const AttrVersion TY_(W3CAttrsFor_SUP)[];
extern const AttrVersion TY_(W3CAttrsFor_SVG)[];
extern const AttrVersion TY_(W3CAttrsFor_TABLE)[];
extern const AttrVersion TY_(W3CAttrsFor_TBODY)[];
extern const AttrVersion TY_(W3CAttrsFor_TD)[];
extern const AttrVersion TY_(W3CAttrsFor_TEXTAREA)[];
extern const AttrVersion TY_(W3CAttrsFor_TFOOT)[];
extern const AttrVersion TY_(W3CAttrsFor_TH)[];
extern const AttrVersion TY_(W3CAttrsFor_THEAD)[];
extern const AttrVersion TY_(W3CAttrsFor_TITLE)[];
extern const AttrVersion TY_(W3CAttrsFor_TR)[];
extern const AttrVersion TY_(W3CAttrsFor_TT)[];
extern const AttrVersion TY_(W3CAttrsFor_U)[];
extern const AttrVersion TY_(W3CAttrsFor_UL)[];
extern const AttrVersion TY_(W3CAttrsFor_VAR)[];
extern const AttrVersion TY_(W3CAttrsFor_XMP)[];
extern const AttrVersion TY_(W3CAttrsFor_TRACK)[];
extern const AttrVersion TY_(W3CAttrsFor_SUMMARY)[];
extern const AttrVersion TY_(W3CAttrsFor_FIGCAPTION)[];
extern const AttrVersion TY_(W3CAttrsFor_HGROUP)[];
extern const AttrVersion TY_(W3CAttrsFor_FIGURE)[];
extern const AttrVersion TY_(W3CAttrsFor_ARTICLE)[];
extern const AttrVersion TY_(W3CAttrsFor_ASIDE)[];
extern const AttrVersion TY_(W3CAttrsFor_BDI)[];
extern const AttrVersion TY_(W3CAttrsFor_NAV)[];
extern const AttrVersion TY_(W3CAttrsFor_SECTION)[];
extern const AttrVersion TY_(W3CAttrsFor_FOOTER)[];
extern const AttrVersion TY_(W3CAttrsFor_HEADER)[];
extern const AttrVersion TY_(W3CAttrsFor_DETAILS)[];
extern const AttrVersion TY_(W3CAttrsFor_DIALOG)[];
extern const AttrVersion TY_(W3CAttrsFor_COMMAND)[];
extern const AttrVersion TY_(W3CAttrsFor_MAIN)[];
extern const AttrVersion TY_(W3CAttrsFor_MARK)[];
extern const AttrVersion TY_(W3CAttrsFor_OUTPUT)[];
extern const AttrVersion TY_(W3CAttrsFor_MENUITEM)[];
extern const AttrVersion TY_(W3CAttrsFor_METER)[];
extern const AttrVersion TY_(W3CAttrsFor_PROGRESS)[];
extern const AttrVersion TY_(W3CAttrsFor_TEMPLATE)[];
extern const AttrVersion TY_(W3CAttrsFor_TIME)[];
extern const AttrVersion TY_(W3CAttrsFor_DATALIST)[];
extern const AttrVersion TY_(W3CAttrsFor_AUDIO)[];
extern const AttrVersion TY_(W3CAttrsFor_VIDEO)[];
extern const AttrVersion TY_(W3CAttrsFor_CANVAS)[];
extern const AttrVersion TY_(W3CAttrsFor_SOURCE)[];
extern const AttrVersion TY_(W3CAttrsFor_EMBED)[];
extern const AttrVersion TY_(W3CAttrsFor_KEYGEN)[];
extern const AttrVersion TY_(W3CAttrsFor_WBR)[];
#endif /* __ATTRDICT_H__ */

208
src/attrget.c

@ -0,0 +1,208 @@
/* attrget.c -- Locate attribute value by type
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
#include "tidy-int.h"
#include "tags.h"
#include "attrs.h"
#include "tidy.h"
TidyAttr TIDY_CALL tidyAttrGetById( TidyNode tnod, TidyAttrId attId )
{
Node* nimp = tidyNodeToImpl(tnod);
return tidyImplToAttr( TY_(AttrGetById)( nimp, attId ) );
}
TidyAttr TIDY_CALL tidyAttrGetHREF( TidyNode tnod )
{
return tidyImplToAttr( attrGetHREF( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetSRC( TidyNode tnod )
{
return tidyImplToAttr( attrGetSRC( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetID( TidyNode tnod )
{
return tidyImplToAttr( attrGetID( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetNAME( TidyNode tnod )
{
return tidyImplToAttr( attrGetNAME( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetSUMMARY( TidyNode tnod )
{
return tidyImplToAttr( attrGetSUMMARY( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetALT( TidyNode tnod )
{
return tidyImplToAttr( attrGetALT( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetLONGDESC( TidyNode tnod )
{
return tidyImplToAttr( attrGetLONGDESC( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetUSEMAP( TidyNode tnod )
{
return tidyImplToAttr( attrGetUSEMAP( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetISMAP( TidyNode tnod )
{
return tidyImplToAttr( attrGetISMAP( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetLANGUAGE( TidyNode tnod )
{
return tidyImplToAttr( attrGetLANGUAGE( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetTYPE( TidyNode tnod )
{
return tidyImplToAttr( attrGetTYPE( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetVALUE( TidyNode tnod )
{
return tidyImplToAttr( attrGetVALUE( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetCONTENT( TidyNode tnod )
{
return tidyImplToAttr( attrGetCONTENT( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetTITLE( TidyNode tnod )
{
return tidyImplToAttr( attrGetTITLE( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetXMLNS( TidyNode tnod )
{
return tidyImplToAttr( attrGetXMLNS( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetDATAFLD( TidyNode tnod )
{
return tidyImplToAttr( attrGetDATAFLD( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetWIDTH( TidyNode tnod )
{
return tidyImplToAttr( attrGetWIDTH( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetHEIGHT( TidyNode tnod )
{
return tidyImplToAttr( attrGetHEIGHT( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetFOR( TidyNode tnod )
{
return tidyImplToAttr( attrGetFOR( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetSELECTED( TidyNode tnod )
{
return tidyImplToAttr( attrGetSELECTED( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetCHECKED( TidyNode tnod )
{
return tidyImplToAttr( attrGetCHECKED( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetLANG( TidyNode tnod )
{
return tidyImplToAttr( attrGetLANG( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetTARGET( TidyNode tnod )
{
return tidyImplToAttr( attrGetTARGET( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetHTTP_EQUIV( TidyNode tnod )
{
return tidyImplToAttr( attrGetHTTP_EQUIV( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetREL( TidyNode tnod )
{
return tidyImplToAttr( attrGetREL( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEMOVE( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnMOUSEMOVE( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEDOWN( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnMOUSEDOWN( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEUP( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnMOUSEUP( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnCLICK( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnCLICK( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOVER( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnMOUSEOVER( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnMOUSEOUT( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnMOUSEOUT( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnKEYDOWN( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnKEYDOWN( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnKEYUP( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnKEYUP( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnKEYPRESS( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnKEYPRESS( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnFOCUS( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnFOCUS( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetOnBLUR( TidyNode tnod )
{
return tidyImplToAttr( attrGetOnBLUR( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetBGCOLOR( TidyNode tnod )
{
return tidyImplToAttr( attrGetBGCOLOR( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetLINK( TidyNode tnod )
{
return tidyImplToAttr( attrGetLINK( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetALINK( TidyNode tnod )
{
return tidyImplToAttr( attrGetALINK( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetVLINK( TidyNode tnod )
{
return tidyImplToAttr( attrGetVLINK( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetTEXT( TidyNode tnod )
{
return tidyImplToAttr( attrGetTEXT( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetSTYLE( TidyNode tnod )
{
return tidyImplToAttr( attrGetSTYLE( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetABBR( TidyNode tnod )
{
return tidyImplToAttr( attrGetABBR( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetCOLSPAN( TidyNode tnod )
{
return tidyImplToAttr( attrGetCOLSPAN( tidyNodeToImpl(tnod) ) );
}
TidyAttr TIDY_CALL tidyAttrGetROWSPAN( TidyNode tnod )
{
return tidyImplToAttr( attrGetROWSPAN( tidyNodeToImpl(tnod) ) );
}
/*
* local variables:
* mode: c
* indent-tabs-mode: nil
* c-basic-offset: 4
* eval: (c-set-offset 'substatement-open 0)
* end:
*/

2315
src/attrs.c

File diff suppressed because it is too large

458
src/attrs.h

@ -0,0 +1,458 @@
#ifndef __ATTRS_H__
#define __ATTRS_H__
/* attrs.h -- recognize HTML attributes
(c) 1998-2007 (W3C) MIT, ERCIM, Keio University
See tidy.h for the copyright notice.
*/
#include "forward.h"
/* declaration for methods that check attribute values */
typedef void (AttrCheck)(TidyDocImpl* doc, Node *node, AttVal *attval);
struct _Attribute
{
TidyAttrId id;
tmbstr name;
AttrCheck* attrchk;
struct _Attribute* next;
};
/*
Anchor/Node linked list
*/
struct _Anchor
{
struct _Anchor *next;
Node *node;
char *name;
};
typedef struct _Anchor Anchor;
#if !defined(ATTRIBUTE_HASH_LOOKUP)
#define ATTRIBUTE_HASH_LOOKUP 1
#endif
#if ATTRIBUTE_HASH_LOOKUP
enum
{
ATTRIBUTE_HASH_SIZE=178u
};
struct _AttrHash
{
Attribute const* attr;
struct _AttrHash* next;
};
typedef struct _AttrHash AttrHash;
#endif
enum
{
ANCHOR_HASH_SIZE=1021u
};
struct _TidyAttribImpl
{
/* anchor/node lookup */
Anchor* anchor_hash[ANCHOR_HASH_SIZE];
/* Declared literal attributes */
Attribute* declared_attr_list;
#if ATTRIBUTE_HASH_LOOKUP
AttrHash* hashtab[ATTRIBUTE_HASH_SIZE];
#endif
};
typedef struct _TidyAttribImpl TidyAttribImpl;
#define XHTML_NAMESPACE "http://www.w3.org/1999/xhtml"
AttrCheck TY_(CheckUrl);
/* public method for finding attribute definition by name */
const Attribute* TY_(CheckAttribute)( TidyDocImpl* doc, Node *node, AttVal *attval );
const Attribute* TY_(FindAttribute)( TidyDocImpl* doc, AttVal *attval );
AttVal* TY_(GetAttrByName)( Node *node, ctmbstr name );
void TY_(DropAttrByName)( TidyDocImpl* doc, Node *node, ctmbstr name );
AttVal* TY_(AddAttribute)( TidyDocImpl* doc,
Node *node, ctmbstr name, ctmbstr value );
AttVal* TY_(RepairAttrValue)(TidyDocImpl* doc, Node* node, ctmbstr name, ctmbstr value);
Bool TY_(IsUrl)( TidyDocImpl* doc, ctmbstr attrname );
/* Bool IsBool( TidyDocImpl* doc, ctmbstr attrname ); */
Bool TY_(IsScript)( TidyDocImpl* doc, ctmbstr attrname );
/* may id or name serve as anchor? */
Bool TY_(IsAnchorElement)( TidyDocImpl* doc, Node* node );
/*
In CSS1, selectors can contain only the characters A-Z, 0-9, and
Unicode characters 161-255, plus dash (-); they cannot start with
a dash or a digit; they can also contain escaped characters and any
Unicode character as a numeric code (see next item).
The backslash followed by at most four hexadecimal digits (0..9A..F)
stands for the Unicode character with that number.
Any character except a hexadecimal digit can be escaped to remove its
special meaning, by putting a backslash in front.
#508936 - CSS class naming for -clean option
*/
Bool TY_(IsCSS1Selector)( ctmbstr buf );
Bool TY_(IsValidHTMLID)(ctmbstr id);
Bool TY_(IsValidXMLID)(ctmbstr id);
/* removes anchor for specific node */
void TY_(RemoveAnchorByNode)( TidyDocImpl* doc, ctmbstr name, Node *node );
/* free all anchors */
void TY_(FreeAnchors)( TidyDocImpl* doc );
/* public methods for inititializing/freeing attribute dictionary */
void TY_(InitAttrs)( TidyDocImpl* doc );
void TY_(FreeAttrTable)( TidyDocImpl* doc );
void TY_(AppendToClassAttr)( TidyDocImpl* doc, AttVal *classattr, ctmbstr classname );
/*
the same attribute name can't be used
more than once in each element
*/
void TY_(RepairDuplicateAttributes)( TidyDocImpl* doc, Node* node, Bool isXml );
void TY_(SortAttributes)(Node* node, TidyAttrSortStrategy strat);
Bool TY_(IsBoolAttribute)( AttVal* attval );
Bool TY_(attrIsEvent)( AttVal* attval );
AttVal* TY_(AttrGetById)( Node* node, TidyAttrId id );
uint TY_(NodeAttributeVersions)( Node* node, TidyAttrId id );
Bool TY_(AttributeIsProprietary)(Node* node, AttVal* attval);
Bool TY_(AttributeIsMismatched)(Node* node, AttVal* attval, TidyDocImpl* doc);
/* 0 == TidyAttr_UNKNOWN */
#define AttrId(av) ((av) && (av)->dict ? (av)->dict->id : TidyAttr_UNKNOWN)
#define AttrIsId(av, atid) ((av) && (av)->dict && ((av)->dict->id == atid))
#define AttrHasValue(attr) ((attr) && (attr)->value)
#define AttrValueIs(attr, val) (AttrHasValue(attr) && \
TY_(tmbstrcasecmp)((attr)->value, val) == 0)
#define AttrContains(attr, val) (AttrHasValue(attr) && \
TY_(tmbsubstr)((attr)->value, val) != NULL)
#define AttrVersions(attr) ((attr) && (attr)->dict ? (attr)->dict->versions : VERS_PROPRIETARY)
#define AttrsHaveSameId(a, b) (a && b && a->dict && b->dict && a->dict->id && \
b->dict->id && a->dict->id == b->dict->id)
#define attrIsABBR(av) AttrIsId( av, TidyAttr_ABBR )
#define attrIsACCEPT(av) AttrIsId( av, TidyAttr_ACCEPT )
#define attrIsACCEPT_CHARSET(av) AttrIsId( av, TidyAttr_ACCEPT_CHARSET )
#define attrIsACCESSKEY(av) AttrIsId( av, TidyAttr_ACCESSKEY )
#define attrIsACTION(av) AttrIsId( av, TidyAttr_ACTION )
#define attrIsADD_DATE(av) AttrIsId( av, TidyAttr_ADD_DATE )
#define attrIsALIGN(av) AttrIsId( av, TidyAttr_ALIGN )
#define attrIsALINK(av) AttrIsId( av, TidyAttr_ALINK )
#define attrIsALT(av) AttrIsId( av, TidyAttr_ALT )
#define attrIsARCHIVE(av) AttrIsId( av, TidyAttr_ARCHIVE )
#define attrIsAXIS(av) AttrIsId( av, TidyAttr_AXIS )
#define attrIsBACKGROUND(av) AttrIsId( av, TidyAttr_BACKGROUND )
#define attrIsBGCOLOR(av) AttrIsId( av, TidyAttr_BGCOLOR )
#define attrIsBGPROPERTIES(av) AttrIsId( av, TidyAttr_BGPROPERTIES )
#define attrIsBORDER(av) AttrIsId( av, TidyAttr_BORDER )
#define attrIsBORDERCOLOR(av) AttrIsId( av, TidyAttr_BORDERCOLOR )
#define attrIsBOTTOMMARGIN(av) AttrIsId( av, TidyAttr_BOTTOMMARGIN )
#define attrIsCELLPADDING(av) AttrIsId( av, TidyAttr_CELLPADDING )
#define attrIsCELLSPACING(av) AttrIsId( av, TidyAttr_CELLSPACING )
#define attrIsCHAR(av) AttrIsId( av, TidyAttr_CHAR )
#define attrIsCHAROFF(av) AttrIsId( av, TidyAttr_CHAROFF )
#define attrIsCHARSET(av) AttrIsId( av, TidyAttr_CHARSET )
#define attrIsCHECKED(av) AttrIsId( av, TidyAttr_CHECKED )
#define attrIsCITE(av) AttrIsId( av, TidyAttr_CITE )
#define attrIsCLASS(av) AttrIsId( av, TidyAttr_CLASS )
#define attrIsCLASSID(av) AttrIsId( av, TidyAttr_CLASSID )
#define attrIsCLEAR(av) AttrIsId( av, TidyAttr_CLEAR )
#define attrIsCODE(av) AttrIsId( av, TidyAttr_CODE )
#define attrIsCODEBASE(av) AttrIsId( av, TidyAttr_CODEBASE )
#define attrIsCODETYPE(av) AttrIsId( av, TidyAttr_CODETYPE )
#define attrIsCOLOR(av) AttrIsId( av, TidyAttr_COLOR )
#define attrIsCOLS(av) AttrIsId( av, TidyAttr_COLS )
#define attrIsCOLSPAN(av) AttrIsId( av, TidyAttr_COLSPAN )
#define attrIsCOMPACT(av) AttrIsId( av, TidyAttr_COMPACT )
#define attrIsCONTENT(av) AttrIsId( av, TidyAttr_CONTENT )
#define attrIsCOORDS(av) AttrIsId( av, TidyAttr_COORDS )
#define attrIsDATA(av) AttrIsId( av, TidyAttr_DATA )
#define attrIsDATAFLD(av) AttrIsId( av, TidyAttr_DATAFLD )
#define attrIsDATAFORMATAS(av) AttrIsId( av, TidyAttr_DATAFORMATAS )
#define attrIsDATAPAGESIZE(av) AttrIsId( av, TidyAttr_DATAPAGESIZE )
#define attrIsDATASRC(av) AttrIsId( av, TidyAttr_DATASRC )
#define attrIsDATETIME(av) AttrIsId( av, TidyAttr_DATETIME )
#define attrIsDECLARE(av) AttrIsId( av, TidyAttr_DECLARE )
#define attrIsDEFER(av) AttrIsId( av, TidyAttr_DEFER )
#define attrIsDIR(av) AttrIsId( av, TidyAttr_DIR )
#define attrIsDISABLED(av) AttrIsId( av, TidyAttr_DISABLED )
#define attrIsENCODING(av) AttrIsId( av, TidyAttr_ENCODING )
#define attrIsENCTYPE(av) AttrIsId( av, TidyAttr_ENCTYPE )
#define attrIsFACE(av) AttrIsId( av, TidyAttr_FACE )
#define attrIsFOR(av) AttrIsId( av, TidyAttr_FOR )
#define attrIsFRAME(av) AttrIsId( av, TidyAttr_FRAME )
#define attrIsFRAMEBORDER(av) AttrIsId( av, TidyAttr_FRAMEBORDER )
#define attrIsFRAMESPACING(av) AttrIsId( av, TidyAttr_FRAMESPACING )
#define attrIsGRIDX(av) AttrIsId( av, TidyAttr_GRIDX )
#define attrIsGRIDY(av) AttrIsId( av, TidyAttr_GRIDY )
#define attrIsHEADERS(av) AttrIsId( av, TidyAttr_HEADERS )
#define attrIsHEIGHT(av) AttrIsId( av, TidyAttr_HEIGHT )
#define attrIsHREF(av) AttrIsId( av, TidyAttr_HREF )
#define attrIsHREFLANG(av) AttrIsId( av, TidyAttr_HREFLANG )
#define attrIsHSPACE(av) AttrIsId( av, TidyAttr_HSPACE )
#define attrIsHTTP_EQUIV(av) AttrIsId( av, TidyAttr_HTTP_EQUIV )
#define attrIsID(av) AttrIsId( av, TidyAttr_ID )
#define attrIsISMAP(av) AttrIsId( av, TidyAttr_ISMAP )
#define attrIsITEMID(av) AttrIsId( av, TidyAttr_ITEMID )
#define attrIsITEMPROP(av) AttrIsId( av, TidyAttr_ITEMPROP )
#define attrIsITEMREF(av) AttrIsId( av, TidyAttr_ITEMREF )
#define attrIsITEMSCOPE(av) AttrIsId( av, TidyAttr_ITEMSCOPE )
#define attrIsITEMTYPE(av) AttrIsId( av, TidyAttr_ITEMTYPE )
#define attrIsLABEL(av) AttrIsId( av, TidyAttr_LABEL )
#define attrIsLANG(av) AttrIsId( av, TidyAttr_LANG )
#define attrIsLANGUAGE(av) AttrIsId( av, TidyAttr_LANGUAGE )
#define attrIsLAST_MODIFIED(av) AttrIsId( av, TidyAttr_LAST_MODIFIED )
#define attrIsLAST_VISIT(av) AttrIsId( av, TidyAttr_LAST_VISIT )
#define attrIsLEFTMARGIN(av) AttrIsId( av, TidyAttr_LEFTMARGIN )
#define attrIsLINK(av) AttrIsId( av, TidyAttr_LINK )
#define attrIsLONGDESC(av) AttrIsId( av, TidyAttr_LONGDESC )
#define attrIsLOWSRC(av) AttrIsId( av, TidyAttr_LOWSRC )
#define attrIsMARGINHEIGHT(av) AttrIsId( av, TidyAttr_MARGINHEIGHT )
#define attrIsMARGINWIDTH(av) AttrIsId( av, TidyAttr_MARGINWIDTH )
#define attrIsMAXLENGTH(av) AttrIsId( av, TidyAttr_MAXLENGTH )
#define attrIsMEDIA(av) AttrIsId( av, TidyAttr_MEDIA )
#define attrIsMETHOD(av) AttrIsId( av, TidyAttr_METHOD )
#define attrIsMULTIPLE(av) AttrIsId( av, TidyAttr_MULTIPLE )
#define attrIsNAME(av) AttrIsId( av, TidyAttr_NAME )
#define attrIsNOHREF(av) AttrIsId( av, TidyAttr_NOHREF )
#define attrIsNORESIZE(av) AttrIsId( av, TidyAttr_NORESIZE )
#define attrIsNOSHADE(av) AttrIsId( av, TidyAttr_NOSHADE )
#define attrIsNOWRAP(av) AttrIsId( av, TidyAttr_NOWRAP )
#define attrIsOBJECT(av) AttrIsId( av, TidyAttr_OBJECT )
#define attrIsOnAFTERUPDATE(av) AttrIsId( av, TidyAttr_OnAFTERUPDATE )
#define attrIsOnBEFOREUNLOAD(av) AttrIsId( av, TidyAttr_OnBEFOREUNLOAD )
#define attrIsOnBEFOREUPDATE(av) AttrIsId( av, TidyAttr_OnBEFOREUPDATE )
#define attrIsOnBLUR(av) AttrIsId( av, TidyAttr_OnBLUR )
#define attrIsOnCHANGE(av) AttrIsId( av, TidyAttr_OnCHANGE )
#define attrIsOnCLICK(av) AttrIsId( av, TidyAttr_OnCLICK )
#define attrIsOnDATAAVAILABLE(av) AttrIsId( av, TidyAttr_OnDATAAVAILABLE )
#define attrIsOnDATASETCHANGED(av) AttrIsId( av, TidyAttr_OnDATASETCHANGED )
#define attrIsOnDATASETCOMPLETE(av) AttrIsId( av, TidyAttr_OnDATASETCOMPLETE )
#define attrIsOnDBLCLICK(av) AttrIsId( av, TidyAttr_OnDBLCLICK )
#define attrIsOnERRORUPDATE(av) AttrIsId( av, TidyAttr_OnERRORUPDATE )
#define attrIsOnFOCUS(av) AttrIsId( av, TidyAttr_OnFOCUS )
#define attrIsOnKEYDOWN(av) AttrIsId( av, TidyAttr_OnKEYDOWN )
#define attrIsOnKEYPRESS(av) AttrIsId( av, TidyAttr_OnKEYPRESS )
#define attrIsOnKEYUP(av) AttrIsId( av, TidyAttr_OnKEYUP )
#define attrIsOnLOAD(av) AttrIsId( av, TidyAttr_OnLOAD )
#define attrIsOnMOUSEDOWN(av) AttrIsId( av, TidyAttr_OnMOUSEDOWN )
#define attrIsOnMOUSEMOVE(av) AttrIsId( av, TidyAttr_OnMOUSEMOVE )
#define attrIsOnMOUSEOUT(av) AttrIsId( av, TidyAttr_OnMOUSEOUT )
#define attrIsOnMOUSEOVER(av) AttrIsId( av, TidyAttr_OnMOUSEOVER )
#define attrIsOnMOUSEUP(av) AttrIsId( av, TidyAttr_OnMOUSEUP )
#define attrIsOnRESET(av) AttrIsId( av, TidyAttr_OnRESET )
#define attrIsOnROWENTER(av) AttrIsId( av, TidyAttr_OnROWENTER )
#define attrIsOnROWEXIT(av) AttrIsId( av, TidyAttr_OnROWEXIT )
#define attrIsOnSELECT(av) AttrIsId( av, TidyAttr_OnSELECT )
#define attrIsOnSUBMIT(av) AttrIsId( av, TidyAttr_OnSUBMIT )
#define attrIsOnUNLOAD(av) AttrIsId( av, TidyAttr_OnUNLOAD )
#define attrIsPROFILE(av) AttrIsId( av, TidyAttr_PROFILE )
#define attrIsPROMPT(av) AttrIsId( av, TidyAttr_PROMPT )
#define attrIsRBSPAN(av) AttrIsId( av, TidyAttr_RBSPAN )
#define attrIsREADONLY(av) AttrIsId( av, TidyAttr_READONLY )
#define attrIsREL(av) AttrIsId( av, TidyAttr_REL )
#define attrIsREV(av) AttrIsId( av, TidyAttr_REV )
#define attrIsRIGHTMARGIN(av) AttrIsId( av, TidyAttr_RIGHTMARGIN )
#define attrIsROLE(av) AttrIsId( av, TidyAttr_ROLE )
#define attrIsROWS(av) AttrIsId( av, TidyAttr_ROWS )
#define attrIsROWSPAN(av) AttrIsId( av, TidyAttr_ROWSPAN )
#define attrIsRULES(av) AttrIsId( av, TidyAttr_RULES )
#define attrIsSCHEME(av) AttrIsId( av, TidyAttr_SCHEME )
#define attrIsSCOPE(av) AttrIsId( av, TidyAttr_SCOPE )
#define attrIsSCROLLING(av) AttrIsId( av, TidyAttr_SCROLLING )
#define attrIsSELECTED(av) AttrIsId( av, TidyAttr_SELECTED )
#define attrIsSHAPE(av) AttrIsId( av, TidyAttr_SHAPE )
#define attrIsSHOWGRID(av) AttrIsId( av, TidyAttr_SHOWGRID )
#define attrIsSHOWGRIDX(av) AttrIsId( av, TidyAttr_SHOWGRIDX )
#define attrIsSHOWGRIDY(av) AttrIsId( av, TidyAttr_SHOWGRIDY )
#define attrIsSIZE(av) AttrIsId( av, TidyAttr_SIZE )
#define attrIsSPAN(av) AttrIsId( av, TidyAttr_SPAN )
#define attrIsSRC(av) AttrIsId( av, TidyAttr_SRC )
#define attrIsSTANDBY(av) AttrIsId( av, TidyAttr_STANDBY )
#define attrIsSTART(av) AttrIsId( av, TidyAttr_START )
#define attrIsSTYLE(av) AttrIsId( av, TidyAttr_STYLE )
#define attrIsSUMMARY(av) AttrIsId( av, TidyAttr_SUMMARY )
#define attrIsTABINDEX(av) AttrIsId( av, TidyAttr_TABINDEX )
#define attrIsTARGET(av) AttrIsId( av, TidyAttr_TARGET )
#define attrIsTEXT(av) AttrIsId( av, TidyAttr_TEXT )
#define attrIsTITLE(av) AttrIsId( av, TidyAttr_TITLE )
#define attrIsTOPMARGIN(av) AttrIsId( av, TidyAttr_TOPMARGIN )
#define attrIsTYPE(av) AttrIsId( av, TidyAttr_TYPE )
#define attrIsUSEMAP(av) AttrIsId( av, TidyAttr_USEMAP )
#define attrIsVALIGN(av) AttrIsId( av, TidyAttr_VALIGN )
#define attrIsVALUE(av) AttrIsId( av, TidyAttr_VALUE )
#define attrIsVALUETYPE(av) AttrIsId( av, TidyAttr_VALUETYPE )
#define attrIsVERSION(av) AttrIsId( av, TidyAttr_VERSION )
#define attrIsVLINK(av) AttrIsId( av, TidyAttr_VLINK )
#define attrIsVSPACE(av) AttrIsId( av, TidyAttr_VSPACE )
#define attrIsWIDTH(av) AttrIsId( av, TidyAttr_WIDTH )
#define attrIsWRAP(av) AttrIsId( av, TidyAttr_WRAP )
#define attrIsXMLNS(av) AttrIsId( av, TidyAttr_XMLNS )
#define attrIsXML_LANG(av) AttrIsId( av, TidyAttr_XML_LANG )
#define attrIsXML_SPACE(av) AttrIsId( av, TidyAttr_XML_SPACE )
#define attrIsARIA_ACTIVEDESCENDANT(av) AttrIsId( av, TidyAttr_ARIA_ACTIVEDESCENDANT )
#define attrIsARIA_ATOMIC(av) AttrIsId( av, TidyAttr_ARIA_ATOMIC )
#define attrIsARIA_AUTOCOMPLETE(av) AttrIsId( av, TidyAttr_ARIA_AUTOCOMPLETE )
#define attrIsARIA_BUSY(av) AttrIsId( av, TidyAttr_ARIA_BUSY )
#define attrIsARIA_CHECKED(av) AttrIsId( av, TidyAttr_ARIA_CHECKED )
#define attrIsARIA_CONTROLS(av) AttrIsId( av, TidyAttr_ARIA_CONTROLS )
#define attrIsARIA_DESCRIBEDBY(av) AttrIsId( av, TidyAttr_ARIA_DESCRIBEDBY )
#define attrIsARIA_DISABLED(av) AttrIsId( av, TidyAttr_ARIA_DISABLED )
#define attrIsARIA_DROPEFFECT(av) AttrIsId( av, TidyAttr_ARIA_DROPEFFECT )
#define attrIsARIA_EXPANDED(av) AttrIsId( av, TidyAttr_ARIA_EXPANDED )
#define attrIsARIA_FLOWTO(av) AttrIsId( av, TidyAttr_ARIA_FLOWTO )
#define attrIsARIA_GRABBED(av) AttrIsId( av, TidyAttr_ARIA_GRABBED )
#define attrIsARIA_HASPOPUP(av) AttrIsId( av, TidyAttr_ARIA_HASPOPUP )
#define attrIsARIA_HIDDEN(av) AttrIsId( av, TidyAttr_ARIA_HIDDEN )
#define attrIsARIA_INVALID(av) AttrIsId( av, TidyAttr_ARIA_INVALID )
#define attrIsARIA_LABEL(av) AttrIsId( av, TidyAttr_ARIA_LABEL )
#define attrIsARIA_LABELLEDBY(av) AttrIsId( av, TidyAttr_ARIA_LABELLEDBY )
#define attrIsARIA_LEVEL(av) AttrIsId( av, TidyAttr_ARIA_LEVEL )
#define attrIsARIA_LIVE(av) AttrIsId( av, TidyAttr_ARIA_LIVE )
#define attrIsARIA_MULTILINE(av) AttrIsId( av, TidyAttr_ARIA_MULTILINE )
#define attrIsARIA_MULTISELECTABLE(av) AttrIsId( av, TidyAttr_ARIA_MULTISELECTABLE )
#define attrIsARIA_ORIENTATION(av) AttrIsId( av, TidyAttr_ARIA_ORIENTATION )
#define attrIsARIA_OWNS(av) AttrIsId( av, TidyAttr_ARIA_OWNS )
#define attrIsARIA_POSINSET(av) AttrIsId( av, TidyAttr_ARIA_POSINSET )
#define attrIsARIA_PRESSED(av) AttrIsId( av, TidyAttr_ARIA_PRESSED )
#define attrIsARIA_READONLY(av) AttrIsId( av, TidyAttr_ARIA_READONLY )
#define attrIsARIA_RELEVANT(av) AttrIsId( av, TidyAttr_ARIA_RELEVANT )
#define attrIsARIA_REQUIRED(av) AttrIsId( av, TidyAttr_ARIA_REQUIRED )
#define attrIsARIA_SELECTED(av) AttrIsId( av, TidyAttr_ARIA_SELECTED )
#define attrIsARIA_SETSIZE(av) AttrIsId( av, TidyAttr_ARIA_SETSIZE )
#define attrIsARIA_SORT(av) AttrIsId( av, TidyAttr_ARIA_SORT )
#define attrIsARIA_VALUEMAX(av) AttrIsId( av, TidyAttr_ARIA_VALUEMAX )
#define attrIsARIA_VALUEMIN(av) AttrIsId( av, TidyAttr_ARIA_VALUEMIN )
#define attrIsARIA_VALUENOW(av) AttrIsId( av, TidyAttr_ARIA_VALUENOW )
#define attrIsARIA_VALUETEXT(av) AttrIsId( av, TidyAttr_ARIA_VALUETEXT )
/* Attribute Retrieval macros
*/
#define attrGetHREF( nod ) TY_(AttrGetById)( nod, TidyAttr_HREF )
#define attrGetSRC( nod ) TY_(AttrGetById)( nod, TidyAttr_SRC )
#define attrGetID( nod ) TY_(AttrGetById)( nod, TidyAttr_ID )
#define attrGetNAME( nod ) TY_(AttrGetById)( nod, TidyAttr_NAME )
#define attrGetSUMMARY( nod ) TY_(AttrGetById)( nod, TidyAttr_SUMMARY )
#define attrGetALT( nod ) TY_(AttrGetById)( nod, TidyAttr_ALT )
#define attrGetLONGDESC( nod ) TY_(AttrGetById)( nod, TidyAttr_LONGDESC )
#define attrGetUSEMAP( nod ) TY_(AttrGetById)( nod, TidyAttr_USEMAP )
#define attrGetISMAP( nod ) TY_(AttrGetById)( nod, TidyAttr_ISMAP )
#define attrGetLANGUAGE( nod ) TY_(AttrGetById)( nod, TidyAttr_LANGUAGE )
#define attrGetTYPE( nod ) TY_(AttrGetById)( nod, TidyAttr_TYPE )
#define attrGetVALUE( nod ) TY_(AttrGetById)( nod, TidyAttr_VALUE )
#define attrGetCONTENT( nod ) TY_(AttrGetById)( nod, TidyAttr_CONTENT )
#define attrGetTITLE( nod ) TY_(AttrGetById)( nod, TidyAttr_TITLE )
#define attrGetXMLNS( nod ) TY_(AttrGetById)( nod, TidyAttr_XMLNS )
#define attrGetDATAFLD( nod ) TY_(AttrGetById)( nod, TidyAttr_DATAFLD )
#define attrGetWIDTH( nod ) TY_(AttrGetById)( nod, TidyAttr_WIDTH )
#define attrGetHEIGHT( nod ) TY_(AttrGetById)( nod, TidyAttr_HEIGHT )
#define attrGetFOR( nod ) TY_(AttrGetById)( nod, TidyAttr_FOR )