velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "THOMAS, BRIAN M \(SBCSI\)" <bt0...@att.com>
Subject RE: #include()ed doc not loading
Date Tue, 25 Apr 2006 20:46:59 GMT
Will:

Thanks for the link.  It appears to be very relevant.

To summarize your explanation:  macros are stored in a global context by
default, for caching-performance advantage.  This is because templates
are cached, and want to remain as static as possible so as to improve
cache hits.  Correct?

It also means that name collisions on macros are possible, and my knee
jerks as my security hat comes on and the warning cry of "Mutable global
data!" echos in my ears...

But before I dispatch a crew to secure the perimeter, would you say that
Ludovic's suggestion that I put the macro definition in XWiki's global
macros.vm file would actually solve the problem, assuming that it was
designated as a global macro source?

Further, if I chose to turn on the option to allow local contexts, which
my security instincts tell me to, then all my documents that include
files which define macros and subsequently invoke them will fail?

There is a little bit of a caveat here, though:  the XWiki macro that I
use (#includeMacros) doesn't call #parse but an XWiki object method that
I can't yet trace from my examination of only the source; it simply
calls its own (configurable) rendering engine which calls other engines
and plugins in addition to Velocity.  But there is also an XWiki method
called parseContent, and another called parseTemplate, which are not
called, so this may be irrelevant, as the XWiki team may have worked
around this already.

brain[sic] 

-----Original Message-----
From: wglasshusain@gmail.com [mailto:wglasshusain@gmail.com] On Behalf
Of Will Glass-Husain
Sent: Tuesday, April 25, 2006 11:46 AM
To: Velocity Users List
Subject: Re: #include()ed doc not loading


Hi Brian,

This is a known issue.  Macros can't be written in one file and included
with a #parse statement.  See this for a summary.
http://wiki.apache.org/jakarta-velocity/MacroIssues

WILL

On 4/25/06, THOMAS, BRIAN M (SBCSI) <bt0008@att.com> wrote:
> I'm a little fuddled about a macro definition file.  The Velocity 
> engine is running in a Tomcat server (XWiki, actually) and I have a 
> Velocity macro defined in a wiki document which is included in another

> wiki document which also calls it.
>
> The problem is that after the wiki restarts, the macro definition file

> is not loaded - or at least, the macro definition is not placed into 
> the context - as evidenced by Velocity rendering the call instead of 
> its execution.  Its argument is expanded, so that it's plain that it 
> is being rendered.  What usually fixes it is when one of us opens the 
> file explicitly, or saves it.
>
> I'm not at all certain that this is a Velocity problem, but I'd like 
> to know if there's a way to learn whether an #include directive has 
> failed, other than to note that the macro is undefined...?
>
> brain[sic]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


--
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message