Skip to content
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

List of built-in Liquid filters #12

Open
pdehaan opened this issue Feb 14, 2020 · 1 comment
Open

List of built-in Liquid filters #12

pdehaan opened this issue Feb 14, 2020 · 1 comment

Comments

@pdehaan
Copy link
Owner

pdehaan commented Feb 14, 2020

Related to #11

Blog post which lists/links all liquidjs filters and maybe the Nunjucks equivalents (if any).

I was working on something for this, where it had liquid vs nunjucks, but it turned out too much like the documentation. Might need to try cleaning it up and checking it in, in a semi-messy state for iterating on.
I was initially thinking 7 top level pages: array, date, html, math, object, string, and url; and then subnav on that index page to the individual examples. It started breaking down because it felt like I was mirroring documentation too much, and it was confusing having nunjucks#compact, which was a polyfill, but not entirely obviously so. Confusingly, I can't even find Liquid's compact filter below, but was pretty sure it was working.


liquidjs filters

https://github.com/harttle/liquidjs/wiki/Builtin-Filters

By category:

array:

  • concat
  • first
  • join
  • last
  • map
  • reverse
  • size
  • slice
  • sort
  • uniq
  • where

date:

  • date

html:

  • escape
  • escape_once
  • newline_to_br
  • strip_html

math:

  • abs
  • at_least
  • at_most
  • ceil
  • divided_by
  • floor
  • minus
  • modulo
  • round
  • plus
  • sort_natural
  • times

object:

  • default

string:

  • append
  • capitalize
  • downcase
  • lstrip
  • prepend
  • remove
  • remove_first
  • replace
  • replace_first
  • rstrip
  • split
  • strip
  • strip_newlines
  • truncate
  • truncatewords
  • upcase

url:

  • url_decode
  • url_encode
@pdehaan
Copy link
Owner Author

pdehaan commented Feb 18, 2020

Initial work started in https://github.com/pdehaan/11ty-liquid-builtin-liquid-filters

Still needs a lot of cleanup, and maybe porting some examples from the liquidjs site into the templates.

And add more context around which filters are unavailable in Nunjucks, or might have different names, etc. Not sure if it makes sense to write on how to port some of these examples from liquidjs to nunjucks, or if that's a bit too far and we handle those conversions on a filter by filter basis and link from the above repo to individual blog posts showing the liquified nunjucks filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant