#676 Template insertion does not honor the project's

Fixed implementation of newline handling in templates. This is currently causing errors (see sourceforge.net)