Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 7, 2012
1 parent d976049 commit 68e54ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/lexer.js
Expand Up @@ -504,6 +504,12 @@ Lexer.prototype = {
return states[states.length - 1];
}

function interpolate(attr) {
return attr.replace(/#\{([^}]+)\}/g, function(_, expr){
return quote + " + (" + expr + ") + " + quote;
});
}

this.consume(index + 1);
tok.attrs = {};
tok.escaped = {};
Expand Down Expand Up @@ -531,7 +537,7 @@ Lexer.prototype = {
tok.escaped[key] = escapedAttr;
tok.attrs[key] = '' == val
? true
: utils.interpolate(val);
: interpolate(val);
key = val = '';
}
break;
Expand Down
2 changes: 1 addition & 1 deletion test/cases/attrs.interpolation.html
@@ -1 +1 @@
<a href="/user/5" title="foo #{id}"></a>
<a href="/user/5"></a>
2 changes: 1 addition & 1 deletion test/cases/attrs.interpolation.jade
@@ -1,2 +1,2 @@
- var id = 5
a(href='/user/#{id}', title="foo \#{id}")
a(href='/user/#{id}')

0 comments on commit 68e54ac

Please sign in to comment.