Add support for resolving relative paths in separate files#316
Merged
Conversation
mattcoley
approved these changes
Mar 26, 2019
| interpreter.render(node); | ||
| } else { | ||
| JinjavaInterpreter child = new JinjavaInterpreter(interpreter); | ||
| child.getContext().put("importResourcePath", templateFile); |
Collaborator
There was a problem hiding this comment.
Since jinjava was directly ported from python we generally use snakecase for context variables.
Contributor
Author
|
Codecov Report
@@ Coverage Diff @@
## master #316 +/- ##
============================================
+ Coverage 71.25% 71.48% +0.22%
- Complexity 1561 1570 +9
============================================
Files 239 239
Lines 4913 4934 +21
Branches 790 793 +3
============================================
+ Hits 3501 3527 +26
+ Misses 1129 1124 -5
Partials 283 283
Continue to review full report at Codecov.
|
mattcoley
reviewed
Mar 26, 2019
mattcoley
left a comment
Collaborator
There was a problem hiding this comment.
The functionality of this looks good to me. Can we have tests to ensure this behavior though so someone does not break this in the future?
Contributor
Author
|
Alright, I changed this around a bit to better support all types of includes, imports, and extends.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is to support resolving relative paths located in a separate file for cases such as HubSpot custom modules.
peek()method toCallStackto allow looking at the top of the include/extend stack in order to determine what file a tag is located in.importResourcePathto the local context of each macro inImportTagso that the macro will know which file it originated from.Let me know if additional information is needed.