Removes trailing spaces from templates