Hi Rob,

> I read the velocity docs, and according to them I can
> write the function below in two ways:
> 
> Method 1:
>  
> #macro(displayPositiveOnly $val)
>       #if($val >= 0)
>               $val
>       #end
> #end
> 
> Method 2:
> 
> #macro(displayPositiveOnly $val)#if($val >=
> 0)$val#end#end
> 
> And either way the output will be the same.

I'm guessing you're talking about this:
  http://jakarta.apache.org/velocity/user-guide.html#VTL:%20Formatting%20Issues

>  I have
> tried both ways of defining the macro, and indeed both
> ways have the same output.  However, both ways also
> add about half a dozen extra spaces in front of $val,
> which causes a problem.  Does Velocity have a bug in
> it's white space removal?  Am I doing something wrong?

This has been an issue for a long time.
  http://wiki.apache.org/jakarta-velocity/VelocityWhitespaceGobbling

As for the document, I think it is misleading (or not right), since it
does not reflect the current behaviour.

The first example (the one in one line) will output:
Send me $10 and  a cake  please.

The second example (the one with line feeds) will output:
Send me
$10 and 
a cake
please.

The last example (the one I can't read) will output:
Send me
                 $10 and 
         a cake
          please.

They may be all the same rendered in HTML, but not in regular text.

## But you can send me all the cake you want in any case.  ;)

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <[EMAIL PROTECTED]>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to