Working tests for directory templating
Fix a few bugs inside of template parsing, and document things a bit