Reputation: 1860
I'm new and struggling with velocity templates. I have few templates in hand with lots of macros in it.
// file b.vm
#macro (bmacro)
from b macro
#end
// file a.vm
#parse("//temp//b.vm")
from a
#bmacro()
My expectation is to get
from a
from b macro
however, I am getting only "from a" as outcome. But when I place any static text outside bmacro, it is getting along.
By the way, I'm using NVelocity from castle project.
Thanks
Upvotes: 1
Views: 1326
Reputation: 4229
The macro doesn't work because NVelocity (and its ancestor Velocity) determine if #bmacro
is a directive or macro at parse time, while the #bmacro
macro gets discovered at runtime as it jumps into the other template, and so it is passed through as text.
I answered this other question with a detailed answer a few months ago that had the same problem: macros not rendering in NVelocity
Upvotes: 1