Re: Package Proposal: HTML_Messy
| From: | Davey | Date: | Mon, 12 May 2003 04:44:49 +0000 |
| Subject: | Re: Package Proposal: HTML_Messy | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16171@lists.php.net to get a copy of this message | ||
John Luxford wrote:
Anyone interested in an HTML_Messy (aka Tidy) package based on the recently proposed HTML_Sax? Source, cleaned up a bit, is available at: http://www.sitellite.org/files/pear/HTML_Messy.phps Comments/examples inline. So far, it features: - Fixing missing tags (tries to anyway - Banishes evil tags (<blink>) to /dev/nullYay!
- Converts deprecated tags (<center>, <font>) to their "proper" equivalents (<p align="center">)the align attribute is deprecated also ;) you should be using <p style="text-align: center;"> although, as you don't know *what* what being centered, using a <div> instead of a <p> would be better, as <div> is the generic block element.
- Cleans invalid XML as well (ie. by ignoring evil HTML tags)Doesn't make sense. XML well-formed-ness is simple, tags nested properly, tags the right case (you'd need a DTD to check that), all attributes quoted, and no empty tags (i.e. <tag /> not <tag>)
It's not exactly an HTML-Tidy replacement (by any stretch) at this point, but for those without access to HTML-Tidy this might be an acceptable alternative. And with time, maybe it could even be a decent solution. I'm open to suggestions on the name as well, btw.Perhaps you might think to including jTidy in the package and just using that from within PHP? Don't know what license its under though, might be GPL, in which case its out. Of course that requires a JRE, so you could use what you already have as the fallback, fallbacks are always good :)
Thanks, Lux -- John Luxford President and Chief Developer ______________________________ SIMIAN systems Driving Web Content Management ______________________________ web : http://www.simian.ca/ email : lux@simian.ca phone : 204.452.8537