[Zope] Using Structured Text and HTML-quote together for RSS 2.0
Peter Bengtsson
peterbe at gmail.com
Wed Sep 7 20:05:18 EDT 2005
Create a python script called rssFormatter(text)::
from Products.PythonScripts.standard import structured_text, html_quote
return html_quote(structured_text(text))
Which you use later as <dtml-var "rssFormatter(summary)">
I think for some of my RSS feeds I use CDATA, so _my_ rssFormatter()
script looks something like this::
return "<![CDATA[%s]]>" % text
The advantage with CDATA is that you won't need to html quote things.
On 9/8/05, Jonathan Cyr <cyrj at cyr.info> wrote:
> Hello,
>
> I can't seem to find this anywhere.
>
> I am constructing an RSS 2.0 feed for a zope app. I am creating the
> rss.xml file in a DTML method. One of the information elements I wish
> to include in the feed is a structured-text paragraph. To use any XHTML
> in a feed you must "html_quote" all of the extended characters for it to
> work.
>
> So I wish to do something like <dtml-var summary fmt="structured-text"
> html_quote>
>
> This obviously doesn't work, (would have been cool if it did tho). How
> do I access the structured text and html quote translation mechanisms in
> an expr tag.
>
> Something like <dtml-var expr="summary.structured_text().html_quote()">
>
> Thanks in advance, still googling for it.
>
> -Jon
>
> ps- I don't use ZPT, DTML was chose a while back, and would rather keep
> the RSS in a DTML Method rather than a python script. The layers are
> getting pretty hairy, don't want to add indention to it
>
> --
> Jonathan Cyr
> cyrj at cyr.info
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Zope
mailing list