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: include and exclude filters for pagination #3103

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Snapstromegon
Copy link
Member

This Commit adds the include and exclude attributes to the pagination plugin. This allows for more semantic filtering in a backwards compatible manner.

This commit also adds the required tests based on the existing filter tests.

TODO: Remove old filter for v3.0

fixes: #2522 with option 1 from this comment

This Commit adds the `include` and `exclude` attributes to the pagination plugin.
This allows for more semantic filtering in a backwards compatible manner.

This commit also adds the required tests based on the existing filter tests.

TODO: Remove old `filter` for v3.0
Signed-off-by: Raphael Höser <[email protected]>
@Snapstromegon
Copy link
Member Author

It seems like there are some merge conflicts. I will take care of those.

This Commit adds the `include` and `exclude` attributes to the pagination plugin.
This allows for more semantic filtering in a backwards compatible manner.

This commit also adds the required tests based on the existing filter tests.

TODO: Remove old `filter` for v3.0
Signed-off-by: Raphael Höser <[email protected]>
…apstromegon/eleventy into issue-2522-pagination-include-exclude

Signed-off-by: Raphael Höser <[email protected]>
src/Plugins/Pagination.js Outdated Show resolved Hide resolved
src/Plugins/Pagination.js Outdated Show resolved Hide resolved
src/Plugins/Pagination.js Outdated Show resolved Hide resolved
src/Plugins/Pagination.js Outdated Show resolved Hide resolved
return excluded === value;
}

// Let's keep this code for backwards compatibility to V2.
Copy link
Contributor

@uncenter uncenter Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this old filter property logic now I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happy to do so, but I think this should be communicated, since it affects the public API of this plugin. Is there a way to log warnings if someone still uses filters?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we add a warning when someone uses filter that says "The filter Pagination property has been deprecated in Eleventy v3. You can replace it with exclude for the same effect".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. My question is, if there is a better way than throwing an error or using console.warn for this.

Copy link
Contributor

@uncenter uncenter Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anywhere else where we are throwing an error or console.warn-ing for a deprecation. Seems like those just get tagged as deprecated with JSDoc but aren't removed or changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zachleat, how would you want me to handle this here?
Maybe you even have an opinion on doing a breaking change.

Signed-off-by: Raphael Höser <[email protected]>
src/Plugins/Pagination.js Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

Change filter front matter key to filterOut for v2.x
2 participants