Code templates and surround with

Initial work for #137
This is now working as described in #137.
Tests exist and I updated the js.scripted-templates
file.

Still need to update the other template files.