-
Notifications
You must be signed in to change notification settings - Fork 8
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
Make {% if %} tag able to perform comparisons #20
Comments
I've a branch, now, that uses python's built in expression parsing to handle all expressions. This makes ALL tags far more flexible. However, it presents a large stumbling block: the handling of {% include %} Currently since we control the parsing of tokens, we can parse a single expression from the token stream, then parse a series of I can't yet see a way to provide this same functionality without recreating the full expression parsing abilities of Python anyway. |
Hey is there a workaround for this? I'm using stencil with Gilbert and trying to display certain team cards if they match the author/s of a post For example I have a BlogPost and TeamMember class in plugins.py:
Then in the post_detail template I pass each author of the post with all the team members to team_list template:
Now in team_list I want to display the team information only if the member.name matches the author:
|
A dirty hack might be to use
|
Ah clever I think that will be fine to use, thanks for providing an example |
Currently {% if %} can only do "if " or "if not "
It would obviously be far more powerful to be able to express other comparisons, against full expressions.
The text was updated successfully, but these errors were encountered: