Closed rkk1995 closed 1 year ago
Hm, I’ll update the tests. How do you feel about the idea?
Hey, thanks for the PR! I do really like the idea, definitely something that's useful 👍 I don't think I would limit it to ascending though. I could also see scenarios where you'd want it to be descending (e.g. version numbers with the latest at the top)
Yeah I’m thinking I’ll make natural a completely different setting than ascending and descending. That way they can be combined.
going to update the tests next
Lmk what you think
I fixed the lint. The test failure isn't due to these changse.
Running poetry run pytest mkdocs_awesome_pages_plugin/tests/e2e/test_mkdocs_nav.py -k test_sections_nested_rest_dict -rx
on the tip of master has the same test failures.
The test is failing due to one of the dependencies you updated. You likely forgot to run poetry install
again after switching to master. I suggest you only add natsort
and revert all other dependency changes.
I added natsort = ">=8.1.0"
to pyproject.toml and then ran poetry update
.
This sets mkdocs to 1.3.1 from 1.2.3 and I think the test breaks due to that. I did pip install mkdocs==1.2.3
and ran the test and it worked afterwards. What do you suggest doing here? If I didn't run poetry update
the github workflow threw errors I believe.
This should do the trick:
poetry add "natsort>=8.1.0"
Fixed stuff up. The most notable change was I mistakenly used os_sort_keygen
(nice catch). I switched this for natsort_keygen
which is way more generic and allows you to further customize how the sorting is done. By default natsort_keygen
parses numbers as integers and ignores any signs ("+","-") which is what most people are looking for imo.
Some resources for anyone that wants to add further natsort customization to this plugin. Shouldn't be too difficult. https://natsort.readthedocs.io/en/5.4.1/intro.html#further-customizing-natsort
Don't worry about the failing windows-latest, pypy tests. I don't think that has anything to do with your changes. I'm guessing it's probably caused by the a new image for windows-latest.
Please do fix the formatting though. After that I'll merge your PR 🙂
I've just published version 2.8.0 which includes this change. Thanks for your work! ❤️
Natural sorting is important for documents that have file names that are numbered.
Take for example