You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Stan Devyatovsky <st...@devyatovsky.com> on 2004/08/31 15:22:27 UTC

Re[2]: Capture directive

Hello Nathan,

 Thanks for the info, Nathan! I will try searching the archive.
 Still, I think this directive would be worth including it in official
 package. I think it should be not difficult to implement.
>> Velocity has "set" directive:
>> #set($a = "text text text")
>>
>> Now is there something like #capture directive in Velocity?
>>
>> #capture($a)
>> text text
>> multiline text
>> <html tags here... />
>> #end
>>
>> So that $a variable would be assigned the content between "capture"
>> and "end"?


NB> there's nothing official, but there have been a few custom directives that do
NB> this posted over the years.  it seems to me there was one posted about a year
NB> ago or so that was called #define and works like yours below.  try searching
NB> the archives for it.  if you can't find it, i think i still have a copy saved
NB> somewhere and i can repost it.

NB> oh, and i'm pretty sure that the current CVS HEAD of velocity supports line
NB> breaks in #set() statements, so you could do:

NB> #set( $a = "
NB> text text
NB> multiline text
NB> <html tags here... />
NB> " )

NB> but that's a slightly different thing functionally.

NB> Nathan Bubna
NB> nathan@esha.com


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




-- 
Best regards,
 Stan                            mailto:stan@devyatovsky.com


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