Skip to content
Browse files

Fixed handling of newline in templates.

  • Loading branch information...
1 parent 9149f1d commit f98d76f9726ecbe8eb937a4ab2ddf2f1e39bf777 @tuxychandru committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 grasshopper/lib/ghp.js
View
6 grasshopper/lib/ghp.js
@@ -109,7 +109,11 @@ function getWriteCode(text) {
var lines = text.split('\\n');
lines.forEach(function(line, index) {
if(line.length > 0) {
- code += "out.write('" + line + "\\n');\n";
+ if(index < lines.length - 1) {
+ code += "out.write('" + line + "\\n');\n";
+ } else {
+ code += "out.write('" + line + "');";
+ }
} else if(index < lines.length - 1) {
code += "\nout.write('\\n');";
}

0 comments on commit f98d76f

Please sign in to comment.
Something went wrong with that request. Please try again.