W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2007

Re: Is it possible to whitelist tags?

From: John Campbell <jdc.rpv@cox.net>
Date: Mon, 19 Nov 2007 16:31:37 -0800
Message-ID: <47422AE9.5010607@cox.net>
To: Dionysis Zindros <dionyziz@gmail.com>
CC: html-tidy@w3.org

Dionysis Zindros wrote:
> I'm developing an application using TidyLib and C++. I want to tidy up
> certain HTML code, but I want to whitelist certain tags. e.g. I would
> only like to allow <strong>, <ul>, and <li>, but not <table>, <tr>,
> <td>, <script>, and so forth.
> 
> If that isn't possible, would it be possible to do some kind of
> blacklisting instead?
> 
> Also, one last question: Is it possible to use a similar mechanism to
> whitelist/blacklist attributes on particular properties? For example,
> I might want to allow the attribute "name", but not the attribute
> "class" for "input" tags. How would one go about doing that?

No, tidy is a "pretty printer" not an html stripper.

What you're looking for is something like the perl "hstrip" script from:

http://search.cpan.org/src/GAAS/HTML-Parser-3.56/eg/hstrip
Received on Tuesday, 20 November 2007 00:31:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:57 GMT