-
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
to_number filter not working correctly #326
Comments
@jamesmacaulay, do you remember why the to_number filter is private? (there is a test for it written by you that asserts it) |
If it's always been private, it probably shouldn't show up in the documentation. But then, it seems useful, so I'm wondering why we don't make it public. |
cc @dtKinger |
I'm surprised it produces the wrong result. It's supposed to work ( like in php, smarty ). to_number should definitely not be exposed because Liquid has no datatypes. That's a programming concept with shouldn't be leaked into a template language. |
It doesn't work because the method is private. There is even a test that asserts that it's broken in this way. Shouldn't it rather raise a Liquid error instead of swallowing it? |
No problem, I'll omit it asap |
Okay another important point: filters are not supported in if statements. If you need to use the result of a filter in a conditional, you need to put it in a variable with It looks like invalid filters like Right now trying to do |
Agreed. I'm puzzled while this isn't the case right now. On Monday, March 24, 2014, James MacAulay notifications@github.com wrote:
|
@jamesmacaulay please remember that relational operators ( |
Yeah, that's how it is in ruby. However I think in Liquid, if the philosophy really is "variables don't have types", the thinking would be that there should be distinct operators which only do lexicographic comparison (and cast all arguments as strings). |
Using this example from the documentation produces wrong results. The message will always be printed regardless of the value of num
The text was updated successfully, but these errors were encountered: