Permalink
Browse files

Make the cr_counter more readable.

  • Loading branch information...
1 parent d8cf8de commit 78a05e2d143776ad73248197c98d68bb9b4c1114 isaacs committed Jan 3, 2010
Showing with 5 additions and 8 deletions.
  1. +4 −7 lib/utils/ejs.js
  2. +1 −1 www/ejs/test.ejs.html
View
@@ -152,9 +152,10 @@ function ejs_parseStr (src, filename) {
// pop the '<' off the html_buffer, since we don't want to print that
html_buffer.pop();
}
- // push the print statement onto the output buffer
-
- for ( cr_count ++; --cr_count > 0;) out.push(CHR_CR);
+ while (cr_count > 0) {
+ out.push(CHR_CR);
+ cr_count --;
+ }
if (html_buffer.length) {
out.push(';print(', JSON.stringify(html_buffer.join("")), ');');
}
@@ -164,7 +165,6 @@ function ejs_parseStr (src, filename) {
html_buffer.push(c);
}
} else if ( state === STATE_JS && c !== EOF ) {
- // figure out if we want code or print.
if (c === CHR_EQ) {
state = STATE_JS_PRINT_START;
} else {
@@ -174,7 +174,6 @@ function ejs_parseStr (src, filename) {
// that's so that we don't bork on <%%>
i --;
} else if (state === STATE_JS_PRINT_START && c !== EOF) {
- // push the print statement onto the buffer.
out.push("print(");
state = STATE_JS_PRINT;
} else if (str_state === STATE_STR1 && c !== EOF) {
@@ -226,8 +225,6 @@ function ejs_parseStr (src, filename) {
str_state = STATE_NO_STR;
com_state = STATE_NO_COMMENT;
} else if (com_state === STATE_LINECOM) {
- // out.push("\n//",STATE_LINECOM," ",c);
- // process.stdio.writeError(c);
if (
c === CHR_CR
|| c === CHR_PCT && arr[i + 1] === CHR_CLOSE
View
@@ -43,6 +43,6 @@
true
-hello
+goodbye
<h2>let's see if it worked, neh?</h2>

0 comments on commit 78a05e2

Please sign in to comment.