mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '5.0.x' into 5.x
This commit is contained in:
commit
4d7558e968
41
CHANGES
41
CHANGES
@ -19,7 +19,7 @@ Bugs fixed
|
||||
Testing
|
||||
--------
|
||||
|
||||
Release 5.0.2 (in development)
|
||||
Release 5.0.3 (in development)
|
||||
==============================
|
||||
|
||||
Dependencies
|
||||
@ -37,11 +37,29 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #10509: autosummary: autosummary fails with a shared library
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
Release 5.0.2 (released Jun 17, 2022)
|
||||
=====================================
|
||||
|
||||
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
|
||||
----------
|
||||
|
||||
* #10538: autodoc: Inherited class attribute having docstring is documented even
|
||||
if :confval:`autodoc_inherit_docstring` is disabled
|
||||
* #10509: autosummary: autosummary fails with a shared library
|
||||
* #10497: py domain: Failed to resolve strings in Literal. Patch by Adam Turner.
|
||||
* #10523: HTML Theme: Fix double brackets on citation references in Docutils 0.18+.
|
||||
Patch by Adam Turner.
|
||||
* #10534: Missing CSS for nav.contents in Docutils 0.18+. Patch by Adam Turner.
|
||||
|
||||
Release 5.0.1 (released Jun 03, 2022)
|
||||
=====================================
|
||||
|
||||
@ -49,10 +67,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)
|
||||
=====================================
|
||||
@ -93,6 +112,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
|
||||
----------
|
||||
@ -148,11 +168,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
|
||||
----------
|
||||
@ -160,7 +181,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
|
||||
|
4
doc/_themes/sphinx13/static/sphinx13.css
vendored
4
doc/_themes/sphinx13/static/sphinx13.css
vendored
@ -372,7 +372,9 @@ div.quotebar {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
div.topic {
|
||||
nav.contents,
|
||||
div.topic,
|
||||
aside.topic {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
|
@ -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', 2)``.
|
||||
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
|
||||
|
@ -536,6 +536,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
'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,
|
||||
|
@ -396,7 +396,7 @@ class PyXrefMixin:
|
||||
results.append(self.make_xref(rolename, domain, sub_target,
|
||||
innernode, contnode, env, inliner, location))
|
||||
|
||||
if sub_target in ('Literal', 'typing.Literal'):
|
||||
if sub_target in ('Literal', 'typing.Literal', '~typing.Literal'):
|
||||
in_literal = True
|
||||
|
||||
return results
|
||||
|
@ -1670,7 +1670,8 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
|
||||
self.add_line(' ' + _('Bases: %s') % ', '.join(base_classes), sourcename)
|
||||
|
||||
def get_object_members(self, want_all: bool) -> Tuple[bool, ObjectMembers]:
|
||||
members = get_class_members(self.object, self.objpath, self.get_attr)
|
||||
members = get_class_members(self.object, self.objpath, self.get_attr,
|
||||
self.config.autodoc_inherit_docstrings)
|
||||
if not want_all:
|
||||
if not self.options.members:
|
||||
return False, [] # type: ignore
|
||||
|
@ -205,8 +205,8 @@ def get_object_members(subject: Any, objpath: List[str], attrgetter: Callable,
|
||||
return members
|
||||
|
||||
|
||||
def get_class_members(subject: Any, objpath: List[str], attrgetter: Callable
|
||||
) -> Dict[str, "ObjectMember"]:
|
||||
def get_class_members(subject: Any, objpath: List[str], attrgetter: Callable,
|
||||
inherit_docstrings: bool = True) -> Dict[str, "ObjectMember"]:
|
||||
"""Get members and attributes of target class."""
|
||||
from sphinx.ext.autodoc import INSTANCEATTR, ObjectMember
|
||||
|
||||
@ -290,6 +290,11 @@ def get_class_members(subject: Any, objpath: List[str], attrgetter: Callable
|
||||
elif (ns == qualname and docstring and
|
||||
isinstance(members[name], ObjectMember) and
|
||||
not members[name].docstring):
|
||||
if cls != subject and not inherit_docstrings:
|
||||
# If we are in the MRO of the class and not the class itself,
|
||||
# and we do not want to inherit docstrings, then skip setting
|
||||
# the docstring below
|
||||
continue
|
||||
# attribute is already known, because dir(subject) enumerates it.
|
||||
# But it has no docstring yet
|
||||
members[name].docstring = '\n'.join(docstring)
|
||||
|
@ -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,
|
||||
@ -335,13 +337,21 @@ p.sidebar-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.admonition, div.topic, aside.topic, blockquote {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.admonition, div.topic, blockquote {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px;
|
||||
margin: 10px 0 10px 0;
|
||||
@ -379,16 +389,22 @@ div.body p.centered {
|
||||
|
||||
div.sidebar > :last-child,
|
||||
aside.sidebar > :last-child,
|
||||
div.topic > :last-child,
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents > :last-child,
|
||||
aside.topic > :last-child,
|
||||
{% endif %}
|
||||
div.topic > :last-child,
|
||||
div.admonition > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div.sidebar::after,
|
||||
aside.sidebar::after,
|
||||
div.topic::after,
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents::after,
|
||||
aside.topic::after,
|
||||
{% endif %}
|
||||
div.topic::after,
|
||||
div.admonition::after,
|
||||
blockquote::after {
|
||||
display: block;
|
||||
|
@ -306,7 +306,11 @@ div.quotebar {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,11 @@ div.seealso {
|
||||
border: 1px solid #ff6;
|
||||
}
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,11 @@ p.sidebar-title {
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px 7px 0 7px;
|
||||
margin: 10px 0 10px 0;
|
||||
|
@ -194,7 +194,11 @@ div.seealso {
|
||||
border: 1px solid #ff6;
|
||||
}
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,11 @@ p.sidebar-title {
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px 7px 0 7px;
|
||||
margin: 10px 0 10px 0;
|
@ -254,7 +254,11 @@ div.seealso {
|
||||
border: 1px solid #ff6;
|
||||
}
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
@ -245,7 +245,11 @@ div.seealso {
|
||||
padding: 10px 20px 10px 60px;
|
||||
}
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background: #eeeeee;
|
||||
border: 2px solid #C6C9CB;
|
||||
padding: 10px 20px;
|
||||
|
@ -266,7 +266,11 @@ div.quotebar {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,11 @@ p.rubric {
|
||||
|
||||
/* "Topics" */
|
||||
|
||||
div.topic, aside.topic {
|
||||
{%- if docutils_version_info[:2] >= (0, 18) %}
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
{% endif %}
|
||||
div.topic {
|
||||
background-color: #eee;
|
||||
border: 1px solid #ccc;
|
||||
padding: 0 7px 0 7px;
|
||||
|
@ -1,4 +1,7 @@
|
||||
class Base(object):
|
||||
#: docstring
|
||||
inheritedattr = None
|
||||
|
||||
def inheritedmeth(self):
|
||||
"""Inherited function."""
|
||||
|
||||
|
@ -549,6 +549,7 @@ def test_autodoc_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
' .. py:method:: Base.inheritedmeth()',
|
||||
' .. py:method:: Base.inheritedstaticmeth(cls)'
|
||||
@ -569,6 +570,7 @@ def test_autodoc_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
' .. py:method:: Base.inheritedmeth()',
|
||||
' .. py:method:: Base.inheritedstaticmeth(cls)'
|
||||
@ -601,6 +603,7 @@ def test_autodoc_exclude_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()'
|
||||
]
|
||||
|
||||
@ -618,6 +621,7 @@ def test_autodoc_exclude_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()'
|
||||
]
|
||||
|
||||
@ -628,6 +632,7 @@ def test_autodoc_exclude_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
' .. py:method:: Base.inheritedstaticmeth(cls)'
|
||||
]
|
||||
@ -639,6 +644,7 @@ def test_autodoc_exclude_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
]
|
||||
|
||||
@ -648,6 +654,7 @@ def test_autodoc_exclude_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
]
|
||||
|
||||
@ -658,6 +665,7 @@ def test_autodoc_exclude_members(app):
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Base', options)
|
||||
assert list(filter(lambda l: '::' in l, actual)) == [
|
||||
'.. py:class:: Base()',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
' .. py:method:: Base.inheritedmeth()',
|
||||
' .. py:method:: Base.inheritedstaticmeth(cls)'
|
||||
|
@ -133,6 +133,13 @@ def test_automodule_inherited_members(app):
|
||||
' :module: target.inheritance',
|
||||
'',
|
||||
'',
|
||||
' .. py:attribute:: Base.inheritedattr',
|
||||
' :module: target.inheritance',
|
||||
' :value: None',
|
||||
'',
|
||||
' docstring',
|
||||
'',
|
||||
'',
|
||||
' .. py:method:: Base.inheritedclassmeth()',
|
||||
' :module: target.inheritance',
|
||||
' :classmethod:',
|
||||
|
@ -277,6 +277,72 @@ def test_autodoc_inherit_docstrings(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||
def test_autodoc_inherit_docstrings_for_inherited_members(app):
|
||||
options = {"members": None,
|
||||
"inherited-members": None}
|
||||
|
||||
assert app.config.autodoc_inherit_docstrings is True # default
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Derived', options)
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:class:: Derived()',
|
||||
' :module: target.inheritance',
|
||||
'',
|
||||
'',
|
||||
' .. py:attribute:: Derived.inheritedattr',
|
||||
' :module: target.inheritance',
|
||||
' :value: None',
|
||||
'',
|
||||
' docstring',
|
||||
'',
|
||||
'',
|
||||
' .. py:method:: Derived.inheritedclassmeth()',
|
||||
' :module: target.inheritance',
|
||||
' :classmethod:',
|
||||
'',
|
||||
' Inherited class method.',
|
||||
'',
|
||||
'',
|
||||
' .. py:method:: Derived.inheritedmeth()',
|
||||
' :module: target.inheritance',
|
||||
'',
|
||||
' Inherited function.',
|
||||
'',
|
||||
'',
|
||||
' .. py:method:: Derived.inheritedstaticmeth(cls)',
|
||||
' :module: target.inheritance',
|
||||
' :staticmethod:',
|
||||
'',
|
||||
' Inherited static method.',
|
||||
'',
|
||||
]
|
||||
|
||||
# disable autodoc_inherit_docstrings
|
||||
app.config.autodoc_inherit_docstrings = False
|
||||
actual = do_autodoc(app, 'class', 'target.inheritance.Derived', options)
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:class:: Derived()',
|
||||
' :module: target.inheritance',
|
||||
'',
|
||||
'',
|
||||
' .. py:method:: Derived.inheritedclassmeth()',
|
||||
' :module: target.inheritance',
|
||||
' :classmethod:',
|
||||
'',
|
||||
' Inherited class method.',
|
||||
'',
|
||||
'',
|
||||
' .. py:method:: Derived.inheritedstaticmeth(cls)',
|
||||
' :module: target.inheritance',
|
||||
' :staticmethod:',
|
||||
'',
|
||||
' Inherited static method.',
|
||||
'',
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||
def test_autodoc_docstring_signature(app):
|
||||
options = {"members": None, "special-members": "__init__, __new__"}
|
||||
|
Loading…
Reference in New Issue
Block a user