Merge branch 'master' into merge/piri-piri

This commit is contained in:
squidfunk
2023-07-27 09:52:14 +02:00
5 changed files with 18 additions and 25 deletions

View File

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