The string interpolation operator isn't ideal. It isn't associative, so you can't paste in a few variables, and then a few more later, and it raises an exception rather than simply putting a message such as "Missing variable: X" in the output HTML.
I fixed this by simply using string replace(), and suitably unique replace tokens.
(Then again, I program in Notepad, preferring it for aesthetic reasons over Emacs, so go figure :-)