question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
daviburgcommented, Mar 31, 2021

🤦‍♂️

0reactions
harttlecommented, Apr 17, 2021

🎉 This issue has been resolved in version 9.23.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Capitalize does not follow Shopify spec - capitalizes each word
CSS has a text transform named identically that behaves like DotLiquid. The spec is out of line with what users expect. Maybe we...
Read more >
Solved: Change description to uppercase on product page
Solved: Hi I am using the streamline theme and have created tabs on my product page. I am wanting to change the colour...
Read more >
Text transform all headings & subheadings to uppercase ...
My store is currently running the Dawn 2.0 theme. Unfortunately, there is no global style setting for the theme to transform all the...
Read more >
Grammar and mechanics - Shopify Polaris
Job titles should be capitalized when they come before or after a person's name. When referring to a job title without referencing a...
Read more >
Display vendor in non capitalized letters - Shopify Community
Is it possible to change font size and display vendor in non-capitalized letters on home page collection and product page in debut theme?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found