Re: What does "Velocimacro with a Body" mean?

Erik Hatcher <[email protected]> Thu, 8 Aug 2013 06:36:32 -0400
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <[email protected]>
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 <[email protected]>
> A: Velocity Users List <[email protected]>; O. Olson <[email protected]>
> Cc: Nathan Bubna <[email protected]>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>