I think a better template language approach would be kind of like active-*-pages/php kind of things, where there is full-blown logic (IF's and loops) can be executed, EXCEPT, it would have only a "compile" stage (compile to HTML) instead of being "dynamic".
You have program-like features such as your incrementor thingies, which is kind of a half-ess loop. One might as well go all the way have a Turing-Complete (or Turing-friendly) language.
However, that indeed may be harder to implement.