Hi,

 I was taking apart the code of Template Toolkit because I tried to figure out 
if TT keeps a record of all parsed tags (params/vars/directives), and 
unfortunately it doesn't seem like it does. I could very easily hack the code 
but in my project my goal is to use TT as-is and try to get out of it what I 
need. So no hacking of the code is an option.

 This is what I found:

 Template/Parser.pm parses the tags (directives) and then it more or less 
builds a block for the directive. The tags however are then localised in 
Service.pm (in process()) and delocalised so the Stash changes, effectively 
losing any reference to any of the processed tags by the time you want to use 
it from the outside. 

 My other problem is that even if it wouldn't delocalise the vars the Stash 
only keeps a record of the passed vars, and not all the tags it was able to 
parse. 

 My question is whether or not TT has an option to know all the tags it was 
able to parse and retrieve those?

 Example:

 [% BOY %] says [% WORD %] to [% GIRL %]

 Let's say I pass in the vars, BOY and WORD to $template->process() but NOT the 
var GIRL. However, I would like to have the ability to do something like:

 @tags = $template->some_method();

 And when I would go through the @tags it would contain ('BOY', 'WORD', 'GIRL').

 Logically it should be called after $template->process() to be able to get all 
tags.

 Any ideas on how to implement this with TT without any hacking?

 Thanks.

 Milan

 

_________________________________________________________________
Introducing Live Search cashback .  It's search that pays you back!
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=introsrchcashback
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to