Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

backslashes get over-escaped in expressions #784

Closed
jcmf opened this Issue · 1 comment

2 participants

@jcmf

Javascript expressions seem to be double-escaped somehow. For example, if I try to make a regular expression literal that matches a literal dot, I end up with something that instead matches a literal backslash followed by any character:

> console.log(src)
.url #{result.u.replace('http://', '').replace(/^www\./, '')}
undefined
> console.log(jade.compile(src, {client: true, compileDebug: false}).toString()) 
function anonymous(locals, attrs, escape, rethrow, merge) {
attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;
var buf = [];
with (locals || {}) {
var interp;
buf.push('<div class="url">' + escape((interp = result.u.replace('http://', '').replace(/^www\\./, '')) == null ? '' : interp) + '</div>');
}
return buf.join("");
}
undefined

I see a bunch of recent backslash-related activity, including #731, not sure whether or how this is related exactly.

@tj
Owner
tj commented

patching this up

@tj tj referenced this issue from a commit
@tj tj add regression test for #784 06c9210
@tj tj closed this issue from a commit
@tj tj fix double-escaping of interpolated js slashes. Closes #784
lame fix since we dont actually tokenize
text nodes
30c173d
@tj tj closed this in 30c173d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.