Skip to content

Commit

Permalink
Don't copy {html,epub}_theme_options [GH-11203]
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 14, 2024
1 parent 23cef9b commit 5073c29
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sphinx/builders/html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ def get_theme_config(self) -> tuple[str, dict]:

def init_templates(self) -> None:
theme_factory = HTMLThemeFactory(self.app)
themename, themeoptions = self.get_theme_config()
self.theme = theme_factory.create(themename)
self.theme_options = themeoptions.copy()
theme_name, theme_options = self.get_theme_config()
self.theme = theme_factory.create(theme_name)
self.theme_options = theme_options
self.create_template_bridge()
self.templates.init(self, self.theme)

Expand Down Expand Up @@ -553,10 +553,11 @@ def prepare_writing(self, docnames: set[str]) -> None:
'html5_doctype': True,
}
if self.theme:
self.globalcontext.update(
('theme_' + key, val) for (key, val) in
self.theme.get_options(self.theme_options).items())
self.globalcontext.update(self.config.html_context)
self.globalcontext |= {
f'theme_{key}': val for key, val in
self.theme.get_options(self.theme_options).items()
}
self.globalcontext |= self.config.html_context

def get_doc_context(self, docname: str, body: str, metatags: str) -> dict[str, Any]:
"""Collect items for the template context of a page."""
Expand Down Expand Up @@ -814,7 +815,7 @@ def onerror(filename: str, error: Exception) -> None:
filename, error)

if self.theme:
for entry in self.theme.get_theme_dirs()[::-1]:
for entry in reversed(self.theme.get_theme_dirs()):
copy_asset(path.join(entry, 'static'),
path.join(self.outdir, '_static'),
excluded=DOTFILES, context=context,
Expand Down

0 comments on commit 5073c29

Please sign in to comment.