[Zope] How to convert structured text into plain text

vsbabu@vsbabu.org vsbabu@vsbabu.org
Tue, 19 Feb 2002 14:25:55 -0500


Oops - that would be DumbWriter instead of AbstractWriter

in any case, please try comp.lang.python too - I think there were some
examples before.

On Tue, Feb 19, 2002 at 02:18:00PM -0500, vsbabu@vsbabu.org wrote:
> 
> Wouldn't <dtml-var xxx> be enough? Off course it'll still have STXisms like * or **, link specs etc.
> 
> Otherwise, what I can think of is to write an external method that takes in HTML and returns plain text.
> To this pass the rendered STX.
> 
> something like this ->
> 
> from htmllib import HTMLParser
> from formatter import AbstractFormatter, AbstractWriter
> parser = HTMLParser(AbstractFormatter(AbstractWriter()))
> parser.feed(stx_in_html)
> parser.close()
> 
> Well, this prints out the text - need to modify it to capture it and return it as a string
> 
> -vsb
> 
> On Tue, Feb 19, 2002 at 06:44:56PM +0000, Nuno Maltez wrote:
> > Hi,
> > 
> > I know that <dtml-var xxx fmt="structured-text"> converts structured text into
> > HTML, and I know how to call this from a python script/external method.
> > 
> > Now, is there a method somewhere in Zope's classes that return a plain
> > text version of the stx string? With all the special characters and sequences
> > stripped off.
> > 
> > Thanks in advance,
> > Nuno
> > 
> > 
> > _______________________________________________
> > 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 )
> 
> _______________________________________________
> 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 )