Support strings > 64kb in templates

Fixes #1755
Merge pull request #1755 from jroper/1755-template-64k-strings

Split large strings in templates
Merge remote-tracking branch: upstream/master