Re: Intercepting #set

Paul Wellner Bou <[email protected]> Fri, 6 Nov 2015 13:16:28 +0100
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <CAMDwiY9t72gS1OV_7gB9bZbvv9EFv-6vuN6krPC5PkVMQmmmUw@mail.gmail.com>
Thanks, Nathan,

yes, thats useful, this way I get all variables used, at least.
Unfortunately I don't find a way to intercept something like
#set($var="whatever"). So I assume I will have to parse the vm file
manually searching for #set occurrences?

Kind regards
Paul Wellner Bou

On Thu, Nov 5, 2015 at 8:57 PM, Nathan Bubna <[email protected]> wrote:

> You could configure a NullSetEventHandler to catch when the RHS is null.
> But i'm afraid the #set directive is deeply embedded, without a lot of
> hooks, much like #if.  But perhaps one of the other available EventHandler
> interfaces can help?
>
>
> https://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/app/event/EventHandler.html
>
> http://velocity.apache.org/engine/devel/developer-guide.html#Configuring_Event_Handlers
>
> On Thu, Nov 5, 2015 at 2:27 AM, Paul Wellner Bou <[email protected]>
> wrote:
>
> > Hello,
> >
> > i am trying to write something analyzing our velocity file hell
> > automatically, showing direct (via #parse) or indirect (via declared
> > variables, #set) between vm files.
> >
> > I found a way to intercept the #parse directive (
> > https://gist.github.com/paulwellnerbou/b0e53e7a045e8e90a840). Is this
> > possible with the #set directive as well?
> >
> > Thank you and best regards
> > Paul Wellner Bou
> >
>