On 3/5/07, Steven Shaw <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to