-
Notifications
You must be signed in to change notification settings - Fork 326
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
don't warn on fallback if no highlight theme was requested #1264
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
595c120
don't warn on fallback if no highlight theme requested
drammock 8cf1969
fix it for good
drammock dc303d9
move event back to build-finished
drammock c6421dc
better name, better doc
drammock f8253f2
cleanup
drammock 1c952b2
simplify/safer
drammock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that you might be able to use this helper function we use elsewhere:
pydata-sphinx-theme/src/pydata_sphinx_theme/__init__.py
Line 35 in 58caad4
If calling
get_options()
is the "right" way to do this, maybe we should update that function too. Gah there are way too many ways to do the same thing in SphinxThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am already using that helper function 2 lines above; this line is only called if the style key wasn't found by the helper. Most of this you already know @choldgraf, but for completeness / future selves:
app.builder.get_theme_config()
returnsapp.builder.config.html_theme
(just the theme name)app.builder.config.html_theme_options
(dict of theme options).initialized here as an empty dict, it's not clear to me when it's populated, and with whatit's populated directly from user'sconf.py
duringapp.config.read()
.app.builder.theme_options
is a copy ofapp.builder.config.html_theme_options
.builder.init_templates()
app.builder.config.html_theme_options
too.Calling
app.builder.theme.get_options()
will get just the values intheme.conf
without any user overrides..get_options(app.builder.theme_options)
, which makes me strongly suspect thatapp.builder.theme_options
includes only the user-providedhtml_theme_options
from theirconf.py
(and not the theme's defaults). EDIT see strikethrough edit above, it's clear now thathtml_theme_options
does not include theme default values fromtheme.conf
builder.prepare_writing()
, right afterglobalcontext
is created.builder.prepare_writing()
is sometimes never called (e.g. if no files have changed?). That would explain why we had to work around missingglobalcontext
and also why the theme's defaults weren't available/accessible.In this case, I think it would be possible / sensible to update the helper function to also check the
theme.conf
values. Might be a good use case forChainMap
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sphinx never ceases to amaze me lol. Thanks for putting all of this together!