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

(feat): support "is defined" jinja2 syntax #1015

Closed
mgcrea opened this issue Jul 27, 2017 · 1 comment
Closed

(feat): support "is defined" jinja2 syntax #1015

mgcrea opened this issue Jul 27, 2017 · 1 comment

Comments

@mgcrea
Copy link

mgcrea commented Jul 27, 2017

Would be great if you could add support for such syntax:

http://jinja.pocoo.org/docs/2.9/templates/#defined

{% if openvpn_tls_auth is defined %}

That is working in jinja2 (for ansible templates) and fail here even with compat mode enabled.

noahlange added a commit to noahlange/nunjucks that referenced this issue Oct 12, 2017
…lla#1015.

  - adds 21 Jinja2-style boolean tests
  - updates node list, parser and compiler to interpret and properly compile
    `Is` nodes
  - adds tests for tests, parser and compiler changes/additions
    - no changes to existing tests
  - adds `addTest`/`getTest` methods to the environment
  - CAVEAT: changes lexer to interpret "null" as `null` instead of a lookup to "null"
    in the context. this was necessary to make the test `null is null` pass
  - CAVEAT: adds dependency on ES6 Symbols, Maps and Sets for `iterable` and
    `mapping` tests. These may need to be removed if we're not okay with
    dumping IE. The tests for these tests require ES6 features and would need
    to be removed as well.
@noahlange noahlange mentioned this issue Oct 12, 2017
4 tasks
@fdintino
Copy link
Collaborator

This was added in #1033

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