@Gargron I think its all based in golangs text/template. While it is single pass, I think you can use variables to do some of what you might want.

https://golang.org/pkg/text/template/