Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Mar 25, 2012
1 parent 64e3436 commit e10a0df
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/ejs.js
Expand Up @@ -118,7 +118,7 @@ var parse = exports.parse = function(str, options){

var lineno = 1;

var slurp = false;
var consumeEOL = false;
for (var i = 0, len = str.length; i < len; ++i) {
if (str.slice(i, open.length + i) == open) {
i += open.length
Expand All @@ -145,9 +145,9 @@ var parse = exports.parse = function(str, options){
, start = i
, n = 0;

if(js[js.length-1]=='-'){
js = js.substring(0,js.length-2);
slurp = true;
if ('-' == js[js.length-1]){
js = js.substring(0, js.length - 2);
consumeEOL = true;
}

while (~(n = js.indexOf("\n", n))) n++, lineno++;
Expand All @@ -162,8 +162,8 @@ var parse = exports.parse = function(str, options){
} else if (str.substr(i, 1) == "\r") {
buf.push(" ");
} else if (str.substr(i, 1) == "\n") {
if(slurp) {
slurp = false;
if (consumeEOL) {
consumeEOL = false;
} else {
buf.push("\\n");
lineno++;
Expand Down

0 comments on commit e10a0df

Please sign in to comment.