Skip to content

Instantly share code, notes, and snippets.

@BenWard
Created October 11, 2009 03:35
Show Gist options
  • Save BenWard/207380 to your computer and use it in GitHub Desktop.
Save BenWard/207380 to your computer and use it in GitHub Desktop.
A for HTMLTidy to prevent it dropping empty elements that have class attributes. Allows it to be used to pre-process HTML containing microformats without stripping out the value-class-pattern.
Index: attrs.h
===================================================================
RCS file: /cvsroot/tidy/tidy/src/attrs.h,v
retrieving revision 1.29
diff -r1.29 attrs.h
325a326
> #define attrGetCLASS( nod ) TY_(AttrGetById)( nod, TidyAttr_CLASS )
Index: parser.c
===================================================================
RCS file: /cvsroot/tidy/tidy/src/parser.c,v
retrieving revision 1.187
diff -r1.187 parser.c
289a290,294
> /* Microformats value-class-pattern data fix. Allow empty elements
> *with a @class attribute to remain (otherwise they would be dropped) */
> /* attributes */
> if ( attrGetCLASS(element) )
> return no;
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment