On Friday 08 June 2001 10:35, Mike Orr wrote:
> On Fri, Jun 08, 2001 at 10:03:26AM -0700, Tavis Rudd wrote:
> > I just thought of a new directive that might be
> > very useful in TemplateServer #for loops:
> > #slurp --- for slurping up the whitespace that follows
> > it, upto and including the first \n

> Plow does something like this for blocks.  A regex
> matches "before the block", "the block body" and "after
> the block" (the block tags themselves are thus removed). 
> Then for all parts except the first, a single leading
> newline is removed if present.

I should have mentioned that this is already the behaviour
for all the #directives.  See the Tests.py suite for lots 
of whitespace handling examples.

My idea was to introduce a dummy directive that does nothing
but slurp up a newline when you are writing #for loops.

===== no slurping 
#for $i in range(3)
$i
#for
--->> 0\n1\n3\n
===== slurp with #slurp
#for $i in range(3)
$i #slurp
#for
--->> 0 1 2
===== or 
#for $i in range(3)
$i #for
--->> 0 1 2

The former is more readible.

Tavis




_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to