JST filter does not correctly escape backslashes in string literals

If a template contains a backslash (for example, as part of a regexp on <input pattern=""/> or anywhere else) the backslash is not escaped when the template is converted to a JavaScript string literal by the JST filter.

This patch uses json.dumps to produce JavaScript string literals rather than trying to do all the escaping correctly by hand.