diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2021-06-14 16:48:55 +0200 |
---|---|---|
committer | Manuel Kaufmann <humitos@gmail.com> | 2021-06-14 16:50:26 +0200 |
commit | c818a70528a29dc404a9220624993dc7b96ccf88 (patch) | |
tree | 3416a8d4fce9ece59818e28363cd61462584abce /sphinx/application.py | |
parent | d01e776c814a3f9eaa479ec7eb63fb4fc33a0143 (diff) | |
download | sphinx-git-c818a70528a29dc404a9220624993dc7b96ccf88.tar.gz |
Rename variable to `html_assets_policy`
Diffstat (limited to 'sphinx/application.py')
-rw-r--r-- | sphinx/application.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 59e1683b3..1da222d7f 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -146,7 +146,6 @@ class Sphinx: self.project: Project = None self.registry = SphinxComponentRegistry() self.html_themes: Dict[str, str] = {} - self.html_assets_in_all_pages: bool = False # validate provided directories self.srcdir = abspath(srcdir) @@ -1182,13 +1181,6 @@ class Sphinx: logger.debug('[app] adding environment collector: %r', collector) collector().enable(self) - def add_html_assets_in_all_pages(self): - """Tell extensions to insert HTML assets in all the pages. - - .. versionadded: 4.1 - """ - self.html_assets_in_all_pages = True - def add_html_theme(self, name: str, theme_path: str) -> None: """Register a HTML Theme. @@ -1265,6 +1257,18 @@ class Sphinx: return True + def set_html_assets_policy(self, policy): + """Set the policy to include assets in HTML pages. + + - always: include the assets in all the pages + - per_page: include the assets only in pages where they are used + + .. versionadded: 4.1 + """ + if policy not in ('always', 'per_page'): + raise ValueError('policy %s is not supported' % policy) + self.registry.html_assets_policy = policy + class TemplateBridge: """ |