Add ability to generate the template with a callback function

Hey there,

Thanks for that plugin! I needed to be able to generate template on the fly with a callback function rather than giving a string or file.

Turned out that it's only three lines of code and fully compliant with existing code so I made the addition. Are you ok to pull?

Cheers,
Xav