Merge branch 'master' into merge/piri-piri

This commit is contained in:
squidfunk 2023-07-27 09:52:14 +02:00
commit d7ffa27b40
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
5 changed files with 18 additions and 25 deletions

View File

@ -1,3 +1,7 @@
mkdocs-material-9.1.20 (2023-07-27)
* Fixed deprecation warnings for social plugin
mkdocs-material-9.1.19 (2023-07-18) mkdocs-material-9.1.19 (2023-07-18)
* Added support for MkDocs 1.5+ * Added support for MkDocs 1.5+

View File

@ -25,6 +25,11 @@
- Updated MkDocs to 1.5.0 - Updated MkDocs to 1.5.0
- Fixed rendering of tags when announcement bar is present - Fixed rendering of tags when announcement bar is present
### 9.1.20 <small>July 27, 2023</small> { id="9.1.20" }
- Updated Sanskrit translations
- Fixed deprecation warnings for social plugin
### 9.1.19 <small>July 18, 2023</small> { id="9.1.19" } ### 9.1.19 <small>July 18, 2023</small> { id="9.1.19" }
- Added support for MkDocs 1.5+ - Added support for MkDocs 1.5+

View File

@ -93,7 +93,7 @@ inside it. Next:
non-essential lines and files. non-essential lines and files.
[bug reporting guide]: ../contributing/reporting-a-bug.md#upgrade-to-latest-version [bug reporting guide]: ../contributing/reporting-a-bug.md#upgrade-to-latest-version
[minimal configuration]: ../../creating-your-site/#minimal-configuration [minimal configuration]: ../creating-your-site.md#minimal-configuration
### Creating a .zip file ### Creating a .zip file

View File

@ -48,7 +48,6 @@ class SocialPlugin(BasePlugin[SocialConfig]):
def __init__(self): def __init__(self):
self._executor = concurrent.futures.ThreadPoolExecutor(4) self._executor = concurrent.futures.ThreadPoolExecutor(4)
self.custom_dir = None
# Retrieve configuration # Retrieve configuration
def on_config(self, config): def on_config(self, config):
@ -107,13 +106,6 @@ class SocialPlugin(BasePlugin[SocialConfig]):
"text": options.get("color", self.color["text"]) "text": options.get("color", self.color["text"])
} }
# Retrieve custom_dir path
for user_config in config.user_configs:
custom_dir = user_config.get("theme", {}).get("custom_dir")
if custom_dir:
self.custom_dir = custom_dir
break
# Retrieve logo and font # Retrieve logo and font
self._resized_logo_promise = self._executor.submit(self._load_resized_logo, config) self._resized_logo_promise = self._executor.submit(self._load_resized_logo, config)
self.font = self._load_font(config) self.font = self._load_font(config)
@ -365,8 +357,8 @@ class SocialPlugin(BasePlugin[SocialConfig]):
path = os.path.join(config.docs_dir, theme["logo"]) path = os.path.join(config.docs_dir, theme["logo"])
# Allow users to put the logo inside their custom_dir (theme["logo"] case) # Allow users to put the logo inside their custom_dir (theme["logo"] case)
if self.custom_dir: if theme.custom_dir:
custom_dir_logo = os.path.join(self.custom_dir, theme["logo"]) custom_dir_logo = os.path.join(theme.custom_dir, theme["logo"])
if os.path.exists(custom_dir_logo): if os.path.exists(custom_dir_logo):
path = custom_dir_logo path = custom_dir_logo
@ -393,8 +385,8 @@ class SocialPlugin(BasePlugin[SocialConfig]):
path = f"{base}/.icons/{logo}.svg" path = f"{base}/.icons/{logo}.svg"
# Allow users to put the logo inside their custom_dir (theme["icon"]["logo"] case) # Allow users to put the logo inside their custom_dir (theme["icon"]["logo"] case)
if self.custom_dir: if theme.custom_dir:
custom_dir_logo = os.path.join(self.custom_dir, ".icons", f"{logo}.svg") custom_dir_logo = os.path.join(theme.custom_dir, ".icons", f"{logo}.svg")
if os.path.exists(custom_dir_logo): if os.path.exists(custom_dir_logo):
path = custom_dir_logo path = custom_dir_logo

View File

@ -48,7 +48,6 @@ class SocialPlugin(BasePlugin[SocialConfig]):
def __init__(self): def __init__(self):
self._executor = concurrent.futures.ThreadPoolExecutor(4) self._executor = concurrent.futures.ThreadPoolExecutor(4)
self.custom_dir = None
# Retrieve configuration # Retrieve configuration
def on_config(self, config): def on_config(self, config):
@ -107,13 +106,6 @@ class SocialPlugin(BasePlugin[SocialConfig]):
"text": options.get("color", self.color["text"]) "text": options.get("color", self.color["text"])
} }
# Retrieve custom_dir path
for user_config in config.user_configs:
custom_dir = user_config.get("theme", {}).get("custom_dir")
if custom_dir:
self.custom_dir = custom_dir
break
# Retrieve logo and font # Retrieve logo and font
self._resized_logo_promise = self._executor.submit(self._load_resized_logo, config) self._resized_logo_promise = self._executor.submit(self._load_resized_logo, config)
self.font = self._load_font(config) self.font = self._load_font(config)
@ -365,8 +357,8 @@ class SocialPlugin(BasePlugin[SocialConfig]):
path = os.path.join(config.docs_dir, theme["logo"]) path = os.path.join(config.docs_dir, theme["logo"])
# Allow users to put the logo inside their custom_dir (theme["logo"] case) # Allow users to put the logo inside their custom_dir (theme["logo"] case)
if self.custom_dir: if theme.custom_dir:
custom_dir_logo = os.path.join(self.custom_dir, theme["logo"]) custom_dir_logo = os.path.join(theme.custom_dir, theme["logo"])
if os.path.exists(custom_dir_logo): if os.path.exists(custom_dir_logo):
path = custom_dir_logo path = custom_dir_logo
@ -393,8 +385,8 @@ class SocialPlugin(BasePlugin[SocialConfig]):
path = f"{base}/.icons/{logo}.svg" path = f"{base}/.icons/{logo}.svg"
# Allow users to put the logo inside their custom_dir (theme["icon"]["logo"] case) # Allow users to put the logo inside their custom_dir (theme["icon"]["logo"] case)
if self.custom_dir: if theme.custom_dir:
custom_dir_logo = os.path.join(self.custom_dir, ".icons", f"{logo}.svg") custom_dir_logo = os.path.join(theme.custom_dir, ".icons", f"{logo}.svg")
if os.path.exists(custom_dir_logo): if os.path.exists(custom_dir_logo):
path = custom_dir_logo path = custom_dir_logo