You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by JD Evora <jd...@saadian.com> on 2001/11/26 17:01:09 UTC

List of variables present in the template?

Hi,

Does anyone know if the Velocity API has a method for get all the variables
present in a template?

Thanks

 JD Evora


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/27/01 3:53 AM, "Christoph Reck" <Ch...@dlr.de> wrote:

> Dan Bachelder wrote:
>> 
>> it think it would be interesting for debugging occasionally.. although I
>> can't think of an example off the top of my head... another think that could
>> be useful once and a while (maybe) would be the ability to get a hash where
>> the key is the unique $variables and the object is a Collection of values it
>> holds in the template(before or after rendering)... I would use this when I
>> have particularly complex templates and I am trying to debug a specific
>> problem and don't want to dig through the entire bag of schmoo to see if
>> something worked... it would make unit tests of template related stuff a bit
>> neater too maybe...
> 
> I have done this by putting the
> context into the context. See the debug template at:
> 
> http://www.eoweb.de:8888/eoweb/templates/dump.vm
> 
> You can see it in action by calling it directly:
> 
> http://www.eoweb.de:8888/eoweb/servlets/template/dump.vm
> 
> The proper solution I have noted in my TODO list is to
> create a #context directive that puts the current
> (chained-)context into scope for dumping.
> 
> Another desired directive would be a #local(names)...#end
> which saves the names from the current context (if existing)
> and creates the local ones. These get restored after the #end.
> When used within #macros this would make them safer as a
> predefined generic library.

You should already be able to do this in VMs... Theres a switch...

> 
> Now that the user defined directives works, it should be
> *very* easy to create these.
> 

They worked before if you could figure out how to load them :)

No one ever needed to do that, it turns out, so the question was never
asked... :)

geir

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by Christoph Reck <Ch...@dlr.de>.
Dan Bachelder wrote:
> 
> it think it would be interesting for debugging occasionally.. although I
> can't think of an example off the top of my head... another think that could
> be useful once and a while (maybe) would be the ability to get a hash where
> the key is the unique $variables and the object is a Collection of values it
> holds in the template(before or after rendering)... I would use this when I
> have particularly complex templates and I am trying to debug a specific
> problem and don't want to dig through the entire bag of schmoo to see if
> something worked... it would make unit tests of template related stuff a bit
> neater too maybe...

I have done this by putting the
context into the context. See the debug template at:

http://www.eoweb.de:8888/eoweb/templates/dump.vm

You can see it in action by calling it directly:

http://www.eoweb.de:8888/eoweb/servlets/template/dump.vm

The proper solution I have noted in my TODO list is to
create a #context directive that puts the current
(chained-)context into scope for dumping.

Another desired directive would be a #local(names)...#end
which saves the names from the current context (if existing) 
and creates the local ones. These get restored after the #end. 
When used within #macros this would make them safer as a 
predefined generic library.

Now that the user defined directives works, it should be
*very* easy to create these.

:) Christoph

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: List of variables present in the template?

Posted by Ewan Makepeace <ew...@yahoo.com>.
Geir,

IMHO this is a very important subject. To me the number 1 reason to move
from JSP to Velocity is simplicity of syntax (my web designer can figure it
out) and better separation of model and view, leading to better
maintainability.
However one often overlooked feature of JSP is that when it gets compiled
you get the full rigorous error catching of the java compiler to check that
at least all references exist and and not misspelled. [Even better now in
JBuilder5 which can optionally comile all your JSP's every build, rather
than waiting till test time].
If you have either a misspelled reference in a template or a reference that
is not present in the context there is no error or warning - if the
reference is on the wrong side of a little used #IF #ELSE clause, it might
go undetected for a long time.
So now the maintainability advantage is eroded because a programmer
modifying a class in 6 months time has no easy way to see if changing a
methods name (say) might impact any of the templates that expect the old
name. He CAN do a global search of course but that is frustrating and
tedious.
How about a utility that would scan all available templates and build a
pseudo java class that could be included in the project, with all references
as in the template, so that the compiler would flag any mistakes. As long as
it was well commented so that you could crossreference compilation errors to
the offending template this could be a very powerful idea?
[But then again, I just realised that the template does not generally know
(in advance) the actual object type that will match the object name, so
maybe not?]

rgds
Ewan

-----Original Message-----
From: Donnie Hale [mailto:donnie@haleonline.net]
Sent: Friday, November 30, 2001 12:12 PM
To: Velocity Users List
Subject: RE: List of variables present in the template?


Geir,

So where would the "contract" be defined? And by "in code", do you mean at
merge/evaluation time?

Donnie


-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Thursday, November 29, 2001 6:55 AM
To: velocity-user@jakarta.apache.org
Subject: Re: List of variables present in the template?


On 11/28/01 7:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:

> Geir,
>
>>> I've been thinking about that one for a while - formalize the
> contract...<<
>
> I've thought about this as well. I've wondered about a
>
> #strict("file.vmx")
>
> directive that would go at the top of template files. "file.vmx" would be
> where the contract was specified (XML ???). This would cause a runtime
> check. Haven't thought as much about pre-deployment checking.

I think this is the wrong 'direction'.  I think it should be done in code,
not in template...

>
> FWIW...
>
> Donnie
>
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Wednesday, November 28, 2001 11:02 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: List of variables present in the template?
>
>
> On 11/28/01 9:30 AM, "Bill Burton" <bi...@progress.com> wrote:
>
>> Hello,
>>
>> Something similar that's crossed my mind is to come up with a methodology
>> of documenting what's in the context.  The idea is the developer could
>> attach a short description to each object in the context.  Then the
>> template developer could execute a template to dump out what's available.
>> Maybe this could also include a link to the associated JavaDoc for that
>> object?
>>
>> It would be interesting to have some discussion on a generic context tool
>> that could be used for this purpose.
>
> I've been thinking about that one for a while - formalize the contract...
>
> If you didn¹t see it, I threw a little tool into
> contrib/temporary/templatetool that will dump the reference list for a
> template.  To be used by the developer, not the designer...
>
>>
>> -Bill
>>
>> Dan Bachelder wrote:
>>>
>>> it think it would be interesting for debugging occasionally.. although I
>>> can't think of an example off the top of my head... another think that
> could
>>> be useful once and a while (maybe) would be the ability to get a hash
> where
>>> the key is the unique $variables and the object is a Collection of
values
> it
>>> holds in the template(before or after rendering)... I would use this
when
> I
>>> have particularly complex templates and I am trying to debug a specific
>>> problem and don't want to dig through the entire bag of schmoo to see if
>>> something worked... it would make unit tests of template related stuff a
> bit
>>> neater too maybe...
>>>
>>> ----- Original Message -----
>>> From: "Geir Magnusson Jr." <ge...@optonline.net>
>>> To: <ve...@jakarta.apache.org>
>>> Sent: Monday, November 26, 2001 11:11 AM
>>> Subject: Re: List of variables present in the template?
>>>
>>>> On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> Does anyone know if the Velocity API has a method for get all the
>>> variables
>>>>> present in a template?
>>>>>
>>>>
>>>> No, but at this rate, I am going to write one.  This is the second
> request
>>>> for this in a week.
>>>>
>>>> It will be simple and quick to do...
>>>>
>>>> Why do you want this, if I may ask?
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> "He who throws mud only loses ground." - Fat Albert
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>

--
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: List of variables present in the template?

Posted by Donnie Hale <do...@haleonline.net>.
Geir,

So where would the "contract" be defined? And by "in code", do you mean at
merge/evaluation time?

Donnie


-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Thursday, November 29, 2001 6:55 AM
To: velocity-user@jakarta.apache.org
Subject: Re: List of variables present in the template?


On 11/28/01 7:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:

> Geir,
>
>>> I've been thinking about that one for a while - formalize the
> contract...<<
>
> I've thought about this as well. I've wondered about a
>
> #strict("file.vmx")
>
> directive that would go at the top of template files. "file.vmx" would be
> where the contract was specified (XML ???). This would cause a runtime
> check. Haven't thought as much about pre-deployment checking.

I think this is the wrong 'direction'.  I think it should be done in code,
not in template...

>
> FWIW...
>
> Donnie
>
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Wednesday, November 28, 2001 11:02 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: List of variables present in the template?
>
>
> On 11/28/01 9:30 AM, "Bill Burton" <bi...@progress.com> wrote:
>
>> Hello,
>>
>> Something similar that's crossed my mind is to come up with a methodology
>> of documenting what's in the context.  The idea is the developer could
>> attach a short description to each object in the context.  Then the
>> template developer could execute a template to dump out what's available.
>> Maybe this could also include a link to the associated JavaDoc for that
>> object?
>>
>> It would be interesting to have some discussion on a generic context tool
>> that could be used for this purpose.
>
> I've been thinking about that one for a while - formalize the contract...
>
> If you didn¹t see it, I threw a little tool into
> contrib/temporary/templatetool that will dump the reference list for a
> template.  To be used by the developer, not the designer...
>
>>
>> -Bill
>>
>> Dan Bachelder wrote:
>>>
>>> it think it would be interesting for debugging occasionally.. although I
>>> can't think of an example off the top of my head... another think that
> could
>>> be useful once and a while (maybe) would be the ability to get a hash
> where
>>> the key is the unique $variables and the object is a Collection of
values
> it
>>> holds in the template(before or after rendering)... I would use this
when
> I
>>> have particularly complex templates and I am trying to debug a specific
>>> problem and don't want to dig through the entire bag of schmoo to see if
>>> something worked... it would make unit tests of template related stuff a
> bit
>>> neater too maybe...
>>>
>>> ----- Original Message -----
>>> From: "Geir Magnusson Jr." <ge...@optonline.net>
>>> To: <ve...@jakarta.apache.org>
>>> Sent: Monday, November 26, 2001 11:11 AM
>>> Subject: Re: List of variables present in the template?
>>>
>>>> On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> Does anyone know if the Velocity API has a method for get all the
>>> variables
>>>>> present in a template?
>>>>>
>>>>
>>>> No, but at this rate, I am going to write one.  This is the second
> request
>>>> for this in a week.
>>>>
>>>> It will be simple and quick to do...
>>>>
>>>> Why do you want this, if I may ask?
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> "He who throws mud only loses ground." - Fat Albert
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>

--
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/28/01 7:36 PM, "Donnie Hale" <do...@haleonline.net> wrote:

> Geir,
> 
>>> I've been thinking about that one for a while - formalize the
> contract...<<
> 
> I've thought about this as well. I've wondered about a
> 
> #strict("file.vmx")
> 
> directive that would go at the top of template files. "file.vmx" would be
> where the contract was specified (XML ???). This would cause a runtime
> check. Haven't thought as much about pre-deployment checking.

I think this is the wrong 'direction'.  I think it should be done in code,
not in template...

> 
> FWIW...
> 
> Donnie
> 
> 
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Wednesday, November 28, 2001 11:02 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: List of variables present in the template?
> 
> 
> On 11/28/01 9:30 AM, "Bill Burton" <bi...@progress.com> wrote:
> 
>> Hello,
>> 
>> Something similar that's crossed my mind is to come up with a methodology
>> of documenting what's in the context.  The idea is the developer could
>> attach a short description to each object in the context.  Then the
>> template developer could execute a template to dump out what's available.
>> Maybe this could also include a link to the associated JavaDoc for that
>> object?
>> 
>> It would be interesting to have some discussion on a generic context tool
>> that could be used for this purpose.
> 
> I've been thinking about that one for a while - formalize the contract...
> 
> If you didn¹t see it, I threw a little tool into
> contrib/temporary/templatetool that will dump the reference list for a
> template.  To be used by the developer, not the designer...
> 
>> 
>> -Bill
>> 
>> Dan Bachelder wrote:
>>> 
>>> it think it would be interesting for debugging occasionally.. although I
>>> can't think of an example off the top of my head... another think that
> could
>>> be useful once and a while (maybe) would be the ability to get a hash
> where
>>> the key is the unique $variables and the object is a Collection of values
> it
>>> holds in the template(before or after rendering)... I would use this when
> I
>>> have particularly complex templates and I am trying to debug a specific
>>> problem and don't want to dig through the entire bag of schmoo to see if
>>> something worked... it would make unit tests of template related stuff a
> bit
>>> neater too maybe...
>>> 
>>> ----- Original Message -----
>>> From: "Geir Magnusson Jr." <ge...@optonline.net>
>>> To: <ve...@jakarta.apache.org>
>>> Sent: Monday, November 26, 2001 11:11 AM
>>> Subject: Re: List of variables present in the template?
>>> 
>>>> On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
>>>> 
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> Does anyone know if the Velocity API has a method for get all the
>>> variables
>>>>> present in a template?
>>>>> 
>>>> 
>>>> No, but at this rate, I am going to write one.  This is the second
> request
>>>> for this in a week.
>>>> 
>>>> It will be simple and quick to do...
>>>> 
>>>> Why do you want this, if I may ask?
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>> 
> 
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> "He who throws mud only loses ground." - Fat Albert
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: List of variables present in the template?

Posted by Donnie Hale <do...@haleonline.net>.
Geir,

>>I've been thinking about that one for a while - formalize the
contract...<<

I've thought about this as well. I've wondered about a

#strict("file.vmx")

directive that would go at the top of template files. "file.vmx" would be
where the contract was specified (XML ???). This would cause a runtime
check. Haven't thought as much about pre-deployment checking.

FWIW...

Donnie


-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Wednesday, November 28, 2001 11:02 AM
To: velocity-user@jakarta.apache.org
Subject: Re: List of variables present in the template?


On 11/28/01 9:30 AM, "Bill Burton" <bi...@progress.com> wrote:

> Hello,
>
> Something similar that's crossed my mind is to come up with a methodology
> of documenting what's in the context.  The idea is the developer could
> attach a short description to each object in the context.  Then the
> template developer could execute a template to dump out what's available.
> Maybe this could also include a link to the associated JavaDoc for that
> object?
>
> It would be interesting to have some discussion on a generic context tool
> that could be used for this purpose.

I've been thinking about that one for a while - formalize the contract...

If you didn¹t see it, I threw a little tool into
contrib/temporary/templatetool that will dump the reference list for a
template.  To be used by the developer, not the designer...

>
> -Bill
>
> Dan Bachelder wrote:
>>
>> it think it would be interesting for debugging occasionally.. although I
>> can't think of an example off the top of my head... another think that
could
>> be useful once and a while (maybe) would be the ability to get a hash
where
>> the key is the unique $variables and the object is a Collection of values
it
>> holds in the template(before or after rendering)... I would use this when
I
>> have particularly complex templates and I am trying to debug a specific
>> problem and don't want to dig through the entire bag of schmoo to see if
>> something worked... it would make unit tests of template related stuff a
bit
>> neater too maybe...
>>
>> ----- Original Message -----
>> From: "Geir Magnusson Jr." <ge...@optonline.net>
>> To: <ve...@jakarta.apache.org>
>> Sent: Monday, November 26, 2001 11:11 AM
>> Subject: Re: List of variables present in the template?
>>
>>> On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> Does anyone know if the Velocity API has a method for get all the
>> variables
>>>> present in a template?
>>>>
>>>
>>> No, but at this rate, I am going to write one.  This is the second
request
>>> for this in a week.
>>>
>>> It will be simple and quick to do...
>>>
>>> Why do you want this, if I may ask?
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>

--
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/28/01 9:30 AM, "Bill Burton" <bi...@progress.com> wrote:

> Hello,
> 
> Something similar that's crossed my mind is to come up with a methodology
> of documenting what's in the context.  The idea is the developer could
> attach a short description to each object in the context.  Then the
> template developer could execute a template to dump out what's available.
> Maybe this could also include a link to the associated JavaDoc for that
> object?
> 
> It would be interesting to have some discussion on a generic context tool
> that could be used for this purpose.

I've been thinking about that one for a while - formalize the contract...

If you didn¹t see it, I threw a little tool into
contrib/temporary/templatetool that will dump the reference list for a
template.  To be used by the developer, not the designer...

> 
> -Bill
> 
> Dan Bachelder wrote:
>> 
>> it think it would be interesting for debugging occasionally.. although I
>> can't think of an example off the top of my head... another think that could
>> be useful once and a while (maybe) would be the ability to get a hash where
>> the key is the unique $variables and the object is a Collection of values it
>> holds in the template(before or after rendering)... I would use this when I
>> have particularly complex templates and I am trying to debug a specific
>> problem and don't want to dig through the entire bag of schmoo to see if
>> something worked... it would make unit tests of template related stuff a bit
>> neater too maybe...
>> 
>> ----- Original Message -----
>> From: "Geir Magnusson Jr." <ge...@optonline.net>
>> To: <ve...@jakarta.apache.org>
>> Sent: Monday, November 26, 2001 11:11 AM
>> Subject: Re: List of variables present in the template?
>> 
>>> On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
>>> 
>>>> 
>>>> Hi,
>>>> 
>>>> Does anyone know if the Velocity API has a method for get all the
>> variables
>>>> present in a template?
>>>> 
>>> 
>>> No, but at this rate, I am going to write one.  This is the second request
>>> for this in a week.
>>> 
>>> It will be simple and quick to do...
>>> 
>>> Why do you want this, if I may ask?
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by Bill Burton <bi...@progress.com>.
Hello,

Something similar that's crossed my mind is to come up with a methodology
of documenting what's in the context.  The idea is the developer could
attach a short description to each object in the context.  Then the
template developer could execute a template to dump out what's available. 
Maybe this could also include a link to the associated JavaDoc for that
object?

It would be interesting to have some discussion on a generic context tool
that could be used for this purpose.

-Bill

Dan Bachelder wrote:
> 
> it think it would be interesting for debugging occasionally.. although I
> can't think of an example off the top of my head... another think that could
> be useful once and a while (maybe) would be the ability to get a hash where
> the key is the unique $variables and the object is a Collection of values it
> holds in the template(before or after rendering)... I would use this when I
> have particularly complex templates and I am trying to debug a specific
> problem and don't want to dig through the entire bag of schmoo to see if
> something worked... it would make unit tests of template related stuff a bit
> neater too maybe...
> 
> ----- Original Message -----
> From: "Geir Magnusson Jr." <ge...@optonline.net>
> To: <ve...@jakarta.apache.org>
> Sent: Monday, November 26, 2001 11:11 AM
> Subject: Re: List of variables present in the template?
> 
> > On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
> >
> > >
> > > Hi,
> > >
> > > Does anyone know if the Velocity API has a method for get all the
> variables
> > > present in a template?
> > >
> >
> > No, but at this rate, I am going to write one.  This is the second request
> > for this in a week.
> >
> > It will be simple and quick to do...
> >
> > Why do you want this, if I may ask?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by Dan Bachelder <ch...@chowda.net>.
it think it would be interesting for debugging occasionally.. although I
can't think of an example off the top of my head... another think that could
be useful once and a while (maybe) would be the ability to get a hash where
the key is the unique $variables and the object is a Collection of values it
holds in the template(before or after rendering)... I would use this when I
have particularly complex templates and I am trying to debug a specific
problem and don't want to dig through the entire bag of schmoo to see if
something worked... it would make unit tests of template related stuff a bit
neater too maybe...




----- Original Message -----
From: "Geir Magnusson Jr." <ge...@optonline.net>
To: <ve...@jakarta.apache.org>
Sent: Monday, November 26, 2001 11:11 AM
Subject: Re: List of variables present in the template?


> On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:
>
> >
> > Hi,
> >
> > Does anyone know if the Velocity API has a method for get all the
variables
> > present in a template?
> >
>
> No, but at this rate, I am going to write one.  This is the second request
> for this in a week.
>
> It will be simple and quick to do...
>
> Why do you want this, if I may ask?
>
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> "They that can give up essential liberty to obtain a little temporary
safety
> deserve neither liberty nor safety." - Benjamin Franklin
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/5/01 12:29 AM, "Alan Chen" <al...@cisco.com> wrote:

> Hi,
> 
> The TemplateTool is a nice tool I can use in my development
> but I can't find it under contrib/temporary directory.

You can find it in either the CVS, or the nightly builds under

  <velocity directory>/contrib/temporary/templatetool

Note that it won't be in the 1.2-rcX distribution

Nightly build or CVS only.

Geir


> 
> Please help!
> 
> -Alan
> 
> "Geir Magnusson Jr." wrote:
>> 
>> On 11/27/01 5:35 AM, "JD Evora" <jd...@saadian.com> wrote:
>> 
>>> 
>>>> 
>>>> No, but at this rate, I am going to write one.  This is the second request
>>>> for this in a week.
>>>> 
>>>> It will be simple and quick to do...
>>>> 
>>>> Why do you want this, if I may ask?
>>>> 
>>> 
>>> I am generating messages merging Velocity templates that the user creates
>>> on the fly with CSV files.
>>> 
>>> I would like to generate a report that includes only the fields that were
>>> used in the template.
>>> 
>>> After looking without success for something like Template.getVariables(), I
>>> just parsed the template by myself.
>>> 
>> 
>> Ok done.
>> 
>> It's a simple little tool, found in contrib/temporary/TemplateTool (this
>> doesn't belong in the core, in my opinion...) and you can use it to get a
>> list of all the references in a template (and also counts of each
>> reference).
>> 
>> There is a little main() method that demonstrates how to use it, so I won't
>> do it here.
>> 
>> --
>> Geir Magnusson Jr.                                     geirm@optonline.net
>> System and Software Consulting
>> Be a giant.  Take giant steps.  Do giant things...
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by Alan Chen <al...@cisco.com>.
Hi,

The TemplateTool is a nice tool I can use in my development 
but I can't find it under contrib/temporary directory. 

Please help!

-Alan

"Geir Magnusson Jr." wrote:
> 
> On 11/27/01 5:35 AM, "JD Evora" <jd...@saadian.com> wrote:
> 
> >
> >>
> >> No, but at this rate, I am going to write one.  This is the second request
> >> for this in a week.
> >>
> >> It will be simple and quick to do...
> >>
> >> Why do you want this, if I may ask?
> >>
> >
> > I am generating messages merging Velocity templates that the user creates
> > on the fly with CSV files.
> >
> > I would like to generate a report that includes only the fields that were
> > used in the template.
> >
> > After looking without success for something like Template.getVariables(), I
> > just parsed the template by myself.
> >
> 
> Ok done.
> 
> It's a simple little tool, found in contrib/temporary/TemplateTool (this
> doesn't belong in the core, in my opinion...) and you can use it to get a
> list of all the references in a template (and also counts of each
> reference).
> 
> There is a little main() method that demonstrates how to use it, so I won't
> do it here.
> 
> --
> Geir Magnusson Jr.                                     geirm@optonline.net
> System and Software Consulting
> Be a giant.  Take giant steps.  Do giant things...
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/27/01 5:35 AM, "JD Evora" <jd...@saadian.com> wrote:

> 
>> 
>> No, but at this rate, I am going to write one.  This is the second request
>> for this in a week.
>> 
>> It will be simple and quick to do...
>> 
>> Why do you want this, if I may ask?
>> 
> 
> I am generating messages merging Velocity templates that the user creates
> on the fly with CSV files.
> 
> I would like to generate a report that includes only the fields that were
> used in the template.
> 
> After looking without success for something like Template.getVariables(), I
> just parsed the template by myself.
> 

Ok done.

It's a simple little tool, found in contrib/temporary/TemplateTool (this
doesn't belong in the core, in my opinion...) and you can use it to get a
list of all the references in a template (and also counts of each
reference).

There is a little main() method that demonstrates how to use it, so I won't
do it here.


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: List of variables present in the template?

Posted by JD Evora <jd...@saadian.com>.
>
> No, but at this rate, I am going to write one.  This is the second request
> for this in a week.
>
> It will be simple and quick to do...
>
> Why do you want this, if I may ask?
>

 I am generating messages merging Velocity templates that the user creates
on the fly with CSV files.

 I would like to generate a report that includes only the fields that were
used in the template.

 After looking without success for something like Template.getVariables(), I
just parsed the template by myself.

 Cheers
  JD Evora


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: List of variables present in the template?

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/26/01 11:01 AM, "JD Evora" <jd...@saadian.com> wrote:

> 
> Hi,
> 
> Does anyone know if the Velocity API has a method for get all the variables
> present in a template?
> 

No, but at this rate, I am going to write one.  This is the second request
for this in a week.

It will be simple and quick to do...

Why do you want this, if I may ask?

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>