Local template data should merge onto global template data

Currently, when using templateData and globals, properties from each globals object blindly overwrite the corresponding properties on the templateData object, and if the property is itself an object you will lose any sub-properties of that object.

Surely the desired method is for templateData objects to be gracefully merged into global objects, preserving all properties and sub-properties that have not been re-defined.