Skip to content

Commit

Permalink
Fix custom delimiters in nested partials (janl#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
aielo committed Feb 25, 2020
1 parent aca97b8 commit 6ee85c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mustache.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@
if (tagIndex == 0 && indentation) {
indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);
}
return this.renderTokens(this.parse(indentedValue, tags), context, partials, indentedValue);
return this.renderTokens(this.parse(indentedValue, tags), context, partials, indentedValue, tags);
}
};

Expand Down
15 changes: 15 additions & 0 deletions test/partial-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,19 @@ describe('Partials spec', function () {
var renderResult = Mustache.render(template, data, partials);
assert.equal(renderResult, expected);
});

it('Nested partials should support custom delimiters.', function () {
var tags = ["[[", "]]"];
var template = '[[> level1 ]]';
var partials = {
level1: 'partial 1\n[[> level2]]',
level2: 'partial 2\n[[> level3]]',
level3: 'partial 3\n[[> level4]]',
level4: 'partial 4\n[[> level5]]',
level5: 'partial 5',
};
var expected = 'partial 1\npartial 2\npartial 3\npartial 4\npartial 5';
var renderResult = Mustache.render(template, {}, partials, tags);
assert.equal(renderResult, expected);
});
});

0 comments on commit 6ee85c5

Please sign in to comment.