velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Bachelder <cho...@chowda.net>
Subject Re: indentation of templates
Date Tue, 12 Mar 2002 18:01:00 GMT
+1

On Tue, 12 March 2002, Christoph Reck wrote:

> 
> Sorry, but placing the #if and #else directives at the beginning of the 
> line becomes ugly with nested conditions. It also gets ugly with
> #set directives within...
> 
> I've been asking the list in the past on who's interested on getting 
> the whitespace handling in velocity fixed to work transparently and as 
> expected. I proposed how this could be and got no supporting requests 
> for getting this proposal implemented:
> 
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg01310.html
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg02594.html
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg04683.html
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg04679.html
> http://www.mail-archive.com/velocity-dev@jakarta.apache.org/msg01645.html
> http://www.mail-archive.com/velocity-dev@jakarta.apache.org/msg02454.html
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg04122.html
> 
> Since it will break the current test suit (which needs to be updated 
> according to any new whitesapce handling rules), we need to find the 
> right moment (release 1.4?) for this update.
> 
> I really hope correct and simple whitespace handling finds its way into
> velocity.
> 
> Everyone (even non-committers) "please* speak up if you see my proposed
> whitespace handling is OK (send a +1) or if you see a drawback or reason
> not to do it so (many eyes can see more than mine two).
> 
> Should I resubmit my proposal? To the "user" or to the "dev" list?
> 
> Cheers,
> :) Christoph Reck
> 
> Simon Christian wrote:
> > 
> > Should the #if directive be gobbling the whitespace before it? I've
> > found the same effect as you evidently have, but get around it by
> > starting the #if and #else directives at the beginning of the line i.e.
> > 
> > #if (this-is-true)
> >         output true stuff
> >         $context.applyTemplates("section")
> > #else
> >         output false stuff
> >         #execute_a_macro()
> > #end
> > 
> > I agree wholeheartedly with you on the desired output formatting, just
> > not sure that anything has gone *wrong* in Velocity in this case.
> > 
> > - s
> > 
> > Bill Burton wrote:
> > 
> > > Hi Sebastien,
> > >
> > > Glad to hear you like Velocity.
> > >
> > > I have recently run into the same extra whitespace issue while working on
> > > a DVSL stylesheet.  The #if directive never seems to gobble up leading
> > > whitespace even if it's the only thing on the line.  Whereas the #set
> > > directive does do this.
> > >
> > > What I did to allow indentation of directives while eliminating the extra
> > > whitespace is to use multiline comments to hide whitespace.  If these
> > > comments are used before #if, #else, #elseif and matching #end's as well
> > > as before invoking other tools or macros, you can get the output to be
> > > indented properly.  Here's an example:
> > >
> > > #*       *##if (this-is-true)
> > >            output true stuff
> > > #*         *#$context.applyTemplates("section")
> > > #*       *##else
> > >            output false stuff
> > > #*         *##execute_a_macro()
> > > #*       *##end
> > >
> > > Even though the above looks odd, I like it much better than putting
> > > everything flush left.
> > >
> > > The only thing is once in a while, I've forgotten the # before the
> > > directive and put *#else instead of *##else.
> > >
> > > If you need to eliminate blank lines, start the #* at the end of the prior
> > > line to comment out the enclosed newline.
> > >
> > > -Bill
> > >
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>
> 
> -- 
> :) Christoph Reck
> 
> --
> To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message