summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/whitespace-control.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler/whitespace-control.js')
-rw-r--r--lib/handlebars/compiler/whitespace-control.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/handlebars/compiler/whitespace-control.js b/lib/handlebars/compiler/whitespace-control.js
index 9786612..aabe45a 100644
--- a/lib/handlebars/compiler/whitespace-control.js
+++ b/lib/handlebars/compiler/whitespace-control.js
@@ -1,4 +1,4 @@
-import Visitor from "./visitor";
+import Visitor from './visitor';
function WhitespaceControl() {
}
@@ -38,7 +38,7 @@ WhitespaceControl.prototype.Program = function(program) {
// If we are on a standalone node, save the indent info for partials
if (current.type === 'PartialStatement') {
// Pull out the whitespace from the final line
- current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1];
+ current.indent = (/([ \t]+$)/).exec(body[i - 1].original)[1];
}
}
}
@@ -73,7 +73,7 @@ WhitespaceControl.prototype.BlockStatement = function(block) {
// Walk the inverse chain to find the last inverse that is actually in the chain.
while (lastInverse.chained) {
- lastInverse = lastInverse.body[lastInverse.body.length-1].program;
+ lastInverse = lastInverse.body[lastInverse.body.length - 1].program;
}
}
@@ -108,14 +108,11 @@ WhitespaceControl.prototype.BlockStatement = function(block) {
// Find standalone else statments
if (isPrevWhitespace(program.body)
&& isNextWhitespace(firstInverse.body)) {
-
omitLeft(program.body);
omitRight(firstInverse.body);
}
- } else {
- if (block.closeStrip.open) {
- omitLeft(program.body, null, true);
- }
+ } else if (block.closeStrip.open) {
+ omitLeft(program.body, null, true);
}
return strip;
@@ -125,7 +122,7 @@ WhitespaceControl.prototype.MustacheStatement = function(mustache) {
return mustache.strip;
};
-WhitespaceControl.prototype.PartialStatement =
+WhitespaceControl.prototype.PartialStatement =
WhitespaceControl.prototype.CommentStatement = function(node) {
/* istanbul ignore next */
var strip = node.strip || {};
@@ -144,8 +141,8 @@ function isPrevWhitespace(body, i, isRoot) {
// Nodes that end with newlines are considered whitespace (but are special
// cased for strip operations)
- var prev = body[i-1],
- sibling = body[i-2];
+ var prev = body[i - 1],
+ sibling = body[i - 2];
if (!prev) {
return isRoot;
}
@@ -159,8 +156,8 @@ function isNextWhitespace(body, i, isRoot) {
i = -1;
}
- var next = body[i+1],
- sibling = body[i+2];
+ var next = body[i + 1],
+ sibling = body[i + 2];
if (!next) {
return isRoot;
}