template parser with tests