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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: avoid implicit string comparison in Sphinx 7.26 #1592

Merged
merged 2 commits into from
Dec 13, 2023
Merged
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
13 changes: 9 additions & 4 deletions src/pydata_sphinx_theme/__init__.py
Expand Up @@ -233,15 +233,20 @@ def _remove_empty_templates(tname):
return True

context[section] = list(filter(_remove_empty_templates, context[section]))

#
# Remove a duplicate entry of the theme CSS. This is because it is in both:
# - theme.conf
# - manually linked in `webpack-macros.html`
if "css_files" in context:
theme_css_name = "_static/styles/pydata-sphinx-theme.css"
if theme_css_name in context["css_files"]:
context["css_files"].remove(theme_css_name)

for i in range(len(context["css_files"])):
asset = context["css_files"][i]
# TODO: eventually the contents of context['css_files'] etc should probably
# only be _CascadingStyleSheet etc. For now, assume mixed with strings.
asset_path = getattr(asset, "filename", str(asset))
if asset_path == theme_css_name:
del context["css_files"][i]
break
# Add links for favicons in the topbar
for favicon in context.get("theme_favicons", []):
icon_type = Path(favicon["href"]).suffix.strip(".")
Expand Down