Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions lib/ejs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*!
* EJS
* Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca>
Expand Down Expand Up @@ -126,8 +127,10 @@ var parse = exports.parse = function(str, options){
var prefix, postfix, line = (compileDebug ? '__stack.lineno=' : '') + lineno;
switch (str[i]) {
case '=':
prefix = "', escape((" + line + ', ';
postfix = ")), '";
/*prefix = "', escape((" + line + ', ';
postfix = ")), '";*/
prefix = "', (function () {try{return ";
postfix = "}catch(e){return e.message}})(), '";
++i;
break;
case '-':
Expand Down Expand Up @@ -167,19 +170,7 @@ var parse = exports.parse = function(str, options){
}

while (~(n = js.indexOf("\n", n))) n++, lineno++;

switch(js.substr(0, 1)) {
case ':':
js = filtered(js);
break;
case '%':
js = " buf.push('<%" + js.substring(1).replace(/'/g, "\\'") + "%>');";
break;
case '#':
js = "";
break;
}

if (js.substr(0, 1) == ':') js = filtered(js);
if (js) {
if (js.lastIndexOf('//') > js.lastIndexOf('\n')) js += '\n';
buf += prefix;
Expand Down