Skip to content

Commit

Permalink
FIX: avoid implicit string comparison in Sphinx 7.26 (#1592)
Browse files Browse the repository at this point in the history
* FIX: avoid implicit string comparison in Sphinx 7.26

* lint

---------

Co-authored-by: Daniel McCloy <dan@mccloy.info>
  • Loading branch information
agoose77 and drammock committed Dec 13, 2023
1 parent 7bdd4c1 commit 8bc48a9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
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

0 comments on commit 8bc48a9

Please sign in to comment.