velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <Christoph.R...@dlr.de>
Subject Re: indentation of templates
Date Wed, 13 Mar 2002 09:41:50 GMT
answers inline...

Tim Colson wrote:
> 
> > I proposed how this could be and got no supporting requests
> > for getting this proposal implemented:
> +0.5
> 
> (Some bits I like others I'm not sure about.)
> 
> A. Any directive standalone within one line like these
>        #if(...)
>          schmoo
>        #end
>    should gobble leading and trailing whitepaces including the EOL.
> 
> Ok - I like that idea, but what does the template look like to get
> schmoo WITHOUT a newline?

use a #macro(write $foo)$foo#end
and call it with
       #if(...)
         #write("schmoo")
       #end
which should then emit no whitespace.

> 
> > Whitespace gobbling can be inhibited transparently by adding a #**#
> > before or after the directive.
> 
> Hmm...that'd be odd to explain to a template author why/when they have
> to stick #**# at the end of 'some lines' and not others. (See my
> previous post.)

The rule should be (and currently is) that 
       #if(...)
         schmoo
       #end
the newline after the #if(...) does not show on the output.

It is a bit different for #macro(...), #include(...), and #parse(...)
where I would expect it either is pre-formatted or explicetly passes 
an $indent parameter which is prefixed to each output line.

If the above #write macro should be emitted indented, then the author 
will need to do something like:
       #if(...)
         #keepIndent()#write("schmoo")
       #end
or the shortcut:
       #if(...)
         #**##write("schmoo")
       #end

> 
> > Does someone have a better suggestion to obtain the same results?
> Heh heh - howabout the previously posted
> #gobblewhitespace(on/off) 'processing instruction'

This would also be a solution, but would make things look funny with loads 
of #gobblewhitespace(on/off) when one wants the whitespace around directives
to be gone, whereas whitespaces around schmoo should be kept.

> 
> Timo
> 
> --
> 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>


Mime
View raw message