remove trailing line breaks from template