Nathan Bubna schrieb:
On Mon, May 12, 2008 at 1:10 PM, Simon Gubler <[EMAIL PROTECTED]> wrote:
Hi Ahmed
I have to say, that I don't use the velocity API, I basically scan the files
for #foreach, #end and ${.*} or $!{.*} Expressions and list them in the
outputfile. When I have time (probably next month) I will look into the
velocity API. If I can use it I won't have to implement the grammar myself.
When you do that, referencing the following might help:
http://svn.apache.org/repos/asf/velocity/engine/trunk/experimental/templatetool/
it's an old experiment. i've no idea if it still works, but it had a
similar goal.
Greetings
Simon
On Mon, May 12, 2008 at 5:32 PM, Ahmed Mohombe <[EMAIL PROTECTED]> wrote:
> I think it has to know this because if you have for example #foreach($day
> > in
> > ${days}) you don't want to include the variable ${day} in the list but
> > rather ${days}.
> > Do you agree with me?
> >
> Of course.
> I just thought that the Velocity AST is able to distinct between "local
> variabls" like
> $day and "global" ones.
>
>
> Ahmed.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi everyone
As I said earlier, I've worked on the tool and rebuilt it. Now it works
with the velocity API that Nathan Bubna has given me. Instead of putting
all the refernces in a list I build a tree structure where the
references are leaves and the #foreach-loops are nodes.
TemplateAnalyzer_TreeGui.jar shows this structure in a Swing-GUI as a
JTree.
Execute it like this: java -jar TemplateAnalyzer_TreeGui.jar foo.vm
foo.vm is the name of the template.
You can download the new version 1.1 here:
http://sourceforge.net/project/showfiles.php?group_id=226718.
I hope you can use it to get an overview of your templates.
Kind regards
Simon
PS: @Ahmed: To scan for the used references for the user written
templates I would recommend you to use the TemplateTool from Nathan
Bubna: Just get your template, call TemplateTool.referenceList() with
the template as parameter, and look at each entry in the returned list
if it contains a forbidden reference.