-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Use of "blank?" (Rails code) in Liquid #224
Comments
See #223. |
we could add a default |
I'm confused about blank---is it supposed to work by default? In my tests it's always evaluating to false: {% assign space = " " %}{% if space == blank %}TRUTHY{% else %}NOT TRUTHY{% endif %}
--> NOT TRUTHY {% if " " == blank %}TRUTHY{% else %}NOT TRUTHY{% endif %}
--> NOT TRUTHY {% if "notblank" == blank %}TRUTHY{% else %}NOT TRUTHY{% endif %}
--> NOT TRUTHY {% if myundefined == blank %}TRUTHY{% else %}NOT TRUTHY{% endif %}
--> NOT TRUTHY {% assign myarray = "1,2" | split: "," %}{% if myarray == blank %}TRUTHY{% else %}NOT TRUTHY{% endif %}
--> NOT TRUTHY {% assign myarray = "" | split: "," %}{% if myarray == blank %}TRUTHY{% else %}NOT TRUTHY{% endif %}
--> NOT TRUTHY |
That's a bug, see #589. It works if activesupport (e.g. Rails) is present. |
@fw42 Ok got that working, thanks! |
After installing |
Since this is a language feature we may as well include it in Liquid. |
👎 to adding activesupport as a dependency. But I would be okay with reimplementing this method. |
Right, I agree. |
See
liquid/lib/liquid/context.rb
Line 139 in 5c5e7de
This doesn't work outside of Rails (Jekyll for instance).
The text was updated successfully, but these errors were encountered: