A templating helper, extracted from my melting codebase.