Capitalize does not follow Shopify spec
See original GitHub issue_Note: I am not a user of liquidjs but found this while working on https://github.com/dotliquid/dotliquid/issues/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 -
{
"template": "{{ name | capitalize }}",
"data": {
"name": "John G. Chalmers-Smith"
}
}
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
🤦♂️
🎉 This issue has been resolved in version 9.23.4 🎉
The release is available on:
Your semantic-release bot 📦🚀