Re: [Templates] Chomping without joining lines

[prev] [thread] [next] [Date index for 2004/12/15]

From: Andy Wardley
Subject: Re: [Templates] Chomping without joining lines
Date: 19:16 on 15 Dec 2004
Len Weisberg wrote:
> What I'm looking for is a flavor of a "chomp" option, somewhat analogous to
> how CHOMP_COLLAPSE targets the specific needs of HTML.  

Sounds reasonable.  Perhaps in addition to:

   CHOMP => CHOMP_NONE       (0)
   CHOMP => CHOMP_REMOVE     (1)
   CHOMP => CHOMP_COLLAPSE   (2)

we could also allow CHOMP to be set to any other value to indicate what 
character(s) you want the whitespace collapsed to.  e.g.

   CHOMP => "\n"            

In TT3 there is a new chomp flag '=' to indicate the CHOMP_COLLAPSE
behaviour, in addition to '-' which does CHOMP_REMOVE.  So with POST_CHOMP 
set to "\n", you could do this:

  [% blah =%]    # to collapse to a newline
  [% blah %]

and/or this:

  [% blah -%]    # to remove newline and all whitespace
  [% blah %]


A


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Chomping without joining lines
Len Weisberg 18:11 on 15 Dec 2004

Re: [Templates] Chomping without joining lines
Vivek Khera 18:27 on 15 Dec 2004

Re: [Templates] Chomping without joining lines
Len Weisberg 18:56 on 15 Dec 2004

Re: [Templates] Chomping without joining lines
Andy Wardley 19:16 on 15 Dec 2004

Re: [Templates] Chomping without joining lines
Len Weisberg 20:00 on 15 Dec 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52