[ZPT] whitespace bug

Martijn Pieters mj@zope.com
Thu, 21 Nov 2002 10:07:35 -0500


On Thu, Nov 21, 2002 at 10:57:13AM +0000, Chris Withers wrote:
> >Why is this a bug?
> 
> There's no space between the <span> and the </span>, so why should any be 
> included in the output?

No additional whitespace is included between the opening and closing span
tags other than that present in the inserted content.

The whitespace I was talking about was that *surrounding* the span tags; the
whitespace before the <span> tag and after the </span> tag.

> >This is intended behaviour; whitespace surrounding a repeated tag is
> >repeated as well. Otherwise there would be no way to preserve whitespace in
> >between repeated items!
> 
> Why would you want to?

Because whitespace between tags is significant in browsers. Sometimes you
don't want the spaces, sometimes you do. Especially when you place the tag
on its own line, the original (unrendered) template will show whitespace
around that item.

> >Putting the repeated tag directly inside another eliminated the whitespace
> >(including the newline) and was thus not repeated.
> 
> Is that documented anywhere?

I don't know.

> >The whitespace included is limited to the whitespace on the line, IIRC. 
> >This
> >is reasonable and confirms to the XML specs. 
> 
> Which one?

XML 1.0 second edition.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@zope.com
| Zope Corporation   http://www.zope.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------