improves "smart trim" for flow control lines.
tidies up some filter code. Bumps version to 2.5.1
adds tests for template files with nonstandard extensions.