You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Steven Shaw <st...@eiger.co.uk> on 2007/03/05 11:05:02 UTC
continuation lines
Is there any way to split a long line?
e.g.
# macro (aVeryLongMacroName $aVeryLongParameterName1
$aVeryLongParameterName2 $aVeryLongParameterName3
$VeryLongParameterName4)
I tried "\" at the end of the line but that wasn't it.
An alternative to using many arguments would be to use a single argument
that is a bean containing all the arguments. Is it possible in VTL to
create a new object in order to assign it's properties prior to a macro
call? Or perhaps create an object literal like in JavaScript?
e.g.
#macro (myMacro params)
Hi $params.Name
#end
#myMacro({name: 'Steve'})
Cheers,
Steve.
RE: continuation lines
Posted by Steven Shaw <st...@eiger.co.uk>.
Thanks for your response, Nathan. That's good news! I look forward to
Velocity 1.5.
Cheers,
Steve.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: continuation lines
Posted by Nathan Bubna <nb...@gmail.com>.
On 3/5/07, Steven Shaw <st...@eiger.co.uk> wrote:
> Is there any way to split a long line?
>
> e.g.
>
> # macro (aVeryLongMacroName $aVeryLongParameterName1
> $aVeryLongParameterName2 $aVeryLongParameterName3
> $VeryLongParameterName4)
>
> I tried "\" at the end of the line but that wasn't it.
If you use the latest version (currently 1.5-beta2, but hopefully 1.5
final within the week), then you can split long lines like this
without any need for \ at the end or anything like that. Multi-line
directive calls and string literal definitions (e.g. #set( $foo =
'hello
there' ) ) are new features in Velocity 1.5.
> An alternative to using many arguments would be to use a single argument
> that is a bean containing all the arguments. Is it possible in VTL to
> create a new object in order to assign it's properties prior to a macro
> call? Or perhaps create an object literal like in JavaScript?
>
> e.g.
>
> #macro (myMacro params)
> Hi $params.Name
> #end
>
> #myMacro({name: 'Steve'})
in the 1.5 family, you can now also define map literals.
#myMacro( { 'name' : 'Steve' , 'age' : 27 } )
> Cheers,
> Steve.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org