can I suppress newlines/whitespace in DocumentTemplates?
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/
At 9/19/00 03:11 PM, Skip Montanaro wrote:
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)...
Even in HTML, the indents and newlines count by showing up as a space before the '-' in the above example. You can fix this with good readability simply by "delaying" the closing '>'. For example, <dtml-var "_['start'].strftime('%m/%d%y')" ><dtml-if "start != end" >-<dtml-var "_['end'].strftime('%m/%d%y')" ></dtml-if> -- Dennis Nichols nichols@tradingconnections.com
participants (2)
-
Dennis Nichols -
Skip Montanaro