remove tabs and spaces from the end of lines in templates