[ZPT] Structured text in a ZPT

Evan Simpson evan@zope.com
Sun, 2 Sep 2001 15:58:49 -0400


From: "Phil Aylesworth" <paylesworth@stclaircollege.ca>
> This has been holding me back from really jumping into ZPT. I hope I
am
> just overlooking something obvious.

It's not obvious, but it's possible.  You need to use the 'modules'
variable to get the dictionary of standard formatting functions, like
this:

<div tal:define="sfmt
modules/Products/PythonScripts/standard/special_formats; sttxt
nocall:sfmt/structured-text">
  <span tal:replace="structure python:sttxt(blurb)">The blurb</span>
</div>

All of the DTML formatting functions are accessible through
special_formats.  Since structured-text emits tags, you need to use the
'structure' keyword in the tal:replace statement.  Since it's a
function, you need to use nocall: when making the nickname 'sttxt', to
avoid prematurely calling it.

Cheers,

Evan @ Zope