Move parser logic to Template

Parser logic is now part of the template hierarchy rather than directly
embedded in Parser. This allows different templates to have different
parsing logic