-
Notifications
You must be signed in to change notification settings - Fork 38
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
base: master
Are you sure you want to change the base?
Conversation
Resolved these issues and linting passed locally. |
There was a problem hiding this 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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Added option to ignore case for sorting pages.
Similar to previous PR, but added
ignore_case
as an option in theMeta
andOption
classes. Furthermore, modified the_order
method so thatignore_case
should work for natural and standard sorting.