[Zope] ZPT and Structured text

Geir Bækholt Geir Bækholt <geirh@funcom.com>
Thu, 16 May 2002 10:53:44 +0200


on or about, Thursday, May 16, 2002, we have reason to believe that
David Kyte wrote something along the lines of :

DK> I would like to pull data from a database - text with paragraphs.
DK> I then want to format that as structured text, inserting the=20
DK> result into a page template.

DK> The question I guess is - can I use the structured text fromatin
DK> code to format the database text before inserting into the ZPT=3F

DK> TIA
DK> Dave Kyte

what i find to be the cleanest way is the following:

create a pythonScript with id "stx"

parameters : text
##########
from Products.PythonScripts.standard import structured_text
return structured_text(text)
##########

then you can simply do the following in your pageTemplate:

<p tal:replace=3D"python:here.stx(YourStringToBeFormattedAsStructuredText)"=
/>

hth
:)


--=20
Geir B=E6kholt                      web-developer
geirh@funcom.com             funcom oslo | webdev-team