-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for resolving relative paths in separate files #316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small nit
@@ -95,6 +95,7 @@ public String interpret(TagNode tagNode, JinjavaInterpreter interpreter) { | |||
interpreter.render(node); | |||
} else { | |||
JinjavaInterpreter child = new JinjavaInterpreter(interpreter); | |||
child.getContext().put("importResourcePath", templateFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since jinjava was directly ported from python we generally use snakecase for context variables.
|
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
Alright, I changed this around a bit to better support all types of includes, imports, and extends.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR is to support resolving relative paths located in a separate file for cases such as HubSpot custom modules.
peek()
method toCallStack
to allow looking at the top of the include/extend stack in order to determine what file a tag is located in.importResourcePath
to the local context of each macro inImportTag
so that the macro will know which file it originated from.Let me know if additional information is needed.