I'm looking for a piece of Python code that can filter HTML and tie up
unclosed tags.
By way of explanation: I'm building a bulletin-board-ish solution where
users should be able to post HTMl-formatted submissions; I only want to
enable a subset of HTML (eg., <b>, <i> and so forth), plus I want to make
sure text-level tags are ended correctly. I could sit down and write a
smaller HTML parser, but I don't want to reinvent wheels if I can just
grab this stuff off the shelf.
--
Alexander Staubo http://www.mop.no/~alex/
"He could open a tin of sardines with his teeth, strike a Swan Vestas
on his chin, rope steers, drive a steam locomotive and hum all the
works of Gilbert and Sullivan without becoming confused or breaking
down in tears."
--Robert Rankin, _The Book of Ultimate Truths_
unclosed tags.
By way of explanation: I'm building a bulletin-board-ish solution where
users should be able to post HTMl-formatted submissions; I only want to
enable a subset of HTML (eg., <b>, <i> and so forth), plus I want to make
sure text-level tags are ended correctly. I could sit down and write a
smaller HTML parser, but I don't want to reinvent wheels if I can just
grab this stuff off the shelf.
--
Alexander Staubo http://www.mop.no/~alex/
"He could open a tin of sardines with his teeth, strike a Swan Vestas
on his chin, rope steers, drive a steam locomotive and hum all the
works of Gilbert and Sullivan without becoming confused or breaking
down in tears."
--Robert Rankin, _The Book of Ultimate Truths_