Template Render to keep unresolved variables as-is in the output

Open
#1,046 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
backend

Research direction

No files, tests, or entry points are named. Start by locating Jinjava's handling of undefined variables and any configuration or undefined-value tests; done means rendering the provided template preserves {{quantity}} while still substituting name.

Written by the indexing model from the issue text.

Description

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 ?

Dominant language
Java
Stars
785
Forks
184
Avg merge
6d 22h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HubSpot/jinjava

All issues in HubSpot/jinjava

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.