You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ted Husted <hu...@apache.org> on 2003/02/03 15:37:10 UTC

Re: I suppose I should RTFM

I think a "snoop" utility for templates would be very helpful, 
especially in developing a technique for unit testing templates when 
used with a "Velocity Tiles" gizmo. For complex templates, you want to 
ensure that everything you expect to be in the context is in the 
context, so you don't have to eyeball the screens for blank fields or 
unexpected $whatever references. In an unit testing situation, you would 
also want to test if the template attributes are returning the expected 
values.

-Ted.

Cort Schaefer wrote:
> Here is the content that was posted back in December:
> 
> 
> On Tuesday, December 17, 2002, at 05:07 AM, Yura Ushakhow wrote:
> 
> 
>>Kind people, need your help. How could I ask velocity if mytpl.vm has
>>reference to $myvar inside , before merging? I need it, to know what 
>>context user wants instead of generating everything, - just the parts 
>>it needs.
> 
> 
> That's usually an inversion of things - the controller usually has a 
> clue...
> 
> In contrib/temporary/templatetool you'll find a little (unsupported) 
> class that will return to you a list of references... see if that 
> helps...
> 
> 
> 
> -----Original Message-----
> From: Marvin Greenberg [mailto:mgreenberg@dctd.saic.com] 
> Sent: Friday, January 31, 2003 1:14 PM
> To: Velocity Users List
> Subject: I suppose I should RTFM
> 
> but, is there a utility to report all the variable references,
> properties,
> and methods used by a template or set of templates?  It ought to be easy
> enough to throw together if there isn't, since the parser for the
> template
> files exists.
> 
> e.g.
> 
> template1.vm:
>    $thing
>    $thing.getName() [also accessed as Name]
>    $thing.setName() [also accessed as Name = ]
>    $thing.doSomething(arg1,arg2)
> 
> template2.vm:
>    $thing.Name
>    $otherThing.isValid()
>    $yaThing
> ...
> 
> If not, I might do it if anyone (besides me) thought it useful.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 


-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


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