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 ignore case for sorting #112

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

lcvgit
Copy link

@lcvgit lcvgit commented Dec 10, 2024

Added option to ignore case for sorting pages.

Similar to previous PR, but added ignore_case as an option in the Meta and Option classes. Furthermore, modified the _order method so that ignore_case should work for natural and standard sorting.

@lcvgit
Copy link
Author

lcvgit commented Dec 11, 2024

Resolved these issues and linting passed locally.

Copy link
Owner

@lukasgeiter lukasgeiter left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks pretty good already 👌

else:
key = lambda i: basename(self._get_item_path(i))
if ignore_case and sort_type != Meta.SORT_NATURAL:
key = lambda i: basename(self._get_item_path(i)).casefold()
Copy link
Owner

Choose a reason for hiding this comment

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

Would it be possible to apply the casefold at a later stage to avoid the code duplication? Further down where the natural sort is handled.

Copy link
Author

Choose a reason for hiding this comment

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

Let me know what you think of this revision. This is much closer to the original form but just renamed the first occurrence of key to avoid a recursion error.

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.

2 participants