How can I render structured-text from PythonMethods?
I want to be able to run structured_text and newline_to_br and html_quoute - all the formatting options available in DTML - using PythonMethods. Something like: a = structured_text(self.body) is there any way to do this?
I have not used PythonMethods yet but I assume they are like External Methods. In which case you could import StructuredText and use the two functions: StructuredText.html_quote(self.body) StructuredText.html_with_references(self.body,level=1) where level is the base level of your text, for instance if you set it to 3 then the first header will be <H3> Pavlos On Mon, 13 Dec 1999 itamars@ibm.net wrote:
I want to be able to run structured_text and newline_to_br and html_quoute - all the formatting options available in DTML - using PythonMethods. Something like:
a = structured_text(self.body)
is there any way to do this?
_______________________________________________ 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 )
Pavlos Christoforou wrote:
I have not used PythonMethods yet but I assume they are like External Methods.
Not really. Since they're intended to be as safe as DTML, they aren't allowed to import.
On Mon, 13 Dec 1999 itamars@ibm.net wrote:
I want to be able to run structured_text and newline_to_br and html_quoute - all the formatting options available in DTML - using PythonMethods. Something like:
a = structured_text(self.body)
is there any way to do this?
Yes, in version 0.1.7 (just put up) you can access all of the special dtml-var formats through a builtin dictionary called (surprise!) special_formats. This allows you to do the following (tested code): return special_formats['structured-text']('*Hi* _there_') It's verbose, but if you need to apply one multiple times you can do this: hq = special_formats['html-quote'] txt1 = hq(txt1) txt2 = hq(txt2) #etc Cheers, Evan @ 4-am
participants (3)
-
Evan Simpson -
itamars@ibm.net -
Pavlos Christoforou