Skip to content

Capitalize does not follow Shopify spec  #326

Description

@microalps

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 -

{
  "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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions