summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-07-07 02:09:50 +0900
committerGitHub <noreply@github.com>2021-07-07 02:09:50 +0900
commit5e5bca98f752cb61c36afc7955183e79a6095cf2 (patch)
tree66fc9448a4bbab736469fdad514dfa970787d495 /sphinx/application.py
parent988a79de65737e403cd27721ce091760cf62b97f (diff)
parentf0fef96906d80d89e290a780767a92ba85977733 (diff)
downloadsphinx-git-5e5bca98f752cb61c36afc7955183e79a6095cf2.tar.gz
Merge branch '4.x' into 6525_linkcheck_warn_redirects
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index a722edc72..5342730fd 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -655,7 +655,7 @@ class Sphinx:
...
def setup(app):
- add_directive('my-directive', MyDirective)
+ app.add_directive('my-directive', MyDirective)
For more details, see `the Docutils docs
<https://docutils.sourceforge.io/docs/howto/rst-directives.html>`__ .
@@ -1250,6 +1250,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
+
@property
def html_themes(self) -> Dict[str, str]:
warnings.warn('app.html_themes is deprecated.',