Myself, I use Template Toolkit . . .
Increasing the complexity of the template isn't a real solution, because at that point you're no longer doing seperation of data and code, which is the whole point.
send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.