Using Structured Text and HTML-quote together for RSS 2.0
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@cyr.info
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@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@cyr.info
_______________________________________________ Zope maillist - Zope@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
That's the ticket. You're right the CDATA solution is much better than html-quote'ing everything. Many thanks, -Jon Peter Bengtsson wrote:
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@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@cyr.info
_______________________________________________ Zope maillist - Zope@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 )
-- Jonathan Cyr cyrj@cyr.info
Jonathan Cyr wrote:
That's the ticket. You're right the CDATA solution is much better than html-quote'ing everything.
Many thanks,
-Jon
Peter Bengtsson wrote:
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.
Which is not really true, you still have to find a way to deal with your string if it contains ']]>' which is the end marker for CDATA. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
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.
Which is not really true, you still have to find a way to deal with your string if it contains ']]>' which is the end marker for CDATA.
I'm assuming this would work:: return "<![CDATA[%s]]>" % text.replace('[[>','\[\[\>')
Florent
-- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com _______________________________________________ Zope maillist - Zope@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
A ha... thanks for the tip. -Jon Florent Guillaume wrote:
Jonathan Cyr wrote:
That's the ticket. You're right the CDATA solution is much better than html-quote'ing everything.
Many thanks,
-Jon
Peter Bengtsson wrote:
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.
Which is not really true, you still have to find a way to deal with your string if it contains ']]>' which is the end marker for CDATA.
Florent
-- Jonathan Cyr cyrj@cyr.info
Jonathan Cyr wrote:
I am constructing an RSS 2.0 feed for a zope app. I am creating the rss.xml file in a DTML method.
Use ZPT, it's much better suited to this...
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.
What do you mean by "extended characters" here?
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()">
ZPT does html quoting by default, so provided summary.structured_text() does what yo uexpect it to, you could just do: <tal:x replace="summary/structured_text"/> That said, I'd pretty sure RSS feeds CAN include html, and it doesn't need to be quoted...
ps- I don't use ZPT, DTML was chose a while back, and would rather keep
Well, un-choose it, especially for something new and isolated like an RSS feed...
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
Huh?! Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Thanks... but go easy. I have to choose which features of Zope to learn and use, based on a much larger criteria than I can present here. I do not wish to mix ZPT and DTML in my project... I had chosen DTML, before ZPT was mature... It may be better, but I don't care for now... when I'm able to re-assess which pieces of Zope to use in a future project, I may well choose it. As a professional programmer, you must see the advantage in adhering to a project's standards and specs, as to managing the code in the project. That is why I needed to use DTML for my RSS. I have chosen my mix for this project, and benefit much more from my standards docs much more than any single feature like ZPT can provide. As far as I know, DTML is being supported into the future, and my hand will not be forced. I appreciate all the hard work in developing ZPT for the community, but it's just not for me, yet... probably be used in my first Zope 3 project instead. BTW, the solution presented by Peter hit the nail on the head... I have a very nice RSS setup now for my Zope app. Thanks, -Jon Cyr Chris Withers wrote:
Jonathan Cyr wrote:
I am constructing an RSS 2.0 feed for a zope app. I am creating the rss.xml file in a DTML method.
Use ZPT, it's much better suited to this...
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.
What do you mean by "extended characters" here?
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()">
ZPT does html quoting by default, so provided summary.structured_text() does what yo uexpect it to, you could just do:
<tal:x replace="summary/structured_text"/>
That said, I'd pretty sure RSS feeds CAN include html, and it doesn't need to be quoted...
ps- I don't use ZPT, DTML was chose a while back, and would rather keep
Well, un-choose it, especially for something new and isolated like an RSS feed...
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
Huh?!
Chris
-- Jonathan Cyr cyrj@cyr.info
Chris was merely suggesting. Technically ZPT is probably a better choice but DTML is pretty good too. On many of my projects that I started a longer time ago the less important templates were written in DTML because to me it was faster to write and the crucial ones that needed to last longer and might be edited by more people I used ZPT. Don't forget, for writing SQL statements and CSS sheets, DTML rocks! This proves why DTML won't go away as a supported templating "language". On 9/8/05, Jonathan Cyr <cyrj@cyr.info> wrote:
Thanks... but go easy.
I have to choose which features of Zope to learn and use, based on a much larger criteria than I can present here.
I do not wish to mix ZPT and DTML in my project... I had chosen DTML, before ZPT was mature... It may be better, but I don't care for now... when I'm able to re-assess which pieces of Zope to use in a future project, I may well choose it.
As a professional programmer, you must see the advantage in adhering to a project's standards and specs, as to managing the code in the project. That is why I needed to use DTML for my RSS.
I have chosen my mix for this project, and benefit much more from my standards docs much more than any single feature like ZPT can provide.
As far as I know, DTML is being supported into the future, and my hand will not be forced.
I appreciate all the hard work in developing ZPT for the community, but it's just not for me, yet... probably be used in my first Zope 3 project instead.
BTW, the solution presented by Peter hit the nail on the head... I have a very nice RSS setup now for my Zope app.
Thanks,
-Jon Cyr
Chris Withers wrote: Jonathan Cyr wrote:
I am constructing an RSS 2.0 feed for a zope app. I am creating the rss.xml file in a DTML method. Use ZPT, it's much better suited to this...
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.
What do you mean by "extended characters" here?
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()">
ZPT does html quoting by default, so provided summary.structured_text() does what yo uexpect it to, you could just do:
<tal:x replace="summary/structured_text"/>
That said, I'd pretty sure RSS feeds CAN include html, and it doesn't need to be quoted...
ps- I don't use ZPT, DTML was chose a while back, and would rather keep Well, un-choose it, especially for something new and isolated like an RSS feed...
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
Huh?!
Chris
-- Jonathan Cyr cyrj@cyr.info
_______________________________________________ Zope maillist - Zope@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
Hi Peter, Happy to have the choice, don't get me wrong. I found DTML very easy, I'm old school and generate all of my HTML/CSS by hand. In addition to CSS, I've found it pretty good for inserting items into JavaScript, Applet and Embed elements. I find that I'm attuned to a tag system that jumps out at me when reading.... The ZPT stuff wasn't as easy to parse visually for me.... but if you're a Dreamweaver user or something, I'm sure its a godsend. I can move quite fast in DTML, and my ability to parse it visually is key in my productivity. Funny, I bought Zope's approach "hook, line & sinker", early on, with the various Zope books published with DTML being a major piece of the Zope puzzle. DTML made sense to me then, still does. -Jon Peter Bengtsson wrote:
Chris was merely suggesting. Technically ZPT is probably a better choice but DTML is pretty good too. On many of my projects that I started a longer time ago the less important templates were written in DTML because to me it was faster to write and the crucial ones that needed to last longer and might be edited by more people I used ZPT.
Don't forget, for writing SQL statements and CSS sheets, DTML rocks! This proves why DTML won't go away as a supported templating "language".
On 9/8/05, Jonathan Cyr <cyrj@cyr.info> wrote:
Thanks... but go easy.
I have to choose which features of Zope to learn and use, based on a much larger criteria than I can present here.
I do not wish to mix ZPT and DTML in my project... I had chosen DTML, before ZPT was mature... It may be better, but I don't care for now... when I'm able to re-assess which pieces of Zope to use in a future project, I may well choose it.
As a professional programmer, you must see the advantage in adhering to a project's standards and specs, as to managing the code in the project. That is why I needed to use DTML for my RSS.
I have chosen my mix for this project, and benefit much more from my standards docs much more than any single feature like ZPT can provide.
As far as I know, DTML is being supported into the future, and my hand will not be forced.
I appreciate all the hard work in developing ZPT for the community, but it's just not for me, yet... probably be used in my first Zope 3 project instead.
BTW, the solution presented by Peter hit the nail on the head... I have a very nice RSS setup now for my Zope app.
Thanks,
-Jon Cyr
Chris Withers wrote: Jonathan Cyr wrote:
I am constructing an RSS 2.0 feed for a zope app. I am creating the rss.xml file in a DTML method. Use ZPT, it's much better suited to this...
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.
What do you mean by "extended characters" here?
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()">
ZPT does html quoting by default, so provided summary.structured_text() does what yo uexpect it to, you could just do:
<tal:x replace="summary/structured_text"/>
That said, I'd pretty sure RSS feeds CAN include html, and it doesn't need to be quoted...
ps- I don't use ZPT, DTML was chose a while back, and would rather keep Well, un-choose it, especially for something new and isolated like an RSS feed...
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
Huh?!
Chris
-- Jonathan Cyr cyrj@cyr.info
_______________________________________________ Zope maillist - Zope@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 )
-- Jonathan Cyr cyrj@cyr.info
(and after the flame bait, something real to argue with) Jonathan Cyr wrote:
Happy to have the choice, don't get me wrong. I found DTML very easy, I'm old school and generate all of my HTML/CSS by hand.
Indeed, generating HTML by hand is specifcally why I use ZPT. The well-formed-ness and associated checking mean I never miss out the odd
, or closing tag, which I remember being a constant problem, especially in complicated DTML.
There's also the rediculous DTML namespace lookup rules, which, once upon a time, I used to know, and now am grateful for not having to care about...
In addition to CSS, I've found it pretty good for inserting items into JavaScript, Applet and Embed elements.
I'd probably do these using a python script if ZPT can't cut it, which it often can. Although I still long for a ZPT mode which DOESN'T do some of the checking, and where you have better control over where whitespace is inserted...
I find that I'm attuned to a tag system that jumps out at me when reading.... The ZPT stuff wasn't as easy to parse visually for me....
I found a good HTML highlighting mode for my editor (emacs) helped a lot with this...
Funny, I bought Zope's approach "hook, line & sinker", early on, with the various Zope books published with DTML being a major piece of the Zope puzzle. DTML made sense to me then, still does.
Maybe you like ZClasses too? ;-) *grinz* Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Jonathan Cyr wrote:
I have to choose which features of Zope to learn and use, based on a much larger criteria than I can present here. I do not wish to mix ZPT and DTML in my project... I had chosen DTML, before ZPT was mature... It may be better, but I don't care for now... when I'm able to re-assess which pieces of Zope to use in a future project, I may well choose it.
Okay, whatever...
As a professional programmer, you must see the advantage in adhering to a project's standards and specs, as to managing the code in the project. That is why I needed to use DTML for my RSS.
Uh, no, as a professional programmer, I use the best tools for the job, and don't stand by mistakes I made before, like choosing DTML, especially when the two can co-exist quite happilly...
I have chosen my mix for this project, and benefit much more from my standards docs much more than any single feature like ZPT can provide.
Okay, whatever...
As far as I know, DTML is being supported into the future, and my hand will not be forced.
Then your hand will be burned, enjoy ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Dude, I appreciate the amount of effort that you contribute to the community... but that said... you really are quite rude and obnoxious.... hence the "Go easy" warning. Your skills in dealing with people pale in comparison to your Zope prowess. Talking down to people doesn't build community... no matter how right you are. Building a community isn't about code, or rightousness... it's about people... consider the effects of your tone on this list. If you need to be right that badly, have at it.... You're right, DTML sucks, ZPT and whatever else is the obvious solution... my issue is solved... thank you so much for your time. Bait taken, with apologies to all, -Jon Chris Withers wrote:
Jonathan Cyr wrote:
I have to choose which features of Zope to learn and use, based on a much larger criteria than I can present here. I do not wish to mix ZPT and DTML in my project... I had chosen DTML, before ZPT was mature... It may be better, but I don't care for now... when I'm able to re-assess which pieces of Zope to use in a future project, I may well choose it.
Okay, whatever...
As a professional programmer, you must see the advantage in adhering to a project's standards and specs, as to managing the code in the project. That is why I needed to use DTML for my RSS.
Uh, no, as a professional programmer, I use the best tools for the job, and don't stand by mistakes I made before, like choosing DTML, especially when the two can co-exist quite happilly...
I have chosen my mix for this project, and benefit much more from my standards docs much more than any single feature like ZPT can provide.
Okay, whatever...
As far as I know, DTML is being supported into the future, and my hand will not be forced.
Then your hand will be burned, enjoy ;-)
Chris
-- Jonathan Cyr cyrj@cyr.info
Does this affect Chris's chances in the annual "Zope Cogeniality Awards"? BTW DTML does not suck. I too have written lots of code w/it. I do find ZPT to be preferable - but it does take effort (brain re-wiring) and if your up to your elbows in alligators its just not the time to convert. I waited for the next project to go all ZPT (except with some CSS handling). I'm waiting for my next project to go all Zope 3 and I can't wait. :-) All best, David Jonathan Cyr wrote:
Dude,
I appreciate the amount of effort that you contribute to the community... but that said... you really are quite rude and obnoxious.... hence the "Go easy" warning.
Your skills in dealing with people pale in comparison to your Zope prowess. Talking down to people doesn't build community... no matter how right you are. Building a community isn't about code, or rightousness... it's about people... consider the effects of your tone on this list.
If you need to be right that badly, have at it.... You're right, DTML sucks, ZPT and whatever else is the obvious solution... my issue is solved... thank you so much for your time.
Bait taken, with apologies to all,
-Jon
Chris Withers wrote:
Jonathan Cyr wrote:
I have to choose which features of Zope to learn and use, based on a much larger criteria than I can present here. I do not wish to mix ZPT and DTML in my project... I had chosen DTML, before ZPT was mature... It may be better, but I don't care for now... when I'm able to re-assess which pieces of Zope to use in a future project, I may well choose it.
Okay, whatever...
As a professional programmer, you must see the advantage in adhering to a project's standards and specs, as to managing the code in the project. That is why I needed to use DTML for my RSS.
Uh, no, as a professional programmer, I use the best tools for the job, and don't stand by mistakes I made before, like choosing DTML, especially when the two can co-exist quite happilly...
I have chosen my mix for this project, and benefit much more from my standards docs much more than any single feature like ZPT can provide.
Okay, whatever...
As far as I know, DTML is being supported into the future, and my hand will not be forced.
Then your hand will be burned, enjoy ;-)
Chris
-- Jonathan Cyr cyrj@cyr.info
Jonathan Cyr wrote:
I appreciate the amount of effort that you contribute to the community... but that said... you really are quite rude and obnoxious.... hence the "Go easy" warning.
Some might say you are being rude and obnoxious by deliberately ignoring good advice and continuingto whinge ;-)
If you need to be right that badly, have at it.... You're right, DTML sucks, ZPT and whatever else is the obvious solution... my issue is solved... thank you so much for your time.
I'm glad you finally see the light :-P Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris, you are hurting my ears, please stop. :)
participants (6)
-
Chris Withers -
David H -
Florent Guillaume -
Jonathan Cyr -
Peter Bengtsson -
Simon Michael