Dude.... I get laughed at for the things I do with templates (html page with 20k input elements) until people realize what I am doing with them (a bulk payment interface for paying 5000 invoices in a compact workflow).
I have found that any complete templating system has sufficient flexibility and extensibility to do what you want. Though I use Perl's Template Toolkit.
It's a drag when what you're working on is such a unique snowflake that nothing really smart teams have worked on for years is able to help you.
I'm going to abuse a Bruce Schneier quote and suggest that if you're trying to get a job done and you start by writing a template interpreter, you're doing it wrong.