[Zope] ZPT arbitrarily inserting white-space

Steve Jibson stevej at parlant.com
Wed Jun 9 17:32:18 EDT 2004


So, I've decided to make the switch from DTML to ZPT and the changeover 
has gone fairly well.  I am running into a little snag though.  It 
appears that ZPT arbitrarily inserts newlines and white space into the 
rendered html.

I've managed to condense my problem down to a simple example:

ZPT #1 (this is all one line--if not, it got mangled by email):

<span tal:repeat="item python:['one', 'two', 'three', 'four']" 
tal:replace="item">ITEM GOES HERE</span>


ZPT #2 (this is two lines--if not, it got mangled by email):

<span></span>
<span tal:repeat="item python:['one', 'two', 'three', 'four']" 
tal:replace="item">ITEM GOES HERE</span>


When I display these in my browser, the fist gives me "onetwothreefour", 
just as I would have expected.  The second gives me "one two three four" 
and if I view the html, there is a newline after each of the "one", 
"two", "three" and "four" that really shouldn't be there.  The 
tal:repeat statements haven't changed from #1 to #2, the only difference 
is the addition of the first "<span></span>" line.

I have also seen ZPT change something like this:

<span class="someclass" style="color:red">X</span>

to something like this:

<span class="someclass"
     style="color:red">X</span>

Is there a way to tell ZPT not to mess with my white space?

Thanks,

Steve

P.S.  Zope 2.7.0, python 2.3.3, linux



More information about the Zope mailing list