summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-05-12 01:22:29 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-05-12 01:36:14 +0900
commit5078069eb133dbb46f1c69c9693c1aefe9d903ef (patch)
tree1a695a22c1179b8e06c8247d9169574a56c97488 /sphinx/application.py
parent96dbe5e3549815409450588b50f52da4d6aaba5e (diff)
downloadsphinx-git-5078069eb133dbb46f1c69c9693c1aefe9d903ef.tar.gz
Deprecate app.html_themes
The register is much better to store the HTML themes instead of the application object. So this migrates it to the registry object.
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index afbb0f981..588a808f1 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -14,6 +14,7 @@ import os
import pickle
import platform
import sys
+import warnings
from collections import deque
from io import StringIO
from os import path
@@ -29,6 +30,7 @@ from pygments.lexer import Lexer
import sphinx
from sphinx import locale, package_dir
from sphinx.config import Config
+from sphinx.deprecation import RemovedInSphinx60Warning
from sphinx.domains import Domain, Index
from sphinx.environment import BuildEnvironment
from sphinx.environment.collectors import EnvironmentCollector
@@ -145,7 +147,6 @@ class Sphinx:
self.env: Optional[BuildEnvironment] = None
self.project: Optional[Project] = None
self.registry = SphinxComponentRegistry()
- self.html_themes: Dict[str, str] = {}
# validate provided directories
self.srcdir = abspath(srcdir)
@@ -1184,13 +1185,13 @@ class Sphinx:
def add_html_theme(self, name: str, theme_path: str) -> None:
"""Register a HTML Theme.
- The *name* is a name of theme, and *path* is a full path to the theme
- (refs: :ref:`distribute-your-theme`).
+ The *name* is a name of theme, and *theme_path* is a full path to the
+ theme (refs: :ref:`distribute-your-theme`).
.. versionadded:: 1.6
"""
logger.debug('[app] adding HTML theme: %r, %r', name, theme_path)
- self.html_themes[name] = theme_path
+ self.registry.add_html_theme(name, theme_path)
def add_html_math_renderer(self, name: str,
inline_renderers: Tuple[Callable, Callable] = None,
@@ -1257,6 +1258,12 @@ class Sphinx:
return True
+ @property
+ def html_themes(self) -> Dict[str, str]:
+ warnings.warn('app.html_themes is deprecated.',
+ RemovedInSphinx60Warning)
+ return self.registry.html_themes
+
class TemplateBridge:
"""