Skip to content

Commit 080bb71

Browse files
committed
Merge branch '4.x'
2 parents 1f77be7 + 6472fb9 commit 080bb71

File tree

143 files changed

+6404
-6313
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+6404
-6313
lines changed

CHANGES

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ Incompatible changes
4949
Deprecated
5050
----------
5151

52+
* ``sphinx.writers.html.HTMLTranslator._fieldlist_row_index``
53+
* ``sphinx.writers.html.HTMLTranslator._table_row_index``
54+
* ``sphinx.writers.html5.HTML5Translator._fieldlist_row_index``
55+
* ``sphinx.writers.html5.HTML5Translator._table_row_index``
56+
5257
Features added
5358
--------------
5459

@@ -60,6 +65,8 @@ Features added
6065
* C++, added new info-field ``retval`` for :rst:dir:`cpp:function`.
6166
* #9672: More CSS classes on Python domain descriptions
6267
* #9695: More CSS classes on Javascript domain descriptions
68+
* #9683: Revert the removal of ``add_stylesheet()`` API. It will be kept until
69+
the Sphinx-6.0 release
6370

6471
Bugs fixed
6572
----------
@@ -77,9 +84,14 @@ Bugs fixed
7784
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
7885
is not 'py'
7986
* #9670: html: Fix download file with special characters
87+
* #9710: html: Wrong styles for even/odd rows in nested tables
8088
* #9649: HTML search: when objects have the same name but in different domains,
8189
return all of them as result instead of just one.
8290
* #9678: linkcheck: file extension was shown twice in warnings
91+
* #9697: py domain: An index entry with parens was registered for ``py:method``
92+
directive with ``:property:`` option
93+
* #9708: needs_extension failed to check double-digit version correctly
94+
* #9688: Fix :rst:dir:`code`` does not recognize ``:class:`` option
8395

8496
Testing
8597
--------

doc/extdev/deprecated.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ The following is a list of deprecated interfaces.
2222
- (will be) Removed
2323
- Alternatives
2424

25+
* - ``sphinx.writers.html.HTMLTranslator._fieldlist_row_index``
26+
- 4.3
27+
- 6.0
28+
- ``sphinx.writers.html.HTMLTranslator._fieldlist_row_indices``
29+
30+
* - ``sphinx.writers.html.HTMLTranslator._table_row_index``
31+
- 4.3
32+
- 6.0
33+
- ``sphinx.writers.html.HTMLTranslator._table_row_indices``
34+
35+
* - ``sphinx.writers.html5.HTML5Translator._fieldlist_row_index``
36+
- 4.3
37+
- 6.0
38+
- ``sphinx.writers.html5.HTML5Translator._fieldlist_row_indices``
39+
40+
* - ``sphinx.writers.html5.HTML5Translator._table_row_index``
41+
- 4.3
42+
- 6.0
43+
- ``sphinx.writers.html5.HTML5Translator._table_row_indices``
44+
2545
* - The optional argument ``app`` for ``sphinx.environment.BuildEnvironment``
2646
- 4.1
2747
- 6.0
@@ -1212,7 +1232,7 @@ The following is a list of deprecated interfaces.
12121232

12131233
* - :meth:`~sphinx.application.Sphinx.add_stylesheet()`
12141234
- 1.8
1215-
- 4.0
1235+
- 6.0
12161236
- :meth:`~sphinx.application.Sphinx.add_css_file()`
12171237

12181238
* - :meth:`~sphinx.application.Sphinx.add_javascript()`

doc/usage/extensions/intersphinx.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ searching for the root cause of a broken Intersphinx link in a documentation
158158
project. The following example prints the Intersphinx mapping of the Python 3
159159
documentation::
160160

161-
$ python -msphinx.ext.intersphinx https://docs.python.org/3/objects.inv
161+
$ python -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv
162162

163163
Using Intersphinx with inventory file under Basic Authorization
164164
---------------------------------------------------------------

doc/usage/restructuredtext/basics.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,27 @@ following the arguments and indicated by the colons). Options must be indented
410410
to the same level as the directive content.
411411

412412
The directive content follows after a blank line and is indented relative to
413-
the directive start.
413+
the directive start or if options are present, by the same amount as the
414+
options.
415+
416+
Be careful as the indent is not a fixed number of whitespace, e.g. three, but
417+
any number whitespace. This can be surprising when a fixed indent is used
418+
throughout the document and can make a difference for directives which are
419+
sensitive to whitespace. Compare::
420+
421+
.. code-block::
422+
:caption: A cool example
423+
424+
The output of this line starts with four spaces.
425+
426+
.. code-block::
427+
428+
The output of this line has no spaces at the beginning.
429+
430+
In the first code block, the indent for the content was fixated by the option
431+
line to three spaces, consequently the content starts with four spaces.
432+
In the latter the indent was fixed by the content itself to seven spaces, thus
433+
it does not start with a space.
414434

415435

416436
Images

sphinx/addnodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from docutils import nodes
1414
from docutils.nodes import Element
1515

16-
from sphinx.util import docutils
17-
1816
if TYPE_CHECKING:
1917
from sphinx.application import Sphinx
2018

@@ -530,6 +528,8 @@ class manpage(nodes.Inline, nodes.FixedTextElement):
530528

531529

532530
def setup(app: "Sphinx") -> Dict[str, Any]:
531+
from sphinx.util import docutils # lazy import
532+
533533
app.add_node(toctree)
534534

535535
app.add_node(desc)

sphinx/application.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,26 @@ def add_css_file(self, filename: str, priority: int = 500, **kwargs: Any) -> Non
10461046
if hasattr(self.builder, 'add_css_file'):
10471047
self.builder.add_css_file(filename, priority=priority, **kwargs) # type: ignore
10481048

1049+
def add_stylesheet(self, filename: str, alternate: bool = False, title: str = None
1050+
) -> None:
1051+
"""An alias of :meth:`add_css_file`.
1052+
1053+
.. deprecated:: 1.8
1054+
"""
1055+
logger.warning('The app.add_stylesheet() is deprecated. '
1056+
'Please use app.add_css_file() instead.')
1057+
1058+
attributes = {} # type: Dict[str, Any]
1059+
if alternate:
1060+
attributes['rel'] = 'alternate stylesheet'
1061+
else:
1062+
attributes['rel'] = 'stylesheet'
1063+
1064+
if title:
1065+
attributes['title'] = title
1066+
1067+
self.add_css_file(filename, **attributes)
1068+
10491069
def add_latex_package(self, packagename: str, options: str = None,
10501070
after_hyperref: bool = False) -> None:
10511071
r"""Register a package to include in the LaTeX source code.

sphinx/directives/patches.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from docutils.nodes import Node, make_id, system_message
1616
from docutils.parsers.rst import directives
1717
from docutils.parsers.rst.directives import images, tables
18+
from docutils.parsers.rst.roles import set_classes
1819

1920
from sphinx import addnodes
2021
from sphinx.deprecation import RemovedInSphinx60Warning
@@ -161,6 +162,7 @@ class Code(SphinxDirective):
161162
def run(self) -> List[Node]:
162163
self.assert_has_content()
163164

165+
set_classes(self.options)
164166
code = '\n'.join(self.content)
165167
node = nodes.literal_block(code, code,
166168
classes=self.options.get('classes', []),

sphinx/domains/python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ def get_index_text(self, modname: str, name_cls: Tuple[str, str]) -> str:
796796
if 'classmethod' in self.options:
797797
return _('%s() (%s class method)') % (methname, clsname)
798798
elif 'property' in self.options:
799-
return _('%s() (%s property)') % (methname, clsname)
799+
return _('%s (%s property)') % (methname, clsname)
800800
elif 'staticmethod' in self.options:
801801
return _('%s() (%s static method)') % (methname, clsname)
802802
else:

sphinx/extension.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
from typing import TYPE_CHECKING, Any, Dict
1212

13+
from packaging.version import InvalidVersion, Version
14+
1315
from sphinx.config import Config
1416
from sphinx.errors import VersionRequirementError
1517
from sphinx.locale import __
@@ -51,7 +53,18 @@ def verify_needs_extensions(app: "Sphinx", config: Config) -> None:
5153
'but it is not loaded.'), extname)
5254
continue
5355

54-
if extension.version == 'unknown version' or reqversion > extension.version:
56+
fulfilled = True
57+
if extension.version == 'unknown version':
58+
fulfilled = False
59+
else:
60+
try:
61+
if Version(reqversion) > Version(extension.version):
62+
fulfilled = False
63+
except InvalidVersion:
64+
if reqversion > extension.version:
65+
fulfilled = False
66+
67+
if not fulfilled:
5568
raise VersionRequirementError(__('This project needs the extension %s at least in '
5669
'version %s and therefore cannot be built with '
5770
'the loaded version (%s).') %
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)