What does "Velocimacro with a Body" mean?
"O. Olson" <[email protected]> Mon, 5 Aug 2013 17:25:13 +0100 (BST)
| Newsgroups | gmane.comp.jakarta.velocity.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am new to
Velocity and I am wondering what "Velocimacro with a Body" means?
Here, I am referring to the description in http://velocity.apache.org/engine/releases/velocity-1.7/vtl-reference-guide.html#amacro_-_Allows_users_to_define_a_Velocimacro_VM_a_repeated_segment_of_a_VTL_template_as_required
I thought
all Velocimacros had bodies, just like all non-trivial functions in C or Java
have bodies. I attempted the use the above suggestion given in the URL and it did not
work.
I attempted the following in my Global Library:
#macro(query_url $query_param)
q=$query_param
#end
#macro(trim)
$!bodyContent.trim()
#end
According to the above URL, in my template, I called this
using:
#@trim()#query_url("sometext")#end
The result seems to be:
q=sometext
i.e. there are spaces in the front that I don't like.
(Depending on the format you are looking at, these preceeding spaces might be
deleted, but they appear in the rendered results.) Any ideas what I am doing
wrong?
Thank you in advance,
O. O.