Skip to content
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

Inconsistent implementation with jinja2 #1141

Closed
halfopen opened this issue Dec 26, 2023 · 1 comment
Closed

Inconsistent implementation with jinja2 #1141

halfopen opened this issue Dec 26, 2023 · 1 comment

Comments

@halfopen
Copy link

Template
{% if a %} 1 {% else %} 0 {% endif %}

when a is a float number between 0 and 1, the result will be 0.

jinjava
image
image

jinja2
image

@jasmith-hs
Copy link
Contributor

This has already been fixed with #857. Please ensure you're on Jinjava 2.7.0+

String result = new Jinjava()
  .render("{% if a %}1{% else %}0{% endif %}", ImmutableMap.of("a", 0.3));
assertThat(result).isEqualTo("1");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants