[Zope] structured text with <dtml> tags?
Tres Seaver
tseaver@palladion.com
Wed, 23 Feb 2000 10:56:56 -0600
"R. David Murray" <bitz@bitdance.com> 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?
There is a function, html_quote(), defined both in the StructuredText module and
in DocumentTemplate/DT_Util.py, which escapes, the '<>&"' characters. I think
you would need to apply this on the inbound side (as you were saving the STX) to
make it effective. A PythonMethod to do this looks like:
return special_formats[ 'html-quote' ]( untrusted_txt )
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com