diff --git a/CHANGES b/CHANGES index b210eaff7..06f732b8c 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,8 @@ Dependencies Incompatible changes -------------------- +* #7477: imgconverter: Invoke "magick convert" command by default on Windows + Deprecated ---------- @@ -53,6 +55,13 @@ Features added * C, added scope control directives, :rst:dir:`c:namespace`, :rst:dir:`c:namespace-push`, and :rst:dir:`c:namespace-pop`. * #7466: autosummary: headings in generated documents are not translated +* #7481: html theme: Add right margin to footnote/citation labels +* #7482: html theme: CSS spacing for code blocks with captions and line numbers +* #7443: html theme: Add new options :confval:`globaltoc_collapse` and + :confval:`globaltoc_includehidden` to control the behavior of globaltoc in + sidebar +* #7484: html theme: Avoid clashes between sidebar and other blocks +* #7476: html theme: Relbar breadcrumb should contain current page Bugs fixed ---------- @@ -83,6 +92,7 @@ Bugs fixed * #7461: py domain: fails with IndexError for empty tuple in type annotation * #7461: autodoc: empty tuple in type annotation is not shown correctly +* C++, fix spacing issue in east-const declarations. Testing -------- diff --git a/doc/_themes/sphinx13/layout.html b/doc/_themes/sphinx13/layout.html index 8d1b04a14..e3bb37dce 100644 --- a/doc/_themes/sphinx13/layout.html +++ b/doc/_themes/sphinx13/layout.html @@ -13,11 +13,6 @@ {% block sidebar1 %}{{ sidebar() }}{% endblock %} {% block sidebar2 %}{% endblock %} -{% block linktags %} -{{ super() }} - -{% endblock %} - {% block extrahead %} diff --git a/doc/conf.py b/doc/conf.py index 77d2a577a..681fdc449 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -27,6 +27,7 @@ html_static_path = ['_static'] html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html']} html_additional_pages = {'index': 'index.html'} html_use_opensearch = 'http://sphinx-doc.org' +html_baseurl = 'https://www.sphinx-doc.org/en/master/' htmlhelp_basename = 'Sphinxdoc' diff --git a/doc/usage/extensions/imgconverter.rst b/doc/usage/extensions/imgconverter.rst index 5799fc3b3..9c742d059 100644 --- a/doc/usage/extensions/imgconverter.rst +++ b/doc/usage/extensions/imgconverter.rst @@ -34,7 +34,19 @@ Configuration A path to :command:`convert` command. By default, the imgconverter uses the command from search paths. + On windows platform, :command:`magick` command is used by default. + + .. versionchanged:: 3.1 + + Use :command:`magick` command by default on windows + .. confval:: image_converter_args Additional command-line arguments to give to :command:`convert`, as a list. The default is an empty list ``[]``. + + On windows platform, it defaults to ``["convert"]``. + + .. versionchanged:: 3.1 + + Use ``["convert"]`` by default on windows diff --git a/doc/usage/theming.rst b/doc/usage/theming.rst index 5ed9f1f1b..0aae78718 100644 --- a/doc/usage/theming.rst +++ b/doc/usage/theming.rst @@ -155,6 +155,21 @@ These themes are: previous/next page using the keyboard's left and right arrows. Defaults to ``False``. + - **globaltoc_collapse** (true or false): Only expand subsections + of the current document in ``globaltoc.html`` + (see :confval:`html_sidebars`). + Defaults to ``True``. + + .. versionadded:: 3.1 + + - **globaltoc_includehidden** (true or false): Show even those + subsections in ``globaltoc.html`` (see :confval:`html_sidebars`) + which have been included with the ``:hidden:`` flag of the + :rst:dir:`toctree` directive. + Defaults to ``False``. + + .. versionadded:: 3.1 + **alabaster** `Alabaster theme`_ is a modified "Kr" Sphinx theme from @kennethreitz (especially as used in his Requests project), which was itself originally diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index e09a56b06..7915f4128 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -2062,12 +2062,15 @@ class ASTDeclSpecs(ASTBase): if self.trailingTypeSpec: if addSpace: signode += nodes.Text(' ') + numChildren = len(signode) self.trailingTypeSpec.describe_signature(signode, mode, env, symbol=symbol) - numChildren = len(signode) - self.rightSpecs.describe_signature(signode) - if len(signode) != numChildren: - signode += nodes.Text(' ') + addSpace = len(signode) != numChildren + + if len(str(self.rightSpecs)) > 0: + if addSpace: + signode += nodes.Text(' ') + self.rightSpecs.describe_signature(signode) # Declarator diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index f62b0c1a8..a0d1f6e32 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1754,9 +1754,8 @@ def setup(app: Sphinx) -> Dict[str, Any]: app.add_autodocumenter(InstanceAttributeDocumenter) app.add_autodocumenter(SlotsAttributeDocumenter) - app.add_config_value('autoclass_content', 'class', True) + app.add_config_value('autoclass_content', 'class', True, ENUM('both', 'class', 'init')) app.add_config_value('autodoc_member_order', 'alphabetic', True) - app.add_config_value('autodoc_default_flags', [], True) app.add_config_value('autodoc_default_options', {}, True) app.add_config_value('autodoc_docstring_signature', True, True) app.add_config_value('autodoc_mock_imports', [], True) diff --git a/sphinx/ext/imgconverter.py b/sphinx/ext/imgconverter.py index 3af93b642..bf4b9b9d1 100644 --- a/sphinx/ext/imgconverter.py +++ b/sphinx/ext/imgconverter.py @@ -9,6 +9,7 @@ """ import subprocess +import sys from subprocess import CalledProcessError, PIPE from typing import Any, Dict @@ -74,8 +75,17 @@ class ImagemagickConverter(ImageConverter): def setup(app: Sphinx) -> Dict[str, Any]: app.add_post_transform(ImagemagickConverter) - app.add_config_value('image_converter', 'convert', 'env') - app.add_config_value('image_converter_args', [], 'env') + if sys.platform == 'win32': + # On Windows, we use Imagemagik v7 by default to avoid the trouble for + # convert.exe bundled with Windows. + app.add_config_value('image_converter', 'magick', 'env') + app.add_config_value('image_converter_args', ['convert'], 'env') + else: + # On other platform, we use Imagemagick v6 by default. Especially, + # Debian/Ubuntu are still based of v6. So we can't use "magick" command + # for these platforms. + app.add_config_value('image_converter', 'convert', 'env') + app.add_config_value('image_converter_args', [], 'env') return { 'version': 'builtin', diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py index fb2a7152d..c885db494 100644 --- a/sphinx/pycode/ast.py +++ b/sphinx/pycode/ast.py @@ -9,7 +9,7 @@ """ import sys -from typing import Dict, List, Type +from typing import Dict, List, Type, Optional if sys.version_info > (3, 8): import ast @@ -125,6 +125,17 @@ def unparse(node: ast.AST) -> str: raise NotImplementedError('Unable to parse %s object' % type(node).__name__) +def _unparse_arg(arg: ast.arg, default: Optional[ast.AST]) -> str: + """Unparse a single argument to a string.""" + name = unparse(arg) + if default: + if arg.annotation: + name += " = %s" % unparse(default) + else: + name += "=%s" % unparse(default) + return name + + def unparse_arguments(node: ast.arguments) -> str: """Unparse an arguments to string.""" defaults = list(node.defaults) @@ -143,25 +154,13 @@ def unparse_arguments(node: ast.arguments) -> str: args = [] # type: List[str] if hasattr(node, "posonlyargs"): # for py38+ for i, arg in enumerate(node.posonlyargs): # type: ignore - name = unparse(arg) - if defaults[i]: - if arg.annotation: - name += " = %s" % unparse(defaults[i]) - else: - name += "=%s" % unparse(defaults[i]) - args.append(name) + args.append(_unparse_arg(arg, defaults[i])) if node.posonlyargs: # type: ignore args.append('/') for i, arg in enumerate(node.args): - name = unparse(arg) - if defaults[i + posonlyargs]: - if arg.annotation: - name += " = %s" % unparse(defaults[i + posonlyargs]) - else: - name += "=%s" % unparse(defaults[i + posonlyargs]) - args.append(name) + args.append(_unparse_arg(arg, defaults[i + posonlyargs])) if node.vararg: args.append("*" + unparse(node.vararg)) @@ -169,13 +168,7 @@ def unparse_arguments(node: ast.arguments) -> str: if node.kwonlyargs and not node.vararg: args.append('*') for i, arg in enumerate(node.kwonlyargs): - name = unparse(arg) - if kw_defaults[i]: - if arg.annotation: - name += " = %s" % unparse(kw_defaults[i]) - else: - name += "=%s" % unparse(kw_defaults[i]) - args.append(name) + args.append(_unparse_arg(arg, kw_defaults[i])) if node.kwarg: args.append("**" + unparse(node.kwarg)) diff --git a/sphinx/themes/basic/globaltoc.html b/sphinx/themes/basic/globaltoc.html index 59cab989b..2f16655cf 100644 --- a/sphinx/themes/basic/globaltoc.html +++ b/sphinx/themes/basic/globaltoc.html @@ -8,4 +8,4 @@ :license: BSD, see LICENSE for details. #}