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

Implement all filters #3

Open
35 of 41 tasks
TechMagister opened this issue Jan 1, 2017 · 6 comments
Open
35 of 41 tasks

Implement all filters #3

TechMagister opened this issue Jan 1, 2017 · 6 comments

Comments

@TechMagister
Copy link

TechMagister commented Jan 1, 2017

Filters

  • abs
  • append
  • capitalize
  • ceil
  • compact
  • date
  • default
  • divided_by
  • downcase
  • escape
  • escape_once
  • first
  • floor
  • join
  • last
  • lstrip
  • map
  • minus
  • modulo
  • newline_to_br
  • plus
  • prepend
  • remove
  • remove_first
  • replace
  • replace_first
  • reverse
  • round
  • rstrip
  • size
  • slice
  • sort
  • sort_natural
  • split
  • strip
  • strip_html
  • strip_newlines
  • times
  • truncate
  • truncatewords
  • uniq
@exts
Copy link
Contributor

exts commented Jan 14, 2017

Going to try helping where I can :), already did my first PR for downcase.

@TechMagister
Copy link
Author

Thanks for your contribution 🍰

@exts
Copy link
Contributor

exts commented Jan 16, 2017

As for the map filter, I don't think that's possible in crystal since you can't call properties/methods dynamically unless you know a way to do it with macros?

@TechMagister
Copy link
Author

Using the [] operator can be a solution, but it means that the map filter will be restricted to hash :/

@exts
Copy link
Contributor

exts commented Jan 16, 2017

Maybe this could be a reason for them to support this feature in the language? I ran into a similar issue when trying to create php style dynamic controller/actions as well and was forced to use a single method as the solution :/

I almost had a breakthrough though, basically i found out that constant arrays can be used dynamically in {% for ... %}{% end %} macros, only problem is idk how to create a single value array constant at compile time w/ the data we'd need to run that loop.

@exts
Copy link
Contributor

exts commented Jan 16, 2017

actually now looking at the liquid source, it looks like they only really support Enumerable's w/ the map option that responds to []

Guess like you said, that'll have to do for now.

My current solution: exts@c03a643 will push later once I add more filters.

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

No branches or pull requests

1 participant