diff options
Diffstat (limited to 'lib/handlebars/compiler/helpers.js')
-rw-r--r-- | lib/handlebars/compiler/helpers.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js index 2685f45..023566b 100644 --- a/lib/handlebars/compiler/helpers.js +++ b/lib/handlebars/compiler/helpers.js @@ -144,7 +144,7 @@ export function prepareProgram(body, isRoot) { if (omitLeft(body, i)) { // If we are on a standalone node, save the indent info for partials - if (current.type === 'partial') { + if (current.type === 'PartialStatement') { // Pull out the whitespace from the final line current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1]; } @@ -180,7 +180,7 @@ function isPrevWhitespace(body, i, isRoot) { return isRoot; } - if (prev.type === 'content') { + if (prev.type === 'ContentStatement') { return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original); } } @@ -195,7 +195,7 @@ function isNextWhitespace(body, i, isRoot) { return isRoot; } - if (next.type === 'content') { + if (next.type === 'ContentStatement') { return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original); } } @@ -209,13 +209,13 @@ function isNextWhitespace(body, i, isRoot) { // content is met. function omitRight(body, i, multiple) { var current = body[i == null ? 0 : i + 1]; - if (!current || current.type !== 'content' || (!multiple && current.rightStripped)) { + if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) { return; } - var original = current.string; - current.string = current.string.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); - current.rightStripped = current.string !== original; + var original = current.value; + current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), ''); + current.rightStripped = current.value !== original; } // Marks the node to the left of the position as omitted. @@ -227,13 +227,13 @@ function omitRight(body, i, multiple) { // content is met. function omitLeft(body, i, multiple) { var current = body[i == null ? body.length - 1 : i - 1]; - if (!current || current.type !== 'content' || (!multiple && current.leftStripped)) { + if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) { return; } // We omit the last node if it's whitespace only and not preceeded by a non-content node. - var original = current.string; - current.string = current.string.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); - current.leftStripped = current.string !== original; + var original = current.value; + current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), ''); + current.leftStripped = current.value !== original; return current.leftStripped; } |