Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

now can also use #{} interpolation to insert complicated expressions …

…in a HTML-style attribute:

like to this:
input(name='name' class='widget_#{id}' value='text_#{value}")
  • Loading branch information...
commit 8208868a0994cda0d47b52130589b6ee0dd2610c 1 parent 2fd4f11
@arden authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/compiler.js
View
7 lib/compiler.js
@@ -268,10 +268,13 @@ Compiler.prototype = {
classes = [];
if (this.terse) buf.push('terse: true');
attrs.forEach(function(attr){
+ var attrVal = utils.text(attr.val);
+ attrVal = '\'' + attrVal.replace(/\\'/g, "") + '\'';
+ //attrVal = '\'test\' + escape(title) + \'\'';
if (attr.name == 'class') {
- classes.push('(' + attr.val + ')');
+ classes.push('(' + attrVal + ')');
} else {
- var pair = "'" + attr.name + "':(" + attr.val + ')';
+ var pair = "'" + attr.name + "':(" + attrVal + ')';
buf.push(pair);
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.