Fixes #369 -- adding extra semicolons to templtes in case you forget.

This commit is contained in:
Jeremy Ashkenas
2011-11-14 14:04:13 -05:00
parent ba96d168ec
commit 0acab3dcd3
2 changed files with 4 additions and 1 deletions

View File

@@ -51,6 +51,9 @@ $(document).ready(function() {
var result = basicTemplate({thing : 'This'});
equals(result, "This is gettin' on my noives!", 'can do basic attribute interpolation');
var sansSemicolonTemplate = _.template("A <% this %> B");
equals(sansSemicolonTemplate(), "A B");
var backslashTemplate = _.template("<%= thing %> is \\ridanculous");
equals(backslashTemplate({thing: 'This'}), "This is \\ridanculous");

View File

@@ -893,7 +893,7 @@
})
.replace(c.evaluate || null, function(match, code) {
return "');" + code.replace(/\\'/g, "'")
.replace(/[\r\n\t]/g, ' ') + "__p.push('";
.replace(/[\r\n\t]/g, ' ') + ";__p.push('";
})
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')