Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social plugin maintenance for MkDocs 1.5.0 #5759

Merged
merged 1 commit into from Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 4 additions & 12 deletions material/plugins/social/plugin.py
Expand Up @@ -78,7 +78,6 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]):

def __init__(self):
self._executor = concurrent.futures.ThreadPoolExecutor(4)
self.custom_dir = None

# Retrieve configuration
def on_config(self, config):
Expand Down Expand Up @@ -145,13 +144,6 @@ def on_config(self, config):
"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)
Expand Down Expand Up @@ -403,8 +395,8 @@ def _load_logo(self, config):
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

Expand All @@ -431,8 +423,8 @@ def _load_logo(self, config):
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

Expand Down
16 changes: 4 additions & 12 deletions src/plugins/social/plugin.py
Expand Up @@ -78,7 +78,6 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]):

def __init__(self):
self._executor = concurrent.futures.ThreadPoolExecutor(4)
self.custom_dir = None

# Retrieve configuration
def on_config(self, config):
Expand Down Expand Up @@ -145,13 +144,6 @@ def on_config(self, config):
"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)
Expand Down Expand Up @@ -403,8 +395,8 @@ def _load_logo(self, config):
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

Expand All @@ -431,8 +423,8 @@ def _load_logo(self, config):
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

Expand Down