Subbu Meiyappan wrote:
> For example, I would like to do the following:
> [% ABC = "prefix_[% CDE + 1 %]_suffix" %]
> TT did not allow me to do nested tags. 

Technically speaking, that's not nested tags, but tags embedded in 
double quoted strings.

Nested tags would look more like this:

  [% ABC = [% 'prefix_'; CDE + 1; '_suffix' %] %]

Inside a double-quoted string the [% ... %] tag doesn't have any 
significance.  Instead you use $ and ${...}

So what you want is something like this:

  [% ABC = "prefix_${ CDE + 1 }_suffix" %]

Unfortunately that doesn't work  :-(

TT2 only evaluates simple variables inside ${...} and not expressions
so you'll need to use a temporary variable for now:

  [% n = CDE + 1;
     ABC = "prefix_${n}_suffix"
  %]

TT3 will support both nested tags and expressions embedded inside strings,
but that doesn't help you much now.

Cheers
A


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to