From 7286291f9326bc023441d64eba9b26b09c2e37f1 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 4 Jun 2022 17:45:09 +0100 Subject: [PATCH 1/5] Add docutils_version_info to `StandaloneHTMLBuilder.globalcontext` --- CHANGES | 3 +++ doc/templating.rst | 9 +++++++++ sphinx/builders/html/__init__.py | 1 + 3 files changed, 13 insertions(+) diff --git a/CHANGES b/CHANGES index ca68c54703c..59fe2480f83 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,9 @@ Deprecated Features added -------------- +* #10523: html theme: Expose the Docutils's version info tuple as a template variable, + ``docutils_version_info``. Patch by Adam Turner. + Bugs fixed ---------- diff --git a/doc/templating.rst b/doc/templating.rst index 3d80edd6009..41f74a715c4 100644 --- a/doc/templating.rst +++ b/doc/templating.rst @@ -383,6 +383,15 @@ in the future. .. versionadded:: 4.2 +.. data:: docutils_version_info + + The version of Docutils used to build represented as a tuple of five elements. + For Docutils version 0.16.1 beta 2 this would be `(0, 16, 1, 'beta', 1)``. + The fourth element can be one of: ``alpha``, ``beta``, ``candidate``, ``final``. + ``final`` always has 0 as the last element. + + .. versionadded:: 5.0.2 + .. data:: style The name of the main stylesheet, as given by the theme or diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py index b320b0df588..f5ab2d828e0 100644 --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -536,6 +536,7 @@ def prepare_writing(self, docnames: Set[str]) -> None: 'css_files': self.css_files, 'sphinx_version': __display_version__, 'sphinx_version_tuple': sphinx_version, + 'docutils_version_info': docutils.__version_info__[:5], 'style': self._get_style_filename(), 'rellinks': rellinks, 'builder': self.name, From bbf1576277f2544327a9252f448a873fd60bc171 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 4 Jun 2022 18:08:10 +0100 Subject: [PATCH 2/5] Fix double brackets on Docutils 0.18+ --- CHANGES | 1 + sphinx/themes/basic/static/basic.css_t | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 59fe2480f83..09ae5f90152 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Bugs fixed ---------- * #10509: autosummary: autosummary fails with a shared library +* #10523: html theme: Fix double brackets on citation references in Docutils 0.18+. Testing -------- diff --git a/sphinx/themes/basic/static/basic.css_t b/sphinx/themes/basic/static/basic.css_t index 9e5047afe6f..67bfec755ca 100644 --- a/sphinx/themes/basic/static/basic.css_t +++ b/sphinx/themes/basic/static/basic.css_t @@ -237,6 +237,7 @@ a.headerlink { visibility: hidden; } +{%- if docutils_version_info[:2] < (0, 18) %} a.brackets:before, span.brackets > a:before{ content: "["; @@ -246,6 +247,7 @@ a.brackets:after, span.brackets > a:after { content: "]"; } +{% endif %} h1:hover > a.headerlink, h2:hover > a.headerlink, From 5ddc22baf85cd46b7a4f2175deb9fcb3359a8858 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 4 Jun 2022 20:53:57 +0100 Subject: [PATCH 3/5] Fix an example in the templating document Co-authored-by: Matthias Geier --- doc/templating.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/templating.rst b/doc/templating.rst index 41f74a715c4..d9755a836b1 100644 --- a/doc/templating.rst +++ b/doc/templating.rst @@ -386,7 +386,7 @@ in the future. .. data:: docutils_version_info The version of Docutils used to build represented as a tuple of five elements. - For Docutils version 0.16.1 beta 2 this would be `(0, 16, 1, 'beta', 1)``. + For Docutils version 0.16.1 beta 2 this would be `(0, 16, 1, 'beta', 2)``. The fourth element can be one of: ``alpha``, ``beta``, ``candidate``, ``final``. ``final`` always has 0 as the last element. From 25656d07b79aba5917ef74c81c104c09636b656f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 4 Jun 2022 20:56:14 +0100 Subject: [PATCH 4/5] Line length --- CHANGES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 09ae5f90152..8e8984bfa1a 100644 --- a/CHANGES +++ b/CHANGES @@ -13,8 +13,8 @@ Deprecated Features added -------------- -* #10523: html theme: Expose the Docutils's version info tuple as a template variable, - ``docutils_version_info``. Patch by Adam Turner. +* #10523: html theme: Expose the Docutils's version info tuple as a template + variable, ``docutils_version_info``. Patch by Adam Turner. Bugs fixed ---------- From 36e79d708964be486115a7192b7622a310bf715c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 4 Jun 2022 21:07:10 +0100 Subject: [PATCH 5/5] Update credits in CHANGES --- CHANGES | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 8e8984bfa1a..3098438ac38 100644 --- a/CHANGES +++ b/CHANGES @@ -13,14 +13,15 @@ Deprecated Features added -------------- -* #10523: html theme: Expose the Docutils's version info tuple as a template +* #10523: HTML Theme: Expose the Docutils's version info tuple as a template variable, ``docutils_version_info``. Patch by Adam Turner. Bugs fixed ---------- * #10509: autosummary: autosummary fails with a shared library -* #10523: html theme: Fix double brackets on citation references in Docutils 0.18+. +* #10523: HTML Theme: Fix double brackets on citation references in Docutils 0.18+. + Patch by Adam Turner. Testing -------- @@ -32,10 +33,11 @@ Bugs fixed ---------- * #10498: gettext: TypeError is raised when sorting warning messages if a node - has no line number -* #10493: html theme: :rst:dir:`topic` directive is rendered incorrectly with - docutils-0.18 -* #10495: IndexError is raised for a :rst:role:`kbd` role having a separator + has no line number. Patch by Adam Turner. +* #10493: HTML Theme: :rst:dir:`topic` directive is rendered incorrectly with + Docutils 0.18. Patch by Adam Turner. +* #10495: IndexError is raised for a :rst:role:`kbd` role having a separator. + Patch by Adam Turner. Release 5.0.0 (released May 30, 2022) ===================================== @@ -76,6 +78,7 @@ Incompatible changes * #10474: :confval:`language` does not accept ``None`` as it value. The default value of ``language`` becomes to ``'en'`` now. + Patch by Adam Turner and Takeshi KOMIYA. Deprecated ---------- @@ -131,11 +134,12 @@ Features added non-imported * #10028: Removed internal usages of JavaScript frameworks (jQuery and underscore.js) and modernised ``doctools.js`` and ``searchtools.js`` to - EMCAScript 2018. + EMCAScript 2018. Patch by Adam Turner. * #10302: C++, add support for conditional expressions (``?:``). * #5157, #10251: Inline code is able to be highlighted via :rst:dir:`role` directive -* #10337: Make sphinx-build faster by caching Publisher object during build +* #10337: Make sphinx-build faster by caching Publisher object during build. + Patch by Adam Turner. Bugs fixed ---------- @@ -143,7 +147,7 @@ Bugs fixed 5.0.0 b1 * #10200: apidoc: Duplicated submodules are shown for modules having both .pyx - and .so files + and .so files. Patch by Adam Turner and Takeshi KOMIYA. * #10279: autodoc: Default values for keyword only arguments in overloaded functions are rendered as a string literal * #10280: autodoc: :confval:`autodoc_docstring_signature` unexpectedly generates