-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #363 from HubSpot/fix-relative-path-blocks
Avoid tag cycles when keeping track of parent paths for blocks
- Loading branch information
Showing
9 changed files
with
78 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/hubspot/jinjava/tree/output/BlockInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.hubspot.jinjava.tree.output; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import com.hubspot.jinjava.tree.Node; | ||
|
||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") | ||
public class BlockInfo { | ||
|
||
private final List<? extends Node> nodes; | ||
|
||
private final Optional<String> parentPath; | ||
|
||
public BlockInfo(List<? extends Node> nodes, Optional<String> parentPath) { | ||
this.nodes = nodes; | ||
this.parentPath = parentPath; | ||
} | ||
|
||
public List<? extends Node> getNodes() { | ||
return nodes; | ||
} | ||
|
||
public Optional<String> getParentPath() { | ||
return parentPath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello |
3 changes: 3 additions & 0 deletions
3
src/test/resources/tags/extendstag/relative-block-2-base.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% block test %} | ||
{% include "./hello.html" %} | ||
{% endblock test %} |
1 change: 1 addition & 0 deletions
1
src/test/resources/tags/extendstag/relative/relative-block-2.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{% extends "./../relative-block-2-base.jinja" %} |
4 changes: 4 additions & 0 deletions
4
src/test/resources/tags/extendstag/relative/relative-block.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% extends "./../super-base.html" %} | ||
{% block sidebar %} | ||
{% include "./../hello.html" %} | ||
{% endblock %} |