Hi devs,
I need to have some Velocity macros in the file system because one use
case where I need them is when the database is empty. So I put them in
a new Velocity template file under /templates folder. I didn't want to
add them to macros.vm because they are very specific and not used very
often. Plus, I don't like the idea of putting all the macros in one
single file.
I then tried to include these macros in my other template and some
wiki page using #template. It didn't work. Surprisingly, when I
attached the template with the macros to the skin it worked.
By looking at the code I noticed that #template calls
XWiki#evaluateTemplate which (if I understood correctly) registers the
Velocity macros under
* '' (global) namespace if the template is part of a skin
* template name namespace if the template is not part of the skin.
Both seem wrong:
* in the first case, once you include the template the Velocity macros
become available globally