Allow moduleName to be a function

If you store your templates in a hierarchy which matches module names,
you can now automatically generate templates in the right module.

Added tests and updated documentation
Merge pull request #7 from fidian/master

Allow moduleName to be a function