Skip to content

Commit

Permalink
backwards compatible theme locale access
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink committed Apr 30, 2024
1 parent 530e842 commit b0ab74f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions mkdocs_git_revision_date_localized_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
https://www.mkdocs.org/
https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/
"""
# standard lib
import logging
import re
import os
import time

# 3rd party
from mkdocs import __version__ as mkdocs_version
from mkdocs.config import config_options
from mkdocs.plugins import BasePlugin
from mkdocs.structure.nav import Page
from mkdocs.utils import copy_file
from mkdocs.exceptions import ConfigurationError

# package modules
from mkdocs_git_revision_date_localized_plugin.util import Util
from mkdocs_git_revision_date_localized_plugin.exclude import exclude

Expand All @@ -26,7 +24,6 @@

HERE = os.path.dirname(os.path.abspath(__file__))


class GitRevisionDateLocalizedPlugin(BasePlugin):
"""
Mkdocs plugin to add revision date from Git.
Expand Down Expand Up @@ -79,7 +76,7 @@ def on_config(self, config: config_options.Config, **kwargs) -> Dict[str, Any]:
# theme locale
if "theme" in config and "locale" in config.get("theme"):
custom_theme = config.get("theme")
theme_locale = custom_theme.locale
theme_locale = custom_theme.locale if mkdocs_version >= "1.6.0" else custom_theme._vars.get("locale")
logging.debug(
"Locale '%s' extracted from the custom theme: '%s'"
% (theme_locale, custom_theme.name)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name="mkdocs-git-revision-date-localized-plugin",
version="1.2.4",
version="1.2.5",
description="Mkdocs plugin that enables displaying the localized date of the last git modification of a markdown file.",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b0ab74f

Please sign in to comment.