[Zope] can I suppress newlines/whitespace in DocumentTemplates?

Skip Montanaro skip@mojam.com (Skip Montanaro)
Tue, 19 Sep 2000 15:11:47 -0500 (CDT)


I'm starting to use DTML to generate plain text output.  Generally speaking,
the amount of DTML used to represent a particular chunk of output is much
longer than the output itself.  For instance, something like

    <dtml-var "_['start'].strftime('%m/%d%y')"><dtml-if "start != end"-->-<dtml-var "_['end'].strftime('%m/%d%y')"></dtml-if-->

will expand to something as short as

    9/25/00

or

    9/25/00-9/26/00

I'd like to structure my DTML so it is vaguely readable:

    <dtml-var "_['start'].strftime('%m/%d%y')">
    <dtml-if "start != end"-->
        -<dtml-var "_['end'].strftime('%m/%d%y')">
    </dtml-if-->

This means inserting newlines and doing some indenting.  Unfortunately,
since I'm generating plain text, the newlines and indentation count (unlike
with HTML).  Is it possible to tell the formatter to either ignore
whitespace around the current location or turn off implicit whitespace
rendering altogether?  <dtml-comment> seems like overkill and would add a
lot of <tags> to the total amount of text my eyes have to analyze.

If it matters, I'm using Zope 2.2.1.  I'm currently using the
DocumentTemplate.HTMLFile class, but could easily change if one of the
others provides more convenient default behavior.  (Would it be possible to
subclass File or HTMLFile to get the behavior I want?)

Thx,

-- 
Skip Montanaro (skip@mojam.com)
http://www.mojam.com/
http://www.musi-cal.com/