[ZPT] TAL spec incorrect?

Florent Guillaume fg@nuxeo.com
Thu, 1 Aug 2002 13:38:57 +0000 (UTC)


Interesting. I didn't know that.

What happens is that if there is only whitespace between the start of
the line and the tag, it gets repeated too (with a newline).

This part of the code in TALGenerator does that:

        if repeat:
            # Hack to include preceding whitespace in the loop program
            repeatWhitespace = self.unEmitNewlineWhitespace()

I can see that it is useful but it's a gotcha in some cases...

Florent

Lalo Martins  <lalo@laranja.org> wrote:
> I know this is nitpicking, but I just hurt my feet on it:
> 
> the spec (and the zope book chapter) claim tal:repeat repeats the element
> where it happens. If this was strictly true, it would break test14:
> 
>   <span tal:repeat="x python:['Harry', 'Ron', 'Hermione']" tal:replace="x" />
> 
> should render as "HarryRonHermione" and not, as the test wants,
> 
>   Harry
>   Ron
>   Hermione
> 
> 
> I don't know what *should* be the correct wording - match exacly what TAL
> currently does? What is it? Or state that some whitespace should be inserted
> between the repetitions?
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com