Merge pull request #401 from Stuk/template_js_fix

Fix escaped chars in Javascript in templates
This commit is contained in:
Jeremy Ashkenas
2011-12-16 10:09:48 -08:00
2 changed files with 6 additions and 1 deletions

View File

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