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

Add not to mean ! #39

Closed
Keats opened this issue Jun 28, 2016 · 2 comments
Closed

Add not to mean ! #39

Keats opened this issue Jun 28, 2016 · 2 comments
Milestone

Comments

@Keats
Copy link
Owner

Keats commented Jun 28, 2016

In condition nodes.

Currently there's no way to indicate negation in if/elif.

For booleans we can do:

{% if my_bool == false %}

but that's obviously not ideal and doesn't work for truthy values (truthiness defined there https://github.com/Keats/tera/blob/master/src/context.rs#L86-L99)

We want to be able to express negation like so:

{% if not my_array %} // empty array will result in that if body rendering
{% if not username %} // empty string or null values will result in that if body rendering
{% if user and not user.is_admin %} // render if user exists but is not an admin

The not should be a keyword only used in the condition node but should be reserved globally as a Tera keyword in case we want to expand its use

@Keats Keats changed the title Add not to mean !, I don't even know if we handle negative right now Add not to mean ! Jun 29, 2016
@Keats Keats modified the milestone: 0.5 Nov 29, 2016
@Keats
Copy link
Owner Author

Keats commented Dec 7, 2016

@Robbepop I've seen your email but the comment doesn't appear in github for some reason.

I clarified the issue a bit more

@Keats
Copy link
Owner Author

Keats commented Dec 14, 2016

Anyone working on that? @Robbepop ?

@Keats Keats modified the milestones: 0.6, 0.5 Dec 18, 2016
@Keats Keats closed this as completed in 7714ba7 Dec 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant