One trick I use when confronted with context objects that aren't behaving as I'd expect is to output:
$object.class and then it's clear what object type you're dealing with. Erik On Aug 7, 2013, at 18:10 , O. Olson wrote: > > > Thank you very much Sergiu and Alex. > > I was just > about to post to Sergiu that I could not get his suggestion to work, when I > saw the post from Alex. > > Thank you Alex. You are totally > correct here – your suggestion worked perfectly and solved my problem. > > Thanks again to both of you, > O. O. > > > > > > ----- Messaggio originale ----- > Da: Alex Fedotov <a...@kayak.com> > A: Velocity Users List <user@velocity.apache.org>; O. Olson > <olson_...@yahoo.it> > Cc: Nathan Bubna <nbu...@gmail.com> > Inviato: Mercoledì 7 Agosto 2013 16:25 > Oggetto: Re: What does "Velocimacro with a Body" mean? > > It does not work because bodyContent is an instance of the ASTNode class > and not a string, so it does not have the trim method. > > Use something like this: > > #macro(my_trim)#set($str="$bodyContent")$str.trim()#end > > Test: > > before#@my_trim() -blah- #{end}after > > Renders: > before-blah-after > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org