diff --git a/lib/ejs.js b/lib/ejs.js index ca304a13..0f647fbb 100644 --- a/lib/ejs.js +++ b/lib/ejs.js @@ -1,3 +1,4 @@ + /*! * EJS * Copyright(c) 2012 TJ Holowaychuk @@ -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 '-': @@ -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;