[Zope] tag suggestions: format tag

Jeffrey Shell Jeffrey@digicool.com
Fri, 23 Jul 1999 10:33:16 -0400


> <!--#format StructuredText-->
> *Item 1
> *Item 2
> <!--#/format-->
> 
> or if I want to plain text (and not have DTML processed) I 
> could do the
> following
> 
> <!--#format PlainText-->
> 
> <!--#var "This line won't be rendered"-->
> 
> <!--#/format-->
> 
> Good idea or not?

Decent idea.  I would suggest the tag be named "block" and have format
be one of the parameters.

> My rationale is as follows. 
> 1. I want to be able to add documents in various formats. The 
> format is
> fixed at creation time. I don't want to have to tell zope how 
> to render
> something everytime it is to be rendered. A structured text 
> document is a
> structured text document. An alternative way of doing this is to have
> another property of a document specifying how it is to rendered.

We've built some ZClasses that do this.  I think some of them are part
of the PTK (Portal ToolKit).  In essence, they have a "Contents" view
(tab) with a big text area for content, and an property for format with
the options of "Plain Text", "Structured Text", and "HTML".  Then
there's a "Format" view which is actually a document template that looks
like the following:

<!--#var standard_html_header-->

<!--#if expr="format=='Structured Text'"-->
<!--#var content fmt=structured-text-->
<!--#elif expr="format=='Plain Text'"-->
<PRE><!--#var content--></PRE>
<!--#else-->
<!--#var content-->
<!--#/if-->

<!--#var standard_html_footer-->

> 2. How do I display DTML syntax in a DTML document?

It's been a while since I've done this.  I think it's generally been
done by uploading a DTML source file as a File object and referencing it
(using html_quote on the #var tag).  There may be a newer way around
this.

.jPS