backslashes get over-escaped in expressions #784

jcmf opened this Issue Oct 8, 2012 · 1 comment


None yet
2 participants

jcmf commented Oct 8, 2012

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\./, '')}
> 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("");

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

This comment has been minimized.

Show comment Hide comment

tj Oct 9, 2012


patching this up


tj commented Oct 9, 2012

patching this up

tj added a commit that referenced this issue Oct 9, 2012

@tj tj closed this in 30c173d Oct 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment