mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #10079 from tk0miya/10061_confval_added_by_themes_not_initialized
Fix #10061: html theme: Confvals added by themes are not initialized
This commit is contained in:
commit
99c144d8cd
2
CHANGES
2
CHANGES
@ -60,6 +60,8 @@ Bugs fixed
|
|||||||
* #9878: mathjax: MathJax configuration is placed after loading MathJax itself
|
* #9878: mathjax: MathJax configuration is placed after loading MathJax itself
|
||||||
* #9857: Generated RFC links use outdated base url
|
* #9857: Generated RFC links use outdated base url
|
||||||
* #9909: HTML, prevent line-wrapping in literal text.
|
* #9909: HTML, prevent line-wrapping in literal text.
|
||||||
|
* #10061: html theme: Configuration values added by themes are not be able to
|
||||||
|
override from conf.py
|
||||||
* #9925: LaTeX: prohibit also with ``'xelatex'`` line splitting at dashes of
|
* #9925: LaTeX: prohibit also with ``'xelatex'`` line splitting at dashes of
|
||||||
inline and parsed literals
|
inline and parsed literals
|
||||||
* #9944: LaTeX: extra vertical whitespace for some nested declarations
|
* #9944: LaTeX: extra vertical whitespace for some nested declarations
|
||||||
|
@ -251,6 +251,17 @@ class Config:
|
|||||||
if name in self.values:
|
if name in self.values:
|
||||||
self.__dict__[name] = config[name]
|
self.__dict__[name] = config[name]
|
||||||
|
|
||||||
|
def post_init_values(self) -> None:
|
||||||
|
"""
|
||||||
|
Initialize additional config variables that are added after init_values() called.
|
||||||
|
"""
|
||||||
|
config = self._raw_config
|
||||||
|
for name in config:
|
||||||
|
if name not in self.__dict__ and name in self.values:
|
||||||
|
self.__dict__[name] = config[name]
|
||||||
|
|
||||||
|
check_confval_types(None, self)
|
||||||
|
|
||||||
def __getattr__(self, name: str) -> Any:
|
def __getattr__(self, name: str) -> Any:
|
||||||
if name.startswith('_'):
|
if name.startswith('_'):
|
||||||
raise AttributeError(name)
|
raise AttributeError(name)
|
||||||
@ -427,7 +438,7 @@ def check_confval_types(app: "Sphinx", config: Config) -> None:
|
|||||||
"but `{current}` is given.")
|
"but `{current}` is given.")
|
||||||
logger.warning(msg.format(name=confval.name,
|
logger.warning(msg.format(name=confval.name,
|
||||||
current=confval.value,
|
current=confval.value,
|
||||||
candidates=annotations.candidates))
|
candidates=annotations.candidates), once=True)
|
||||||
else:
|
else:
|
||||||
if type(confval.value) is type(default):
|
if type(confval.value) is type(default):
|
||||||
continue
|
continue
|
||||||
@ -452,13 +463,13 @@ def check_confval_types(app: "Sphinx", config: Config) -> None:
|
|||||||
permitted = " or ".join(wrapped_annotations)
|
permitted = " or ".join(wrapped_annotations)
|
||||||
logger.warning(msg.format(name=confval.name,
|
logger.warning(msg.format(name=confval.name,
|
||||||
current=type(confval.value),
|
current=type(confval.value),
|
||||||
permitted=permitted))
|
permitted=permitted), once=True)
|
||||||
else:
|
else:
|
||||||
msg = __("The config value `{name}' has type `{current.__name__}', "
|
msg = __("The config value `{name}' has type `{current.__name__}', "
|
||||||
"defaults to `{default.__name__}'.")
|
"defaults to `{default.__name__}'.")
|
||||||
logger.warning(msg.format(name=confval.name,
|
logger.warning(msg.format(name=confval.name,
|
||||||
current=type(confval.value),
|
current=type(confval.value),
|
||||||
default=type(default)))
|
default=type(default)), once=True)
|
||||||
|
|
||||||
|
|
||||||
def check_primary_domain(app: "Sphinx", config: Config) -> None:
|
def check_primary_domain(app: "Sphinx", config: Config) -> None:
|
||||||
|
@ -208,6 +208,7 @@ class HTMLThemeFactory:
|
|||||||
try:
|
try:
|
||||||
entry_point = theme_entry_points[name]
|
entry_point = theme_entry_points[name]
|
||||||
self.app.registry.load_extension(self.app, entry_point.module)
|
self.app.registry.load_extension(self.app, entry_point.module)
|
||||||
|
self.app.config.post_init_values()
|
||||||
return
|
return
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user