Added support for functions as templates

This adds support for passing in a function as a template so you can use other a simple function of your own with no template engine, or a precompiled template (such as you get when using Jade).