Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ private String render(Node root, boolean processExtendRoots, long renderLimit) {
);
}
}
if (context.getDeferredTokens().size() > numDeferredTokensBefore) {
if (
preserveBlocks || context.getDeferredTokens().size() > numDeferredTokensBefore
) {
pathSetter.setValue(
EagerReconstructionUtils.buildBlockOrInlineSetTag(
RelativePathResolver.CURRENT_PATH_CONTEXT_KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ public void itReconstructsDeferredOutsideBlockSecondPass() {
);
}

@Test
public void itDefersSetInBaseBeforeBlock() {
expectedTemplateInterpreter.assertExpectedOutputNonIdempotent(
"defers-set-in-base-before-block"
);
}

@Test
public void itDefersSetInBaseBeforeBlockSecondPass() {
context.put("deferred", "Resolved now");
expectedTemplateInterpreter.assertExpectedOutput(
"defers-set-in-base-before-block.expected"
);
}

@Test
public void itThrowsWhenDeferredExtendsTag() {
interpreter.render(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% set foo = deferred %}
{{ foo }}
{% block body %}
{% endblock body %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

Resolved now

Hi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% set current_path = '../eager/extendstag/base-with-deferred-before-block.html' %}\
{% set foo = deferred %}
{{ foo }}
{% block body %}
Hi
{% endblock body %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% extends "../eager/extendstag/base-with-deferred-before-block.html" %}
{% block body %}
Hi
{% endblock body %}
Loading