Strip-o-Gram is an HTML Conversion Library implemented as a Python package that can convert HTML to Plain Text and strip specified tags and Javascript from HTML. See http://www.zope.org/Members/chrisw/StripOGram for more details. This release includes more documentation and allows the methods to be used from Zope's Script (Python)'s. cheers, Chris
I just tried the following in a Python Script, as documented: from stripogram import html2text, html2safehtml mylumpofdodgyhtml = """<a href="http://www.zope.org">test string</a>""" #a lump of dodgy html ;-) mylumpofcoolcleancollectedhtml = html2safehtml(mylumpofdodgyhtml,valid_tags=("b", "a", "i", "br", "p")) mylumpoftext = html2text(mylumpofcoolcleancollectedhtml) return mylumpoftext ...but the printed string is 'test string', stripped the tag 'a', when it's supossed to be valid. Am I missing something? Ausum ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: <zope-announce@zope.org>; <zope@zope.org>; <python-list@python.org>; <python-announce@python.org> Sent: Tuesday, November 19, 2002 3:32 PM Subject: [Zope] Strip-o-Gram 1.2 Released!
Strip-o-Gram is an HTML Conversion Library implemented as a Python package that can convert HTML to Plain Text and strip specified tags and Javascript from HTML.
See http://www.zope.org/Members/chrisw/StripOGram for more details.
This release includes more documentation and allows the methods to be used from Zope's Script (Python)'s.
cheers,
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Ausum Studio wrote:
I just tried the following in a Python Script, as documented:
from stripogram import html2text, html2safehtml mylumpofdodgyhtml = """<a href="http://www.zope.org">test string</a>""" #a lump of dodgy html ;-) mylumpofcoolcleancollectedhtml = html2safehtml(mylumpofdodgyhtml,valid_tags=("b", "a", "i", "br", "p")) mylumpoftext = html2text(mylumpofcoolcleancollectedhtml) return mylumpoftext
...but the printed string is 'test string', stripped the tag 'a', when it's supossed to be valid.
Am I missing something?
Now just what do you suppose the contents of mylumpoftext are supposed to be? ;-) And, at a complete guess, what do you reckon html2text does? Read The Code, Luke! cheers, Chris
And, at a complete guess, what do you reckon html2text does?
LOL *That* was what I was missing.! Believe me Obi Wan, I do read the code. At least every now and then. ;) Cheers, Ausum ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: "Ausum Studio" <ausum_studio@hotmail.com> Cc: <zope@zope.org> Sent: Tuesday, November 19, 2002 7:19 PM Subject: Re: [Zope] Strip-o-Gram 1.2 Released!
Ausum Studio wrote:
I just tried the following in a Python Script, as documented:
from stripogram import html2text, html2safehtml mylumpofdodgyhtml = """<a href="http://www.zope.org">test string</a>""" #a lump of dodgy html ;-) mylumpofcoolcleancollectedhtml = html2safehtml(mylumpofdodgyhtml,valid_tags=("b", "a", "i", "br", "p")) mylumpoftext = html2text(mylumpofcoolcleancollectedhtml) return mylumpoftext
...but the printed string is 'test string', stripped the tag 'a', when it's supossed to be valid.
Am I missing something?
Now just what do you suppose the contents of mylumpoftext are supposed to be? ;-)
And, at a complete guess, what do you reckon html2text does?
Read The Code, Luke!
cheers,
Chris
participants (2)
-
Ausum Studio -
Chris Withers