Skip to content

Commit

Permalink
Patch app.config in a more resilient manner (#783)
Browse files Browse the repository at this point in the history
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
  • Loading branch information
AA-Turner and pradyunsg authored Apr 27, 2024
1 parent 6a3afab commit 3787a7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/furo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,13 @@ def _builder_inited(app: sphinx.application.Sphinx) -> None:
update_known_styles_state(app)

def _update_default(key: str, *, new_default: Any) -> None:
app.config.values[key] = (new_default, *app.config.values[key][1:])
try:
conf_py_settings = app.config._raw_config
except AttributeError:
pass # Sphinx's config has changed.
else:
if key not in conf_py_settings:
app.config._raw_config.setdefault(key, new_default)

# Change the default permalinks icon
_update_default("html_permalinks_icon", new_default="#")
Expand Down

0 comments on commit 3787a7c

Please sign in to comment.