On Aug 22, 2008, at 4:26 PM, Josh Rosenbaum wrote:

> Sean Allen wrote:
>> I want to do two passes over our templates to add processing first  
>> for  language specific changes, then for insertion of variables.
>> As this is being put on top of our current system, it would be  
>> ideal  if after the creation of a template object, i  could change
>> the TAG_STYLE or start and end tags, i only see where this can be  
>> done  via new ( too early for my idea ) or via [% TAGS %]
>> in the template itself which is too late for what I want to do.
>> is there a way either when process is called or after new but  
>> before  process to change the tag_style?
>
> After the first time processing it, you get the result string.  
> Perhaps you could just prepend that string with [% TAGS xyz %] and  
> process again?
>
> Double processing seems kind of crazy to me, though. Perhaps you  
> should be looking at how to do this in a single step?

Well the issue is template is something like

[* WELCOME *]

which becomes something like ( for english )

Welcome [% first_name %]

because the ordering of words in the phrase might change by language,
so first pass inserts language phrase which then gets proceeded with  
actual variables.

i'm open to other ideas.

i like the prepending the tags, that works for me.

the other option i thought of it to make

[* WELCOME *] smarter,
where it pulls in its phrase and processes it again BUT, that is way  
beyond my understanding of TT internals
and w/o that knowledge, more work than I have time for. 

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to