velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste BRIAUD -- Novlog <j-b.bri...@novlog.com>
Subject Re: How to list Velocity template variables ?
Date Wed, 22 Dec 2010 08:42:56 GMT

On 22 déc. 2010, at 09:08, Antonio Petrelli wrote:

> 2010/12/20 Jean-Baptiste BRIAUD -- Novlog <j-b.briaud@novlog.com>:
>> Before processing a template, I need to have a list of all variables needed by the
template.
>> I had to proceed to complex validation.
>> ...
>> The reason why I need that : the end user can upload a template.
> 
> Sorry for the late response, but I was thinking about your question
> and it has not a good answer.
> For example, suppose that you use a #set directive, or a tool that
> fills one variable, have you got to remove it from the list of
> variables?
> So, I think that you might create a tool, or a custom directive, to
> say that you "require" a particular special object and put it in your
> template context.
> 
> Antonio
> 
Hi Antonio,

Unfortunately, I can't do that because I can't force a user not to forget one #require.
Also to validate the #require are all there, I'll need to get the list of all variables :-)

I'll try the template AST walker approach.

Thanks !


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


Mime
View raw message