-
-
Notifications
You must be signed in to change notification settings - Fork 238
Capitalize does not follow Shopify spec #326
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
Comments
🤦♂️ |
I dislike it, but it appears we need to offer an option for compatibility on the behavior of this filter, whether customers need the Shopify behavior or the LiquidJS behavior. |
The first step, I think, is somehow having an alternate that DOES what we are doing as a filter across liquid implementations. If upcase_first is it - so be it. If we can coordinate that with Shopify Liquid, liquidjs, and DotLiquid, even better. Somewhere down the line, liquidjs and DotLiquid can each individually decide how to offer opt-in for this breaking change to the capitalize. Without an alternative though, nobody will opt-in IMHO the "standard" is very ruby specific. |
The problem with alternate filter names is that a customer coming from one implementation to another cannot just opt-in compatibility option from its origin, he would instead need to modify its template. |
Clarification on what I meant: So existing liquidjs users won't opt in - until they switch all their references to the alternate filter name. This will allow them time to ease into this (both filters do the same thing without the opt-in) I'm all ears to hearing additional solutions, but we need to coordinate, that's the key in my opinion. |
I also suggest rounding out the 'capitalization' options with a CSS |
@harttle Do you have any thoughts on this topic? |
Since it's not consistent with Shopify/liquid, I regard it as a bug. It'll be fixed on the next patch version. |
Do you have any plans or thoughts how to support users that are currently using Capitalize filter? Will you offer a non-standard filter for them to switch to? A compatibility flag? Both? |
I think it's purely a bug. The proposed/needed capitalize filter is not standard and shouldn't be builtin. Plus it's easy to implement, I'd rather leave it to users. |
## [9.23.4](v9.23.3...v9.23.4) (2021-04-17) ### Bug Fixes * capitalize filter not lower case trailing string, fixes [#326](#326) ([6548765](6548765))
🎉 This issue has been resolved in version 9.23.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Note: I am not a user of liquidjs but found this while working on dotliquid/dotliquid#390
Shopify is working on updating their docs (see Shopify/liquid#1403 and the future docs at https://ericfromcanada.github.io/liquid/filters/capitalize/) that notes that capitalize actually lower cases everything. So mcDonald becomes Mcdonald! LiquidJS does not implement this way (IMHO is a more sensible version).
I tested Ruby liquid on my server -
Result: John g. chalmers-smith
if I add a space before the name, it will be all lowercase.
FYI - In Rails, the equivalent to this is named upcase_first. See https://glaucocustodio.github.io/2016/05/19/rails-5-new-upcase-first-method/ and https://stackoverflow.com/questions/3724913/how-to-capitalize-the-first-letter-in-a-string-in-ruby
The text was updated successfully, but these errors were encountered: