structured text with <dtml> tags?
Hello List, I'm still discovering Zope and I'm having fun with structured text. I'm wondering if there's a way to evaluate <dtml> tags in the structured text before (or after) rendering the structured text to HTML. Right now i'm using <dtml-var my_text fmt=structured-text>, which includes the DTML in the HTML without touching it. Thanks! Alex.
On Tue, 22 Feb 2000, Alex Burton wrote:
I'm still discovering Zope and I'm having fun with structured text. I'm wondering if there's a way to evaluate <dtml> tags in the structured text before (or after) rendering the structured text to HTML.
Since StructuredText's main purpose (I think) is to be reasonably formatted for reading as straight ASCII while containing enough structure to allow better rendering, I'm not sure why you'd want to interpret dtml tags inside it. In fact, I'd like the opposite: a way to supress the interpretation of *html* inside structure text (or, rather, to have the structured text output quote the html as appropriate to get it to render rather than interpret), thus allowing structured text fields to be used as a safe data entry format for a portal-type site. I'm guessing that there's a function I can call to do this encoding before passing the thing to the structured text interpreter, but I'm not sure what the magic incantation is. Can someone enlighten me? --RDM
On Tue, 22 Feb 2000, R. David Murray wrote:
On Tue, 22 Feb 2000, Alex Burton wrote:
I'm still discovering Zope and I'm having fun with structured text.
Yes I really like it too.
a way to supress the interpretation of *html* inside structure text (or, rather, to have the structured text output quote the html as
Well it can be done already if it is part of code section, ie: the following is not going to be interpret:: <H1>Hello</H1>
appropriate to get it to render rather than interpret), thus allowing structured text fields to be used as a safe data entry format for a portal-type site. I'm guessing that there's a function I can call to do this encoding before passing the thing to the structured text interpreter, but I'm not sure what the magic incantation is. Can someone enlighten me?
Oh I see you are asking a different question. Unfortunately the way to do it is to use the html-quote format parameter and I do not know of a way to to include two format parameters. But in the case of entry forms couldn't you html-quote the form input fields before storing them? Pavlos
I've also been enjoying discovering structured text and have been making modifications like crazy. I've been submitting them to the collector but unfortunately it doesn't look like they'll be applied for a number of reasons. Among the modifications I've made are: - A way to mark sections to be html quoted. """This text is html quoted: <dtml-var foo> So is this: <dtml-var bar> """ <b>This is not.</b> - A way to mark anchors and anchor links that do not include the delimiters in the text. {anchor} => <a href="#anchor">anchor</a> (as opposed to) [anchor] => <a href="#anchor">[anchor]</a> - Allowing spaces in anchors (both [] and {}) {multiple word anchor} => <a href="#multiple word anchor"> .. {multiple word anchor} => <a name="multiple word anchor"> - Allowing horizontal whitespace before anchors. Heading .. {Subheading that is also an anchor} foo paragraph - Allowing newlines in dictionary list terms. this is a really long term that I don't want to put all on one line -- foo definition - Fixed a bug in ".. [foo]" which actually accepts any two (non-newline) characters instead of two periods. (didn't see this in the collector) xy [foo] => <a name="foo">[foo]</a> The list of modifications is getting so extensive and I'm getting so dependent on them that I'm thinking about creating my own structured text product, StructuredTextPlus or something like that. Especially since DC has told me that my patches probably won't be accepted through no fault of the patches. I'd really like to know if anyone else is interested in seeing any of this functionality added to structured text because I would rather have it added to the distribution, or perhaps rolled into one of the structured text document products I've been hearing about. It seems silly to duplicate most of the effort for just a few changes. -jfarr
On Tue, 22 Feb 2000, Jonothan Farr wrote: <snipped interesting modifications ...>
The list of modifications is getting so extensive and I'm getting so dependent on them that I'm thinking about creating my own structured text product, StructuredTextPlus or something like that. Especially since DC has told me that my patches probably won't be accepted through no fault of the patches.
Sometimes it is difficult to justify new features though I think that the bugs you mentioned should be corrected. In any case I think it would be a good idea to have a StructuredTextPlus module and maintain it seperately. IMHO it should be rewritten completely but I think Jim Fulton chose that particular design for performance reasons. I do not expect any major changes to the official StructuredText module so maintaining a new version would not be very difficult. If you want I can send you my patches for simple table support (and a few other bug fixes) and add them to your StructuredTextPlus ( if you haven't realised it yet you are now the official StructuredTextPlus maintainer ;-) ). Tables are currently entered as: - A paragraph that has blocks of text enclosed in '||' is treated as a table. The text blocks correspond to table cells and table rows are denoted by newlines. By default the cells are center aligned. A cell can span more than one column by preceding a block of text with an equivalent number of cell separators '||'. Newlines and '|' cannot be a part of the cell text. For example: |||| **Ingredients** || || *Name* || *Amount* || ||Spam||10|| ||Eggs||3|| is interpreted as:: <TABLE BORDER=1 CELLPADDING=2> <TR> <TD ALIGN=CENTER COLSPAN=2> <strong>Ingredients</strong> </TD> </TR> <TR> <TD ALIGN=CENTER COLSPAN=1> <em>Name</em> </TD> <TD ALIGN=CENTER COLSPAN=1> <em>Amount</em> </TD> </TR> <TR> <TD ALIGN=CENTER COLSPAN=1>Spam</TD> <TD ALIGN=CENTER COLSPAN=1>10</TD> And in case you need PDF output for your structuredtext docs, I have writen a Zope product which you can get from www.zope.org/Members/gaaros Regards Pavlos
If you want I can send you my patches for simple table support (and a few other bug fixes) and add them to your StructuredTextPlus ( if you haven't realised it yet you are now the official StructuredTextPlus maintainer ;-) ).
OK. I can live with that. I think it needs a better name, though. =) Yes, please send me your patches and I'll add them in. -jfarr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi! I'm a signature virus. Copy me into your .sig to join the fun! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is getting back to the original subject. I just realized the approach was wrong. There is _nothing_ keeping StructuredText from having DTML tags. What can't have DTML is Properties. If you write your StructuredText as a DTML Method or DTML Document "mytext", and then call it from somewhere else with <dtml-var mytext fmt=StructuredText>, it _will_ interpret DTML tags, because DTML doesn't care for the surrounding language (everything outside DTML tags is CDATA). []s, |alo +---- -- I am Lalo of deB-org. You will be freed. Resistance is futile. http://www.webcom.com/lalo mailto:lalo@webcom.com pgp key in the web page Debian GNU/Linux --- http://www.debian.org Brazil of Darkness -- http://zope.gf.com.br/BroDar
One more very useful thing for the list: convert foo bar <foo@bar.com> when alone in the line or paragraph to <a href="mailto:foo@bar.com">foo bar</a> when not alone; from: foo bar <foo@bar.com> -> from: <a href="mailto:foo@bar.com">foo bar</a> ...then send mail to foo bar <foo@bar.com> -> ...then send mail to foo bar <a href="mailto:foo@bar.com"><foo@bar.com></a> Doable? This would be great for displaying mail messages. []s, |alo +---- -- I am Lalo of deB-org. You will be freed. Resistance is futile. http://www.webcom.com/lalo mailto:lalo@webcom.com pgp key in the web page Debian GNU/Linux --- http://www.debian.org Brazil of Darkness -- http://zope.gf.com.br/BroDar
Note that there is a minor behavioral difference when you put structured text in a dtml document (or method) and when you put it in a straight file object, although you loose the benefit of editing the content through the web (you can use FTP, or HTTP PUT, or whatever) any dtml in the structured text will not get rendered, and thus, is 'quoted'. -Michel "R. David Murray" wrote:
On Tue, 22 Feb 2000, Alex Burton wrote:
I'm still discovering Zope and I'm having fun with structured text. I'm wondering if there's a way to evaluate <dtml> tags in the structured text before (or after) rendering the structured text to HTML.
Since StructuredText's main purpose (I think) is to be reasonably formatted for reading as straight ASCII while containing enough structure to allow better rendering, I'm not sure why you'd want to interpret dtml tags inside it. In fact, I'd like the opposite: a way to supress the interpretation of *html* inside structure text (or, rather, to have the structured text output quote the html as appropriate to get it to render rather than interpret), thus allowing structured text fields to be used as a safe data entry format for a portal-type site. I'm guessing that there's a function I can call to do this encoding before passing the thing to the structured text interpreter, but I'm not sure what the magic incantation is. Can someone enlighten me?
--RDM
_______________________________________________ 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 )
participants (6)
-
Alex Burton -
Jonothan Farr -
Lalo Martins -
Michel Pelletier -
Pavlos Christoforou -
R. David Murray