Handle whitespace control over templates using Windows end of line marker

Fixes issue #578