Skip to content

Commit

Permalink
Fixed single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jul 15, 2010
1 parent 7de165a commit f0b6f7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ var parse = exports.parse = function(str){
.replace(/\n/g, "\\n")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.split("'").join("\\'")
.replace(/\t=(.*?)%>/g, "', escape($1) ,'")
.replace(/\t-(.*?)%>/g, "', $1 ,'")
.split("\t").join("');")
Expand Down
7 changes: 7 additions & 0 deletions test/ejs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@ module.exports = {
str = '<% if (name) { %>\n<p><%= name %></p>\n<p><%= email %></p><% } %>',
locals = { name: 'tj', email: 'tj@sencha.com' };
assert.equal(html, ejs.render(str, { locals: locals }));
},

'test single quotes': function(assert){
var html = '<p>WAHOO</p>',
str = '<p><%= up(\'wahoo\') %></p>',
locals = { up: function(str){ return str.toUpperCase(); }};
assert.equal(html, ejs.render(str, { locals: locals, debug: true }));
}
};

0 comments on commit f0b6f7f

Please sign in to comment.