Skip to content

Commit 9021426

Browse files
committed
fix: roll forward fix for theme basic css import
1 parent 87e948c commit 9021426

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Contributors
9797
* Matthew Woodcraft -- text output improvements
9898
* Matthias Geier -- style improvements
9999
* Michael Droettboom -- inheritance_diagram extension
100+
* Michael Hughes -- Merge inherited stylesheets in HTML themes
100101
* Michael Wilson -- Intersphinx HTTP basic auth support
101102
* Nathan Damon -- bugfix in validation of static paths in html builders
102103
* Nils Kattenbeck -- pygments dark style

sphinx/theming.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def __init__(
8080
self.pygments_style_dark: str | None = None
8181
for config in reversed(configs.values()):
8282
options |= config.options
83-
if config.stylesheets is not None:
84-
self.stylesheets = config.stylesheets
83+
for stylesheet in config.stylesheets:
84+
if stylesheet not in self.stylesheets:
85+
self.stylesheets += (stylesheet,)
8586
if config.sidebar_templates is not None:
8687
self.sidebar_templates = config.sidebar_templates
8788
if config.pygments_style_default is not None:

tests/test_theming/test_theming.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_theme_api(app: SphinxTestApp) -> None:
7575
assert len(theme.get_theme_dirs()) == 2
7676

7777
# direct setting
78-
assert theme.get_config('theme', 'stylesheet') == 'custom.css'
78+
assert theme.get_config('theme', 'stylesheet') == 'basic.css, custom.css'
7979
# inherited setting
8080
assert theme.get_config('options', 'nosidebar') == 'false'
8181
# nonexisting setting
@@ -169,6 +169,7 @@ def test_dark_style(app: SphinxTestApp, monkeypatch: pytest.MonkeyPatch) -> None
169169
assert css_file.attributes['media'] == '(prefers-color-scheme: dark)'
170170

171171
assert sorted(str(f.filename) for f in app.builder._css_files) == [
172+
'_static/basic.css',
172173
'_static/classic.css',
173174
'_static/pygments.css',
174175
'_static/pygments_dark.css',

0 commit comments

Comments
 (0)