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

Add missing filters #8

Closed
13 tasks done
edgurgel opened this issue Mar 21, 2017 · 16 comments
Closed
13 tasks done

Add missing filters #8

edgurgel opened this issue Mar 21, 2017 · 16 comments
Milestone

Comments

@edgurgel
Copy link
Owner

edgurgel commented Mar 21, 2017

Missing filters:

@edgurgel edgurgel added this to the Solid 1.0 milestone Aug 10, 2019
@barkerja
Copy link
Contributor

barkerja commented Oct 14, 2019

@edgurgel How do you feel about support for custom filters? I was thinking a configuration that allows for defining a module. Solid.Filter.filter_exists?/2 would check for this configuration, defaulting to any custom defined filters before checking the defaults in Solid.Filter.

This would allow for filters that may fall outside the scope of what the liquid spec defines, and also control dependencies (ex: an integrator may want to use Timex to format dates, but Solid should not have it as a hard dep).

@LostKobrakai
Copy link
Contributor

date could use https://github.com/plataformatec/nimble_strftime. It doesn't depend on any additional libraries and only does formatting.

@edgurgel
Copy link
Owner Author

@LostKobrakai that's pretty handy Thanks for the tip! 👍

@sb8244
Copy link
Contributor

sb8244 commented Oct 8, 2020

Wasn't sure if this is the right place to track it, but I'm wondering if .size should be supported in if tag?

image

I was able to recreate this functionality with assign, though:

            {% assign article_size = child.articles | size %}
            {% if article_size < child.article_count %}

@edgurgel
Copy link
Owner Author

edgurgel commented Oct 8, 2020

@sb8244 it should be supported yes! . Thanks for bringing this up! Issue created: #47

@wmnnd
Copy link
Contributor

wmnnd commented Jan 22, 2021

@edgurgel Would you be open to a PR that implements the date filter with Elixir 1.11’s new Calendar.strftime/3 function?

@edgurgel
Copy link
Owner Author

@wmnnd 100%! Then we just bump the elixir requirement accordingly 😎

@wmnnd
Copy link
Contributor

wmnnd commented Jan 23, 2021

@edgurgel Awesome! I’ll create a PR tomorrow.

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Jan 24, 2021

I've just added PRs for the rest besides strip_html. strip_newlines and newlines_to_br are naive implementations right now however, as they do not retain the iolist of the supplied template, but normalize to a binary.

Edit: There's a PR for strip_html now as well. It uses the same naive regex method the ruby library uses.

@LostKobrakai
Copy link
Contributor

It seems like the current CI build is broken because the where filter was only added on 4.0.2, while CI uses 4.0.0

@edgurgel
Copy link
Owner Author

Thanks for the heads up! Speaking of CI I should move this to GHA one day 🤔

@edgurgel
Copy link
Owner Author

edgurgel commented Feb 13, 2021

I've just updated the ticket with the remaining filters (they were added after the issue got created)

escape
escape_once
concat
prepend
url_decode
url_encode

@Jcambass
Copy link
Contributor

Jcambass commented Feb 15, 2021

I Will prepare a patch for concat and prepend later today.

EDIT: I think prepend is already supported?

Jcambass pushed a commit to Jcambass/solid that referenced this issue Feb 15, 2021
This patch adds support for the [Concat Filter](https://shopify.github.io/liquid/filters/concat/).

Related edgurgel#8
Jcambass pushed a commit to Jcambass/solid that referenced this issue Feb 16, 2021
This patch adds support for the [Concat Filter](https://shopify.github.io/liquid/filters/concat/).

Related edgurgel#8
edgurgel pushed a commit that referenced this issue Feb 16, 2021
This patch adds support for the [Concat Filter](https://shopify.github.io/liquid/filters/concat/).

Related #8
@edgurgel
Copy link
Owner Author

@Jcambass yes you are right! My bad! 🤦

@LostKobrakai
Copy link
Contributor

I'm already on the two missing filters. Just need to look into escape_once. Seems like Plug.HTML does currently only do raw escaping.

@edgurgel
Copy link
Owner Author

Thanks, everyone! 🎉

Jcambass added a commit to Jcambass/solid that referenced this issue Feb 18, 2021
Since edgurgel#8 is now closed we can check this one off.
edgurgel pushed a commit that referenced this issue Feb 18, 2021
Since #8 is now closed we can check this one off.
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

6 participants