diff --git a/src/twig.core.js b/src/twig.core.js index cd4e7ee9..87802f0f 100644 --- a/src/twig.core.js +++ b/src/twig.core.js @@ -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 }); } diff --git a/test/test.core.js b/test/test.core.js index dc7ee400..cdaf9221 100644 --- a/test/test.core.js +++ b/test/test.core.js @@ -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',