Skip to content

Commit

Permalink
fix for not autoescaping includes having a parent
Browse files Browse the repository at this point in the history
  • Loading branch information
tgabi333 committed Jan 21, 2019
1 parent 35cbb35 commit 75f019a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/twig.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,8 @@ module.exports = function (Twig) {
that.parent = ext_template;

return that.parent.renderAsync(that.context, {
blocks: that.blocks
blocks: that.blocks,
isInclude: true
});
}

Expand Down
10 changes: 10 additions & 0 deletions test/test.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,16 @@ describe("Twig.js Core ->", function() {
}).render({ value: "&" }).should.equal('&& & & & &&');
});

it("should not autoescape includes having a parent", function() {
twig({id: 'included3', data: '{% extends "parent2" %}{% block body %}& {{ value }} &{% endblock %}'});
twig({id: 'parent2', data: '&& {% block body %}{% endblock body %} &&'});
twig({
allowInlineIncludes: true,
autoescape: true,
data: '&&& {% include "included3" %} &&&'
}).render({ value: "&" }).should.equal('&&& && & & & && &&&');
});

it("should support autoescape option with alternative strategy", function() {
twig({
autoescape: 'js',
Expand Down

0 comments on commit 75f019a

Please sign in to comment.