Roderick A. Anderson wrote:
Buddy Burden wrote:

Guys,

Okay, we've been using TT2 for HTML templates for a while now with great success. But I just tried to implement an email template and it was a bit trickier, getting all the whitespace bits to work out. But I think I have it all down except for one last bit.


I'll add that I ran into a little strangeness with a TT comment block that was a one off so I just took it out of the template.

It was in a template of a XML document. While testing I commented out a line of XML by putting the open command on the line above and the closing on the line below. Like this:

[%#

   <some:XML here="here">[% var42 %]</some:XML>
%]

The output ( if memory serves me correct ) included:
'</some:XML>
%]'

Since it was a one-off problem I just removed the offending lines. A XML comment didn't serve the purpose at that time so I used this instead.

I how, after reading Buddy's posting, wonder if there is a whitespace-ish issue since there was nothing on the line after the '[%#'. I was going to test further but now have a new job, sans-XML -- so far, so it has gone even more back-burner than before.


Rod


Hi Rod,

I'm not sure I entirely understood your message, however, here goes.

The problem with your comment block there was that you were using a '%]' inside of the comment block which effectively ends it. I use one of two tricks in this case. I'll either change the inner '%]' to '% ]' or I'll use a [% BLOCK %]comment here [% END %] for the comment instead.

Another trick that I have not tried, mostly cause it's a little more tedious is 
to do the following for comment blocks.

[% TAGS <+ +> %]
[<+ comment here that uses [% var42 %] and all should be fine.

+>]
<+ TAGS [% %] +>

It would be nice if TT provided special comment tags to work around this issue.

If you already knew all this, feel free to ignore me. ;)

-- Josh

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

Reply via email to