-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix/9093 theme basic css import #14260
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
Open
mhughes2012
wants to merge
16
commits into
sphinx-doc:master
Choose a base branch
from
mhughes2012:fix/9093-theme-basic-css-import
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix/9093 theme basic css import #14260
mhughes2012
wants to merge
16
commits into
sphinx-doc:master
from
mhughes2012:fix/9093-theme-basic-css-import
+40
−24
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, if a theme defined a stylesheet, it would completely
overwrite the stylesheet list of any parent themes. This caused
inherited themes (like 'agogo' or 'traditional') to lose the
foundation 'basic.css' from the 'basic' theme.
This change:
1. Modifies Theme initialization to append inherited stylesheets
rather than replacing them.
2. Ensures stylesheets are deduplicated while preserving order.
3. Updates existing tests that relied on the previous replacement
behavior to expect the full inheritance chain.
Python 3.15's argparse is stricter with '%' sequences in version and help strings. Switching to an f-string for the version argument avoids the ValueError caused by the previous manual string formatting.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This PR fixes a bug where HTML themes that inherit from a parent theme would accidentally overwrite the parent's stylesheet list instead of extending it. This was particularly problematic for themes like
agogoortraditionalthat inherit from thebasictheme; they would lose the corebasic.cssstyles if they defined their own stylesheets.Changes:
sphinx/theming.pyto merge stylesheet lists from the entire inheritance chain.basic.css) while preserving the correct loading order.tests/test_theming/test_theming.pythat were previously asserting the "replacement" behavior.I have verified this fix using a reproduction script that builds a project with the
agogotheme and confirms thatbasic.cssis correctly included in the final HTML output.References