Start adding support for multiline templates.

Also adds support for no end-marker and automatic end-marker fill-in.