Related to T138492: Add support for actual format strings to TemplateData's "format" parameter:
In the TemplateData GUI (opened via "Manage TemplateData" button while editing the template), it's unfortunately easy to accidentally end up with a format that specifies a leading space, which is invalid, and therefore the page can't be saved.
We should automagically strip the leading spaces from that field (and trailing spaces, if that's also a problem).