[wp-hackers] XHTML Strict Mode

Jamie Talbot wphackers at jamietalbot.com
Mon Aug 16 09:05:52 UTC 2004


Thanks for the pointers guys.

I've cleaned stuff up a bit and packaged it as a plugin.  It now handles a wide
variety of poor syntax, transforming it to valid XHTML.  All the debug code
still remains, as it's an evolving package, but it's now stable as far as I can
tell.

I don't like having so many globals.  In the next version I hope to change it
around a bit so it doesn't need them.  I'll also put in the code that warns
users of things that weren't changed (currently this is unknown tags, or empty
tags that are in the wrong place).  I want to pop up a window with these
caveats - anyone know the best way to do it during a filter?

Anyway, take a look at some test results:

http://www.jamietalbot.com/wp-hacks/xvalid-debug.php

The A's are the input, and the C's the output.  B is an intermediate stage
before empty tags are removed.

eg:

A is: <a href="whatever">J<br><a href="new">text</a></b>
....debug output...
B is: <a href="whatever">J<br /></a><a href="new">text</a>
C is: <a href="whatever">J<br /></a><a href="new">text</a>

The source can be viewed at:

http://www.jamietalbot.com/wp-hacks/xvalid-debug.phps

or downloaded at:

http://www.jamietalbot.com/wp-hacks/xvalid.zip

It can be turned into a plugin by uncommenting the add_filter lines at the top,
and commenting out all the information following the xvalid_admin_footer
function.

Comments and feedback please! :D

Jamie.

--
http://www.jamietalbot.com/


Quoting Matt Mullenweg <m at mullenweg.com>:

> Jamie Talbot wrote:
>
> > Cheers Mark,
> >
> > Will take a look!
>
> You may also be able to utilize the KSES library which is included with
> WordPress, it does a fair bit of HTML normalization.
>
> --
> Matt Mullenweg
>   http://photomatt.net | http://wordpress.org
> http://pingomatic.com | more soon...
>
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>




More information about the hackers mailing list