timvink / mkdocs-git-revision-date-localized-plugin

MkDocs plugin to add a last updated date to your site pages
https://timvink.github.io/mkdocs-git-revision-date-localized-plugin/index.html
MIT License
193 stars 39 forks source link

Use `packaging` package for backwards compatibility check #135

Closed timvink closed 3 months ago

timvink commented 3 months ago

We have this line:

https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/blob/b0ab74f9c4cba65f25cc3a28cd5f3234f297b5c0/mkdocs_git_revision_date_localized_plugin/plugin.py#L79

We should not compare strings directly, but compare the versions:

from packaging.version import Version

...
theme_locale = custom_theme.locale if mkdocs_version >= Version("1.6.0") else custom_theme._vars.get("locale")