-
Notifications
You must be signed in to change notification settings - Fork 170
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
Template Render to keep unresolved variables as-is in the output #1046
Comments
Looks like this feature doesn't exists and I'm Interested as well on using it. |
For simple cases, this can already be done with: context.setDynamicVariableResolver(string -> "{{ " + string + " }}"); |
Great @jasmith-hs, thank you. It does for now what I need. Checked, but it doesn't work when the token has filters to apply. |
Rather than complex solution, as a workaround I created a wrapper on JinjavaInterpreter and just override getAsString() method to not set empty string rather keep the context.currentNode.master.image as-is. This solution can be in original JinjavaInterpreter as a default behavior. |
I am interested in rendering a template in multiple steps or keeping the references for the undefined variables in Jinja2.
Basically not to set value as null for undefined/unresolved variables and keep references/variable as-is if they are missing in the context.
Example: Let's say context has only
name = "test"
, and then redering the following template:<p>{{name}} has {{quantity}}</p>
I expact the output as below:
<p>test has {{quantity}}</p>
but as of today, output looks like below:
<p>test has </p>
Does anyone know if this is achievable within current version, or it would need an additional configuration to be added ?
The text was updated successfully, but these errors were encountered: