Skip to content

Commit

Permalink
fix(user_overrides): extra overrides should be applied as legacy dict…
Browse files Browse the repository at this point in the history
…, thx to @Andygol

closes #267
  • Loading branch information
ultrabug committed Oct 13, 2023
1 parent a4664e5 commit 34b8a48
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mkdocs_static_i18n/reconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from urllib.parse import urlsplit

from mkdocs import localization
from mkdocs.config.base import LegacyConfig
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.plugins import BasePlugin, get_plugin_logger
from mkdocs.structure.files import File, Files
Expand Down Expand Up @@ -185,7 +186,7 @@ def reset_to_original_config(self, config: MkDocsConfig):

def save_original_config(self, store, key, value):
if key not in store:
store[key] = value
store[key] = deepcopy(value)

def apply_user_overrides(self, config: MkDocsConfig):
"""
Expand Down Expand Up @@ -240,6 +241,15 @@ def apply_user_overrides(self, config: MkDocsConfig):
log.info(
f"Overriding '{self.current_language}' config '{lang_key}' with '{lang_override}'"
)
# extra is a legacy dict config
elif mkdocs_config_option_type == LegacyConfig:
self.save_original_config(
self.original_configs, lang_key, config.data[lang_key]
)
config[lang_key].update(lang_override)
log.info(
f"Updating '{self.current_language}' config '{lang_key}' with '{lang_override}'"
)
else:
log.warning(f"Unknown '{self.current_language}' config override '{lang_key}'")
return config
Expand Down

0 comments on commit 34b8a48

Please sign in to comment.