Hi Paul, Thanks for all your efforts on this. Sorry to not reply sooner but I've been busy in the Real World[tm]. Just catching up with things now.
That part of the codebase changed slightly in 2.14a with a patch that fixed a line counting bug. I need to check it over and manually apply the changes to make sure we don't screw up what's already been fixed. I'll try and get that done before the week's out. Here's the patch FYI: http://tt2.org/pipermail/templates/2005-December/008157.html I must admit I'm a little wary about adding new flags that don't invoke any obvious meaning. I want to try to avoid the slippery slope into the kind of "line noise" that plagues some markup/programming languages (although some might argue it's already too late...) With '-' and '+' it's fairly clear (once you know what they do) that '-' removes whitespace and '+' leaves it alone. The same is also true of '=' for collapsing, if you think of it as two '-' signs with a space between them. That's also analogous to what the operator does. However '~' and '^' are a little more cryptic. Of course there are only so many characters to choose from (and those are probably as good as any), but I'm wondering if we can optimise the solution a little and do away with one of them altogether. I propose we go ahead and add the '~' operator for a greedy chomp (we tell people it's just a wiggly '-' that goes up to eleven). Then we make the '=' collapse operator do what it always should have done, which is to replace *all* leading/trailing whitespace with a single space. In other words, it will do what your CHOMP_HTML/^ does. At present it replaces only the whitespace up to and including the next newline. However, it was added to mimic the whitespace collapsing behaviour provided by XML parsers (as defined in the XML Schema spec.) and that collapses all whitespace including newlines. The reason we care about what XML has to say on the subject is because it defines the rules for how browsers treat whitespace in (X)HTML documents, and thus determines how we should go about creating them. For those who don't already know, the purpose of the collapse flag is to allow you to do this: [% forename =%] [% surname %] in order to get this: [% forename %] [% surname %] This works exactly the same regardless of the implementation (i.e. we're not going to break anyone's existing templates). However, with the current implementation you can't do this to get the same effect. [% forename =%] [% surname %] With the new behaviour, that will now work. Although it's feasible that someone may have a template that specifically uses that last example because they want a space and a newline, it's far more likely that they would have just put the space at the end of the line and not used the '=' flag at all. [% forename %] <- space [% surname %] So I'm fairly confident that we're not going to screw anyone with this change, and there are plenty of ways to get the "old skool" behaviour if you really want it for some reason. But if anyone knows different then now is the time to speak... Cheers A _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
