From e9a4ebf70d39f5777100d77e0eadb7a2778066c6 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 3 Jan 2021 00:16:10 +0900 Subject: [PATCH 01/13] doc: Add explanation for the priority attribute of html_*_files --- doc/usage/configuration.rst | 14 ++++++++++++++ tests/roots/test-html_assets/conf.py | 6 ++++-- tests/test_build_html.py | 8 ++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 27401d82e..e9e9190e6 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -1001,7 +1001,14 @@ that use Sphinx's HTMLWriter class. 'https://example.com/css/custom.css', ('print.css', {'media': 'print'})] + As a special attribute, *priority* can be set as an integer to load the CSS + file earlier or lazier step. For more information, refer + :meth:`Sphinx.add_css_files()`. + .. versionadded:: 1.8 + .. versionchanged:: 3.5 + + Support priority attribute .. confval:: html_js_files @@ -1017,7 +1024,14 @@ that use Sphinx's HTMLWriter class. 'https://example.com/scripts/custom.js', ('custom.js', {'async': 'async'})] + As a special attribute, *priority* can be set as an integer to load the CSS + file earlier or lazier step. For more information, refer + :meth:`Sphinx.add_css_files()`. + .. versionadded:: 1.8 + .. versionchanged:: 3.5 + + Support priority attribute .. confval:: html_static_path diff --git a/tests/roots/test-html_assets/conf.py b/tests/roots/test-html_assets/conf.py index ec53011c2..7f94bbbce 100644 --- a/tests/roots/test-html_assets/conf.py +++ b/tests/roots/test-html_assets/conf.py @@ -4,7 +4,9 @@ version = '1.4.4' html_static_path = ['static', 'subdir'] html_extra_path = ['extra', 'subdir'] html_css_files = ['css/style.css', - ('https://example.com/custom.css', {'title': 'title', 'media': 'print'})] + ('https://example.com/custom.css', + {'title': 'title', 'media': 'print', 'priority': 400})] html_js_files = ['js/custom.js', - ('https://example.com/script.js', {'async': 'async'})] + ('https://example.com/script.js', + {'async': 'async', 'priority': 400})] exclude_patterns = ['**/_build', '**/.htpasswd'] diff --git a/tests/test_build_html.py b/tests/test_build_html.py index e773c0ac4..21433cb8a 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -1244,15 +1244,15 @@ def test_assets_order(app): # css_files expected = ['_static/pygments.css', '_static/alabaster.css', '_static/early.css', - '_static/normal.css', '_static/late.css', '_static/css/style.css', - 'https://example.com/custom.css', '_static/lazy.css'] + 'https://example.com/custom.css', '_static/normal.css', '_static/late.css', + '_static/css/style.css', '_static/lazy.css'] pattern = '.*'.join('href="%s"' % f for f in expected) assert re.search(pattern, content, re.S) # js_files expected = ['_static/early.js', '_static/jquery.js', '_static/underscore.js', - '_static/doctools.js', '_static/normal.js', '_static/late.js', - '_static/js/custom.js', 'https://example.com/script.js', '_static/lazy.js'] + '_static/doctools.js', 'https://example.com/script.js', '_static/normal.js', + '_static/late.js', '_static/js/custom.js', '_static/lazy.js'] pattern = '.*'.join('src="%s"' % f for f in expected) assert re.search(pattern, content, re.S) From 7739b7d7dde827ce11dc8a94659e149dc51fef98 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 3 Jan 2021 00:17:19 +0900 Subject: [PATCH 02/13] doc: Add explanation about stable sort of html_*_files --- sphinx/application.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sphinx/application.py b/sphinx/application.py index 39ab93ed1..2252705c0 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -929,9 +929,11 @@ class Sphinx: Add *filename* to the list of JavaScript files that the default HTML template will include in order of *priority* (ascending). The filename must be relative to the HTML static path , or a full URI with scheme. - If the keyword argument ``body`` is given, its value will be added - between the ``' in content) +@pytest.mark.sphinx('html', testroot='ext-math', + confoverrides={'extensions': ['sphinx.ext.mathjax']}) +def test_mathjax_is_installed_only_if_document_having_math(app, status, warning): + app.builder.build_all() + + content = (app.outdir / 'index.html').read_text() + assert MATHJAX_URL in content + + content = (app.outdir / 'nomath.html').read_text() + assert MATHJAX_URL not in content + + @pytest.mark.sphinx('html', testroot='basic', confoverrides={'extensions': ['sphinx.ext.mathjax']}) def test_mathjax_is_not_installed_if_no_equations(app, status, warning): From 55cdadf973b89b3181407c478075ac0fc6984b3d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 8 Jan 2021 01:16:15 +0900 Subject: [PATCH 12/13] Bump to 3.4.3 final --- CHANGES | 19 ++----------------- sphinx/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index 24ebde5aa..85b3cb1fc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,17 +1,5 @@ -Release 3.4.3 (in development) -============================== - -Dependencies ------------- - -Incompatible changes --------------------- - -Deprecated ----------- - -Features added --------------- +Release 3.4.3 (released Jan 08, 2021) +===================================== Bugs fixed ---------- @@ -19,9 +7,6 @@ Bugs fixed * #8655: autodoc: Failed to generate document if target module contains an object that raises an exception on ``hasattr()`` -Testing --------- - Release 3.4.2 (released Jan 04, 2021) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 98c6ffe8f..de451b41c 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -32,7 +32,7 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '3.4.3+' +__version__ = '3.4.3' __released__ = '3.4.3' # used when Sphinx builds its own docs #: Version info for better programmatic use. @@ -43,7 +43,7 @@ __released__ = '3.4.3' # used when Sphinx builds its own docs #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (3, 4, 3, 'beta', 0) +version_info = (3, 4, 3, 'final', 0) package_dir = path.abspath(path.dirname(__file__)) From 458ccbea0b8026a00113d7e8255ec4e028d4cd08 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 8 Jan 2021 01:17:58 +0900 Subject: [PATCH 13/13] Bump version --- CHANGES | 21 +++++++++++++++++++++ sphinx/__init__.py | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 85b3cb1fc..4dfc95bd9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,24 @@ +Release 3.4.4 (in development) +============================== + +Dependencies +------------ + +Incompatible changes +-------------------- + +Deprecated +---------- + +Features added +-------------- + +Bugs fixed +---------- + +Testing +-------- + Release 3.4.3 (released Jan 08, 2021) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index de451b41c..06ba4fb92 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -32,8 +32,8 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '3.4.3' -__released__ = '3.4.3' # used when Sphinx builds its own docs +__version__ = '3.4.4+' +__released__ = '3.4.4' # used when Sphinx builds its own docs #: Version info for better programmatic use. #: @@ -43,7 +43,7 @@ __released__ = '3.4.3' # used when Sphinx builds its own docs #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (3, 4, 3, 'final', 0) +version_info = (3, 4, 4, 'beta', 0) package_dir = path.abspath(path.dirname(__file__))