merge with with balthisar/tidy-html5 repo

This commit is contained in:
Geoff McLane 2015-01-18 12:25:20 +01:00
commit 995a6122f2
16 changed files with 13001 additions and 8165 deletions

14
.gitignore vendored
View file

@ -1,3 +1,5 @@
/build/gmake/obj/
/bin/
/build/msvc2010/Obj/
/build/msvc2010/Debugtidydll/
/build/msvc2010/Debugtidylib/
@ -5,6 +7,18 @@
/build/msvc2010/Releasetidydll/
/build/msvc2010/Releasetidylib/
/build/msvc2010/Release/
/build/msvc2010/ipch/
/build/msvc2010/tidy.opensdf
/htmldoc/tidy-config.xml
/htmldoc/tidy-help.xml
/htmldoc/tidy.1
/htmldoc/quickref.html
/lib/
/autom4te.cache/
/console/.deps/
/console/.libs/
/src/.deps/
/src/.libs/
*.user
*.suo
*.sdf

View file

@ -477,6 +477,10 @@ extern "C" {
#define access _access
#define strcasecmp _stricmp
#ifndef va_copy
#define va_copy(dest, src) (dest = src)
#endif
#if _MSC_VER > 1000
#pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */
#pragma warning( disable : 4100 ) /* unreferenced formal parameter */

6
include/tidy.h Normal file → Executable file
View file

@ -619,10 +619,16 @@ TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
typedef Bool (TIDY_CALL *TidyReportFilter)( TidyDoc tdoc, TidyReportLevel lvl,
uint line, uint col, ctmbstr mssg );
typedef Bool (TIDY_CALL *TidyReportFilter2)( TidyDoc tdoc, TidyReportLevel lvl,
uint line, uint col, ctmbstr mssg, va_list args );
/** Give Tidy a filter callback to use */
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc,
TidyReportFilter filtCallback );
TIDY_EXPORT Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc,
TidyReportFilter2 filtCallback );
/** Set error sink to named file */
TIDY_EXPORT FILE* TIDY_CALL tidySetErrorFile( TidyDoc tdoc, ctmbstr errfilnam );
/** Set error sink to given buffer */

View file

@ -7,7 +7,7 @@
generated wrappers and COM IDL files.
Copyright (c) 1998-2008 World Wide Web Consortium
(Massachusetts Institute of Technology, European Research
(Massachusetts Institute of Technology, European Research
Consortium for Informatics and Mathematics, Keio University).
All Rights Reserved.
@ -16,18 +16,18 @@
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.
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.
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
@ -43,7 +43,7 @@
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
@ -86,7 +86,7 @@ typedef enum
TidyCharEncoding, /**< In/out character encoding */
TidyInCharEncoding, /**< Input character encoding (if different) */
TidyOutCharEncoding, /**< Output character encoding (if different) */
TidyOutCharEncoding, /**< Output character encoding (if different) */
TidyNewline, /**< Output line ending (default to platform) */
TidyDoctypeMode, /**< See doctype property */
@ -94,7 +94,7 @@ typedef enum
TidyDuplicateAttrs, /**< Keep first or last duplicate attribute */
TidyAltText, /**< Default text for alt attribute */
/* obsolete */
TidySlideStyle, /**< Style sheet for slides: not used for anything yet */
@ -188,7 +188,7 @@ typedef enum
TidyEmptyTags, /**< Declared empty tags */
TidyPreTags, /**< Declared pre tags */
TidyAccessibilityCheckLevel, /**< Accessibility check level
TidyAccessibilityCheckLevel, /**< Accessibility check level
0 (old style), or 1, 2, 3 */
TidyVertSpace, /**< degree to which markup is spread out vertically */
@ -267,8 +267,8 @@ typedef enum
/* I/O and Message handling interface
**
** By default, Tidy will define, create and use
** instances of input and output handlers for
** 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,
@ -279,7 +279,7 @@ typedef enum
/** Message severity level
*/
typedef enum
typedef enum
{
TidyInfo, /**< Information about markup usage */
TidyWarning, /**< Warning message */
@ -296,7 +296,7 @@ typedef enum
/** Node types
*/
typedef enum
typedef enum
{
TidyNode_Root, /**< Root */
TidyNode_DocType, /**< DOCTYPE */
@ -542,7 +542,11 @@ typedef enum
TidyAttr_HTTP_EQUIV, /**< HTTP_EQUIV= */
TidyAttr_ID, /**< ID= */
TidyAttr_ISMAP, /**< ISMAP= */
TidyAttr_ITEMID, /**< ITEMID= */
TidyAttr_ITEMPROP, /**< ITEMPROP= */
TidyAttr_ITEMREF, /**< ITEMREF= */
TidyAttr_ITEMSCOPE, /**< ITEMSCOPE= */
TidyAttr_ITEMTYPE, /**< ITEMTYPE= */
TidyAttr_LABEL, /**< LABEL= */
TidyAttr_LANG, /**< LANG= */
TidyAttr_LANGUAGE, /**< LANGUAGE= */
@ -598,6 +602,7 @@ typedef enum
TidyAttr_REL, /**< REL= */
TidyAttr_REV, /**< REV= */
TidyAttr_RIGHTMARGIN, /**< RIGHTMARGIN= */
TidyAttr_ROLE, /**< ROLE= */
TidyAttr_ROWS, /**< ROWS= */
TidyAttr_ROWSPAN, /**< ROWSPAN= */
TidyAttr_RULES, /**< RULES= */
@ -742,6 +747,43 @@ typedef enum
TidyAttr_SRCDOC,
TidyAttr_SRCLANG,
TidyAttr_STEP,
TidyAttr_ARIA_ACTIVEDESCENDANT,
TidyAttr_ARIA_ATOMIC,
TidyAttr_ARIA_AUTOCOMPLETE,
TidyAttr_ARIA_BUSY,
TidyAttr_ARIA_CHECKED,
TidyAttr_ARIA_CONTROLS,
TidyAttr_ARIA_DESCRIBEDBY,
TidyAttr_ARIA_DISABLED,
TidyAttr_ARIA_DROPEFFECT,
TidyAttr_ARIA_EXPANDED,
TidyAttr_ARIA_FLOWTO,
TidyAttr_ARIA_GRABBED,
TidyAttr_ARIA_HASPOPUP,
TidyAttr_ARIA_HIDDEN,
TidyAttr_ARIA_INVALID,
TidyAttr_ARIA_LABEL,
TidyAttr_ARIA_LABELLEDBY,
TidyAttr_ARIA_LEVEL,
TidyAttr_ARIA_LIVE,
TidyAttr_ARIA_MULTILINE,
TidyAttr_ARIA_MULTISELECTABLE,
TidyAttr_ARIA_ORIENTATION,
TidyAttr_ARIA_OWNS,
TidyAttr_ARIA_POSINSET,
TidyAttr_ARIA_PRESSED,
TidyAttr_ARIA_READONLY,
TidyAttr_ARIA_RELEVANT,
TidyAttr_ARIA_REQUIRED,
TidyAttr_ARIA_SELECTED,
TidyAttr_ARIA_SETSIZE,
TidyAttr_ARIA_SORT,
TidyAttr_ARIA_VALUEMAX,
TidyAttr_ARIA_VALUEMIN,
TidyAttr_ARIA_VALUENOW,
TidyAttr_ARIA_VALUETEXT,
N_TIDY_ATTRIBS /**< Must be last */
@ -751,3 +793,4 @@ typedef enum
} /* extern "C" */
#endif
#endif /* __TIDYENUM_H__ */

File diff suppressed because it is too large Load diff

View file

@ -152,7 +152,11 @@ static const Attribute attribute_defs [] =
{ TidyAttr_HTTP_EQUIV, "http-equiv", CH_PCDATA }, /* META */
{ TidyAttr_ID, "id", CH_IDDEF },
{ TidyAttr_ISMAP, "ismap", CH_BOOL }, /* IMG */
{ TidyAttr_ITEMPROP, "itemprop", CH_PCDATA },
{ TidyAttr_ITEMID, "itemid", CH_PCDATA },
{ TidyAttr_ITEMPROP, "itemprop", CH_PCDATA },
{ TidyAttr_ITEMREF, "itemref", CH_PCDATA },
{ TidyAttr_ITEMSCOPE, "itemscope", CH_BOOL },
{ TidyAttr_ITEMTYPE, "itemtype", CH_URL },
{ TidyAttr_LABEL, "label", CH_PCDATA }, /* OPT, OPTGROUP */
{ TidyAttr_LANG, "lang", CH_LANG },
{ TidyAttr_LANGUAGE, "language", CH_PCDATA }, /* SCRIPT */
@ -208,6 +212,7 @@ static const Attribute attribute_defs [] =
{ TidyAttr_REL, "rel", CH_LINKTYPES },
{ TidyAttr_REV, "rev", CH_LINKTYPES },
{ TidyAttr_RIGHTMARGIN, "rightmargin", CH_NUMBER }, /* used on BODY */
{ TidyAttr_ROLE, "role", CH_PCDATA },
{ TidyAttr_ROWS, "rows", CH_NUMBER }, /* TEXTAREA */
{ TidyAttr_ROWSPAN, "rowspan", CH_NUMBER }, /* table cells */
{ TidyAttr_RULES, "rules", CH_TRULES }, /* TABLE */
@ -355,6 +360,43 @@ static const Attribute attribute_defs [] =
{ TidyAttr_SRCLANG, "srclang", CH_PCDATA },
{ TidyAttr_STEP, "step", CH_PCDATA },
/* HTML5 Aria Attributes */
{ TidyAttr_ARIA_ACTIVEDESCENDANT, "aria-activedescendant", CH_PCDATA },
{ TidyAttr_ARIA_ATOMIC, "aria-atomic", CH_PCDATA },
{ TidyAttr_ARIA_AUTOCOMPLETE, "aria-autocomplete", CH_PCDATA },
{ TidyAttr_ARIA_BUSY, "aria-busy", CH_PCDATA },
{ TidyAttr_ARIA_CHECKED, "aria-checked", CH_PCDATA },
{ TidyAttr_ARIA_CONTROLS, "aria-controls", CH_PCDATA },
{ TidyAttr_ARIA_DESCRIBEDBY, "aria-describedby", CH_PCDATA },
{ TidyAttr_ARIA_DISABLED, "aria-disabled", CH_PCDATA },
{ TidyAttr_ARIA_DROPEFFECT, "aria-dropeffect", CH_PCDATA },
{ TidyAttr_ARIA_EXPANDED, "aria-expanded", CH_PCDATA },
{ TidyAttr_ARIA_FLOWTO, "aria-flowto", CH_PCDATA },
{ TidyAttr_ARIA_GRABBED, "aria-grabbed", CH_PCDATA },
{ TidyAttr_ARIA_HASPOPUP, "aria-haspopup", CH_PCDATA },
{ TidyAttr_ARIA_HIDDEN, "aria-hidden", CH_PCDATA },
{ TidyAttr_ARIA_INVALID, "aria-invalid", CH_PCDATA },
{ TidyAttr_ARIA_LABEL, "aria-label", CH_PCDATA },
{ TidyAttr_ARIA_LABELLEDBY, "aria-labelledby", CH_PCDATA },
{ TidyAttr_ARIA_LEVEL, "aria-level", CH_PCDATA },
{ TidyAttr_ARIA_LIVE, "aria-live", CH_PCDATA },
{ TidyAttr_ARIA_MULTILINE, "aria-multiline", CH_PCDATA },
{ TidyAttr_ARIA_MULTISELECTABLE, "aria-multiselectable", CH_PCDATA },
{ TidyAttr_ARIA_ORIENTATION, "aria-orientation", CH_PCDATA },
{ TidyAttr_ARIA_OWNS, "aria-owns", CH_PCDATA },
{ TidyAttr_ARIA_POSINSET, "aria-posinset", CH_PCDATA },
{ TidyAttr_ARIA_PRESSED, "aria-pressed", CH_PCDATA },
{ TidyAttr_ARIA_READONLY, "aria-readonly", CH_PCDATA },
{ TidyAttr_ARIA_RELEVANT, "aria-relevant", CH_PCDATA },
{ TidyAttr_ARIA_REQUIRED, "aria-required", CH_PCDATA },
{ TidyAttr_ARIA_SELECTED, "aria-selected", CH_PCDATA },
{ TidyAttr_ARIA_SETSIZE, "aria-setsize", CH_PCDATA },
{ TidyAttr_ARIA_SORT, "aria-sort", CH_PCDATA },
{ TidyAttr_ARIA_VALUEMAX, "aria-valuemax", CH_PCDATA },
{ TidyAttr_ARIA_VALUEMIN, "aria-valuemin", CH_PCDATA },
{ TidyAttr_ARIA_VALUENOW, "aria-valuenow", CH_PCDATA },
{ TidyAttr_ARIA_VALUETEXT, "aria-valuetext", CH_PCDATA },
/* this must be the final entry */
{ N_TIDY_ATTRIBS, NULL, NULL }
};
@ -900,20 +942,33 @@ static void FreeAnchor(TidyDocImpl* doc, Anchor *a)
TidyDocFree( doc, a );
}
static uint anchorNameHash(ctmbstr s)
{
uint hashval;
for (hashval = 0; *s != '\0'; s++) {
tmbchar c = TY_(ToLower)( *s );
hashval = c + 31*hashval;
}
return hashval % ANCHOR_HASH_SIZE;
}
/* removes anchor for specific node */
void TY_(RemoveAnchorByNode)( TidyDocImpl* doc, Node *node )
void TY_(RemoveAnchorByNode)( TidyDocImpl* doc, ctmbstr name, Node *node )
{
TidyAttribImpl* attribs = &doc->attribs;
Anchor *delme = NULL, *curr, *prev = NULL;
uint h = anchorNameHash(name);
for ( curr=attribs->anchor_list; curr!=NULL; curr=curr->next )
for ( curr=attribs->anchor_hash[h]; curr!=NULL; curr=curr->next )
{
if ( curr->node == node )
{
if ( prev )
prev->next = curr->next;
else
attribs->anchor_list = curr->next;
attribs->anchor_hash[h] = curr->next;
delme = curr;
break;
}
@ -940,18 +995,19 @@ static Anchor* AddAnchor( TidyDocImpl* doc, ctmbstr name, Node *node )
{
TidyAttribImpl* attribs = &doc->attribs;
Anchor *a = NewAnchor( doc, name, node );
uint h = anchorNameHash(name);
if ( attribs->anchor_list == NULL)
attribs->anchor_list = a;
if ( attribs->anchor_hash[h] == NULL)
attribs->anchor_hash[h] = a;
else
{
Anchor *here = attribs->anchor_list;
Anchor *here = attribs->anchor_hash[h];
while (here->next)
here = here->next;
here->next = a;
}
return attribs->anchor_list;
return attribs->anchor_hash[h];
}
/* return node associated with anchor */
@ -959,10 +1015,11 @@ static Node* GetNodeByAnchor( TidyDocImpl* doc, ctmbstr name )
{
TidyAttribImpl* attribs = &doc->attribs;
Anchor *found;
uint h = anchorNameHash(name);
tmbstr lname = TY_(tmbstrdup)(doc->allocator, name);
lname = TY_(tmbstrtolower)(lname);
for ( found = attribs->anchor_list; found != NULL; found = found->next )
for ( found = attribs->anchor_hash[h]; found != NULL; found = found->next )
{
if ( TY_(tmbstrcmp)(found->name, lname) == 0 )
break;
@ -979,10 +1036,13 @@ void TY_(FreeAnchors)( TidyDocImpl* doc )
{
TidyAttribImpl* attribs = &doc->attribs;
Anchor* a;
while (NULL != (a = attribs->anchor_list) )
{
attribs->anchor_list = a->next;
FreeAnchor(doc, a);
uint h;
for (h = 0; h < ANCHOR_HASH_SIZE; h++) {
while (NULL != (a = attribs->anchor_hash[h]) )
{
attribs->anchor_hash[h] = a->next;
FreeAnchor(doc, a);
}
}
}

View file

@ -55,10 +55,15 @@ struct _AttrHash
typedef struct _AttrHash AttrHash;
#endif
enum
{
ANCHOR_HASH_SIZE=1021u
};
struct _TidyAttribImpl
{
/* anchor/node lookup */
Anchor* anchor_list;
Anchor* anchor_hash[ANCHOR_HASH_SIZE];
/* Declared literal attributes */
Attribute* declared_attr_list;
@ -117,7 +122,7 @@ Bool TY_(IsValidHTMLID)(ctmbstr id);
Bool TY_(IsValidXMLID)(ctmbstr id);
/* removes anchor for specific node */
void TY_(RemoveAnchorByNode)( TidyDocImpl* doc, Node *node );
void TY_(RemoveAnchorByNode)( TidyDocImpl* doc, ctmbstr name, Node *node );
/* free all anchors */
void TY_(FreeAnchors)( TidyDocImpl* doc );
@ -219,7 +224,11 @@ uint TY_(NodeAttributeVersions)( Node* node, TidyAttrId id );
#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 )
@ -275,6 +284,7 @@ uint TY_(NodeAttributeVersions)( Node* node, TidyAttrId id );
#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 )
@ -311,6 +321,42 @@ uint TY_(NodeAttributeVersions)( Node* node, TidyAttrId id );
#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
@ -367,4 +413,42 @@ uint TY_(NodeAttributeVersions)( Node* node, TidyAttrId id );
#define attrGetBASEFONT( nod ) TY_(AttrGetById)( nod, TidyAttr_BASEFONT )
#define attrGetROWSPAN( nod ) TY_(AttrGetById)( nod, TidyAttr_ROWSPAN )
#define attrGetROLE( nod ) TY_(AttrGetById)( nod, TidyAttr_ROLE )
#define attrGetARIA_ACTIVEDESCENDANT( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_ACTIVEDESCENDANT )
#define attrGetARIA_ATOMIC( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_ATOMIC )
#define attrGetARIA_AUTOCOMPLETE( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_AUTOCOMPLETE )
#define attrGetARIA_BUSY( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_BUSY )
#define attrGetARIA_CHECKED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_CHECKED )
#define attrGetARIA_CONTROLS( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_CONTROLS )
#define attrGetARIA_DESCRIBEDBY( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_DESCRIBEDBY )
#define attrGetARIA_DISABLED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_DISABLED )
#define attrGetARIA_DROPEFFECT( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_DROPEFFECT )
#define attrGetARIA_EXPANDED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_EXPANDED )
#define attrGetARIA_FLOWTO( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_FLOWTO )
#define attrGetARIA_GRABBED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_GRABBED )
#define attrGetARIA_HASPOPUP( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_HASPOPUP )
#define attrGetARIA_HIDDEN( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_HIDDEN )
#define attrGetARIA_INVALID( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_INVALID )
#define attrGetARIA_LABEL( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_LABEL )
#define attrGetARIA_LABELLEDBY( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_LABELLEDBY )
#define attrGetARIA_LEVEL( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_LEVEL )
#define attrGetARIA_LIVE( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_LIVE )
#define attrGetARIA_MULTILINE( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_MULTILINE )
#define attrGetARIA_MULTISELECTABLE( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_MULTISELECTABLE )
#define attrGetARIA_ORIENTATION( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_ORIENTATION )
#define attrGetARIA_OWNS( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_OWNS )
#define attrGetARIA_POSINSET( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_POSINSET )
#define attrGetARIA_PRESSED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_PRESSED )
#define attrGetARIA_READONLY( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_READONLY )
#define attrGetARIA_RELEVANT( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_RELEVANT )
#define attrGetARIA_REQUIRED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_REQUIRED )
#define attrGetARIA_SELECTED( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_SELECTED )
#define attrGetARIA_SETSIZE( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_SETSIZE )
#define attrGetARIA_SORT( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_SORT )
#define attrGetARIA_VALUEMAX( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_VALUEMAX )
#define attrGetARIA_VALUEMIN( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_VALUEMIN )
#define attrGetARIA_VALUENOW( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_VALUENOW )
#define attrGetARIA_VALUETEXT( nod ) TY_(AttrGetById)( nod, TidyAttr_ARIA_VALUETEXT )
#endif /* __ATTRS_H__ */

View file

@ -2638,17 +2638,19 @@ void TY_(FixAnchors)(TidyDocImpl* doc, Node *node, Bool wantName, Bool wantId)
if (id && !wantId
/* make sure that Name has been emitted if requested */
&& (hadName || !wantName || NameEmitted) )
&& (hadName || !wantName || NameEmitted) ) {
if (!wantId && !wantName)
TY_(RemoveAnchorByNode)(doc, id->value, node);
TY_(RemoveAttribute)(doc, node, id);
}
if (name && !wantName
/* make sure that Id has been emitted if requested */
&& (hadId || !wantId || IdEmitted) )
&& (hadId || !wantId || IdEmitted) ) {
if (!wantId && !wantName)
TY_(RemoveAnchorByNode)(doc, name->value, node);
TY_(RemoveAttribute)(doc, node, name);
if (TY_(AttrGetById)(node, TidyAttr_NAME) == NULL &&
TY_(AttrGetById)(node, TidyAttr_ID) == NULL)
TY_(RemoveAnchorByNode)(doc, node);
}
}
if (node->content)

View file

@ -1128,7 +1128,7 @@ void TY_(FreeAttrs)( TidyDocImpl* doc, Node *node )
if ( (attrIsID(av) || attrIsNAME(av)) &&
TY_(IsAnchorElement)(doc, node) )
{
TY_(RemoveAnchorByNode)( doc, node );
TY_(RemoveAnchorByNode)( doc, av->value, node );
}
}

7
src/localize.c Normal file → Executable file
View file

@ -1035,12 +1035,19 @@ static void messagePos( TidyDocImpl* doc, TidyReportLevel level,
if ( go )
{
va_list args_copy;
va_copy(args_copy, args);
TY_(tmbvsnprintf)(messageBuf, sizeMessageBuf, msg, args);
if ( doc->mssgFilt )
{
TidyDoc tdoc = tidyImplToDoc( doc );
go = doc->mssgFilt( tdoc, level, line, col, messageBuf );
}
if ( doc->mssgFilt2 )
{
TidyDoc tdoc = tidyImplToDoc( doc );
go = go | doc->mssgFilt2( tdoc, level, line, col, msg, args_copy );
}
}
if ( go )

0
src/mappedio.c Executable file → Normal file
View file

0
src/mappedio.h Executable file → Normal file
View file

View file

@ -1302,6 +1302,9 @@ static Bool AfterSpace(Lexer *lexer, Node *node)
return AfterSpaceImp(lexer, node, TY_(nodeCMIsEmpty)(node));
}
static void PPrintEndTag( TidyDocImpl* doc, uint ARG_UNUSED(mode),
uint ARG_UNUSED(indent), Node *node );
static void PPrintTag( TidyDocImpl* doc,
uint mode, uint indent, Node *node )
{
@ -1344,7 +1347,12 @@ static void PPrintTag( TidyDocImpl* doc,
AddChar( pprint, '>' );
if ( (node->type != StartEndTag || xhtmlOut) && !(mode & PREFORMATTED) )
if (node->type == StartEndTag && TY_(HTMLVersion)(doc) == HT50)
{
PPrintEndTag( doc, mode, indent, node );
}
if ( (node->type != StartEndTag || xhtmlOut || (node->type == StartEndTag && TY_(HTMLVersion)(doc) == HT50)) && !(mode & PREFORMATTED) )
{
uint wraplen = cfg( doc, TidyWrapLen );
CheckWrapIndent( doc, indent );

1
src/tidy-int.h Normal file → Executable file
View file

@ -48,6 +48,7 @@ struct _TidyDocImpl
StreamOut* docOut;
StreamOut* errout;
TidyReportFilter mssgFilt;
TidyReportFilter2 mssgFilt2;
TidyOptCallback pOptCallback;
/* Parse + Repair Results */

11
src/tidylib.c Normal file → Executable file
View file

@ -650,6 +650,17 @@ Bool TIDY_CALL tidySetReportFilter( TidyDoc tdoc, TidyReportFilter filt )
return no;
}
Bool TIDY_CALL tidySetReportFilter2( TidyDoc tdoc, TidyReportFilter2 filt )
{
TidyDocImpl* impl = tidyDocToImpl( tdoc );
if ( impl )
{
impl->mssgFilt2 = filt;
return yes;
}
return no;
}
#if 0 /* Not yet */
int tidySetContentOutputSink( TidyDoc tdoc, TidyOutputSink* outp )
{

0
src/version.h Executable file → Normal file
View file