mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Templating fix for when an escaped character is used in Javascript
If an escaped character (e.g. \n) is used in embedded Javascript inside a template then it gets escaped to \\n. If someone has put an escaped character in their JS then they probably want it left that way. This commit replaces \\s with a single \ when inside evaluation tags, reverting the previous template escaping.
This commit is contained in:
@@ -909,7 +909,8 @@
|
|||||||
})
|
})
|
||||||
.replace(c.evaluate || null, function(match, code) {
|
.replace(c.evaluate || null, function(match, code) {
|
||||||
return "');" + code.replace(/\\'/g, "'")
|
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(/\r/g, '\\r')
|
||||||
.replace(/\n/g, '\\n')
|
.replace(/\n/g, '\\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user