Support filters in conditional tags#195
Conversation
|
I pointed our code at the forked branch and wrote some additional tests that passed as expected. |
|
Hey @jareddellitt thanks for the PR! It turns out that Solid 0.18 implemented something that the original Liquid doesn't support... oops! I think we can maintain this feature but I would like to have this as an opt-in feature that people have to toggle to enable it given that it diverges from what the original Liquid supports. Something like WDYT? |
Yes, that seems reasonable. |
|
Hey @jareddellitt, thanks for this contribution! Do you plan on applying the suggestion @edgurgel made above? I recently got bit by this as part of an upgrade, and I'm happy to contribute if you're not able! Thanks! |
|
@barkerja sorry, forgot about this! Just pushed up a commit to make this optional. |
barkerja
left a comment
There was a problem hiding this comment.
No issues here. Thanks!
|
Thanks, team! I will review this in the next couple of days and get a new release cut out. ❤️ |
|
1.3.0 is out! 🎉 |
Fixes #194
Filters in
{% if %},{% elsif %}, and{% unless %}tags stopped working in 1.x. TheBinaryConditionandUnaryConditionstructs already had filter fields (left_argument_filters,right_argument_filters,argument_filters) but they were never populated during parsing or used during evaluation.This updates
ConditionExpression.parse/1to useArgument.parse_with_filters/1instead ofArgument.parse/1, and passes the captured filters through toArgument.get/4during evaluation.Enables templates like:
{% if items | size > 0 %}...{% endif %}{% if name | upcase == "JOHN" %}...{% endif %}{% unless items | size > 0 %}...{% endunless %}