Sphinx 7.1.2__py3-none-any.whl → 7.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Sphinx might be problematic. Click here for more details.
- sphinx/__init__.py +6 -6
- sphinx/__main__.py +3 -1
- sphinx/addnodes.py +35 -22
- sphinx/application.py +40 -38
- sphinx/builders/__init__.py +16 -12
- sphinx/builders/_epub_base.py +15 -11
- sphinx/builders/changes.py +6 -4
- sphinx/builders/dirhtml.py +4 -2
- sphinx/builders/dummy.py +6 -4
- sphinx/builders/epub3.py +16 -8
- sphinx/builders/gettext.py +40 -43
- sphinx/builders/html/__init__.py +166 -196
- sphinx/builders/html/_assets.py +116 -0
- sphinx/builders/html/transforms.py +4 -2
- sphinx/builders/latex/__init__.py +12 -7
- sphinx/builders/latex/theming.py +5 -2
- sphinx/builders/latex/transforms.py +6 -3
- sphinx/builders/linkcheck.py +18 -11
- sphinx/builders/manpage.py +6 -4
- sphinx/builders/singlehtml.py +16 -9
- sphinx/builders/texinfo.py +11 -6
- sphinx/builders/text.py +8 -3
- sphinx/builders/xml.py +9 -4
- sphinx/cmd/build.py +27 -14
- sphinx/cmd/make_mode.py +13 -4
- sphinx/cmd/quickstart.py +13 -4
- sphinx/config.py +17 -14
- sphinx/deprecation.py +4 -2
- sphinx/directives/__init__.py +44 -12
- sphinx/directives/code.py +5 -4
- sphinx/directives/other.py +92 -44
- sphinx/directives/patches.py +1 -1
- sphinx/domains/__init__.py +11 -8
- sphinx/domains/c.py +67 -57
- sphinx/domains/changeset.py +3 -2
- sphinx/domains/citation.py +2 -1
- sphinx/domains/cpp.py +136 -93
- sphinx/domains/index.py +9 -5
- sphinx/domains/javascript.py +32 -19
- sphinx/domains/math.py +5 -3
- sphinx/domains/python.py +69 -57
- sphinx/domains/rst.py +20 -11
- sphinx/domains/std.py +21 -15
- sphinx/environment/__init__.py +97 -65
- sphinx/environment/adapters/indexentries.py +13 -10
- sphinx/environment/adapters/toctree.py +485 -308
- sphinx/environment/collectors/__init__.py +3 -4
- sphinx/environment/collectors/asset.py +10 -4
- sphinx/environment/collectors/dependencies.py +7 -4
- sphinx/environment/collectors/metadata.py +7 -5
- sphinx/environment/collectors/title.py +5 -3
- sphinx/environment/collectors/toctree.py +13 -8
- sphinx/errors.py +1 -1
- sphinx/events.py +5 -5
- sphinx/ext/apidoc.py +49 -27
- sphinx/ext/autodoc/__init__.py +179 -161
- sphinx/ext/autodoc/directive.py +10 -6
- sphinx/ext/autodoc/importer.py +22 -13
- sphinx/ext/autodoc/mock.py +4 -1
- sphinx/ext/autodoc/preserve_defaults.py +80 -12
- sphinx/ext/autodoc/type_comment.py +14 -10
- sphinx/ext/autodoc/typehints.py +7 -3
- sphinx/ext/autosectionlabel.py +6 -3
- sphinx/ext/autosummary/__init__.py +21 -15
- sphinx/ext/autosummary/generate.py +176 -126
- sphinx/ext/coverage.py +93 -8
- sphinx/ext/doctest.py +28 -17
- sphinx/ext/duration.py +19 -17
- sphinx/ext/extlinks.py +11 -6
- sphinx/ext/githubpages.py +8 -7
- sphinx/ext/graphviz.py +61 -17
- sphinx/ext/ifconfig.py +7 -4
- sphinx/ext/imgconverter.py +4 -2
- sphinx/ext/imgmath.py +29 -23
- sphinx/ext/inheritance_diagram.py +41 -27
- sphinx/ext/intersphinx.py +45 -38
- sphinx/ext/linkcode.py +8 -5
- sphinx/ext/mathjax.py +13 -9
- sphinx/ext/napoleon/__init__.py +3 -3
- sphinx/ext/napoleon/docstring.py +40 -31
- sphinx/ext/todo.py +10 -7
- sphinx/ext/viewcode.py +46 -25
- sphinx/extension.py +1 -1
- sphinx/highlighting.py +20 -12
- sphinx/io.py +5 -4
- sphinx/jinja2glue.py +24 -19
- sphinx/locale/__init__.py +8 -2
- sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ar/LC_MESSAGES/sphinx.po +756 -740
- sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bg/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bn/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ca/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cak/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cs/LC_MESSAGES/sphinx.po +758 -742
- sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cy/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/da/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/el/LC_MESSAGES/sphinx.po +763 -747
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eo/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/et/LC_MESSAGES/sphinx.po +762 -746
- sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eu/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fa/LC_MESSAGES/sphinx.po +766 -750
- sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fi/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/gl/LC_MESSAGES/sphinx.js +60 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.po +3695 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi/LC_MESSAGES/sphinx.po +763 -747
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hr/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hu/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/id/LC_MESSAGES/sphinx.po +765 -749
- sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/is/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/it/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ja/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ka/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ko/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lt/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lv/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/mk/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ne/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nl/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pl/LC_MESSAGES/sphinx.po +762 -745
- sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ro/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ru/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/si/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sk/LC_MESSAGES/sphinx.po +765 -749
- sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sl/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/sphinx.pot +748 -740
- sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sq/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr@latin/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr_RS/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sv/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ta/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ta/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/te/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/tr/LC_MESSAGES/sphinx.po +763 -747
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +760 -749
- sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ur/LC_MESSAGES/sphinx.po +759 -748
- sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/vi/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/yue/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +754 -738
- sphinx/parsers.py +5 -4
- sphinx/project.py +52 -34
- sphinx/pycode/__init__.py +2 -1
- sphinx/pycode/ast.py +7 -13
- sphinx/pycode/parser.py +42 -38
- sphinx/registry.py +35 -29
- sphinx/roles.py +9 -4
- sphinx/search/__init__.py +5 -17
- sphinx/search/da.py +1 -1
- sphinx/search/de.py +1 -1
- sphinx/search/en.py +1 -1
- sphinx/search/es.py +1 -1
- sphinx/search/fi.py +1 -1
- sphinx/search/fr.py +1 -1
- sphinx/search/hu.py +1 -1
- sphinx/search/it.py +1 -1
- sphinx/search/ja.py +1 -1
- sphinx/search/nl.py +1 -1
- sphinx/search/no.py +1 -1
- sphinx/search/pt.py +1 -1
- sphinx/search/ro.py +1 -1
- sphinx/search/ru.py +1 -1
- sphinx/search/sv.py +1 -1
- sphinx/search/tr.py +1 -1
- sphinx/search/zh.py +1 -1
- sphinx/testing/fixtures.py +23 -30
- sphinx/testing/path.py +9 -0
- sphinx/testing/restructuredtext.py +13 -5
- sphinx/testing/util.py +20 -63
- sphinx/texinputs/sphinxlatexobjects.sty +15 -15
- sphinx/themes/agogo/static/agogo.css_t +10 -4
- sphinx/themes/basic/layout.html +1 -1
- sphinx/themes/basic/static/basic.css_t +4 -0
- sphinx/themes/basic/static/documentation_options.js_t +1 -2
- sphinx/themes/basic/static/searchtools.js +17 -9
- sphinx/themes/basic/static/sphinx_highlight.js +13 -3
- sphinx/themes/bizstyle/static/bizstyle.css_t +4 -0
- sphinx/themes/classic/theme.conf +1 -1
- sphinx/themes/epub/static/epub.css_t +6 -1
- sphinx/themes/haiku/theme.conf +1 -1
- sphinx/themes/nature/static/nature.css_t +4 -0
- sphinx/themes/nonav/static/nonav.css_t +6 -1
- sphinx/themes/pyramid/static/pyramid.css_t +4 -0
- sphinx/themes/scrolls/static/scrolls.css_t +4 -0
- sphinx/themes/scrolls/theme.conf +1 -1
- sphinx/themes/sphinxdoc/static/sphinxdoc.css_t +4 -0
- sphinx/theming.py +9 -7
- sphinx/transforms/__init__.py +79 -3
- sphinx/transforms/compact_bullet_list.py +6 -3
- sphinx/transforms/i18n.py +26 -10
- sphinx/transforms/post_transforms/__init__.py +21 -8
- sphinx/transforms/post_transforms/code.py +6 -3
- sphinx/transforms/post_transforms/images.py +13 -9
- sphinx/util/__init__.py +21 -92
- sphinx/util/cfamily.py +7 -4
- sphinx/util/display.py +3 -2
- sphinx/util/docfields.py +7 -6
- sphinx/util/docstrings.py +1 -1
- sphinx/util/docutils.py +41 -31
- sphinx/util/fileutil.py +9 -6
- sphinx/util/i18n.py +21 -18
- sphinx/util/images.py +2 -1
- sphinx/util/index_entries.py +27 -0
- sphinx/util/inspect.py +83 -67
- sphinx/util/inventory.py +4 -2
- sphinx/util/logging.py +9 -6
- sphinx/util/matching.py +5 -2
- sphinx/util/math.py +6 -3
- sphinx/util/nodes.py +70 -31
- sphinx/util/osutil.py +22 -40
- sphinx/util/parallel.py +4 -1
- sphinx/util/rst.py +7 -3
- sphinx/util/tags.py +11 -4
- sphinx/util/template.py +17 -14
- sphinx/util/typing.py +61 -20
- sphinx/versioning.py +6 -4
- sphinx/writers/html.py +1 -1
- sphinx/writers/html5.py +32 -24
- sphinx/writers/latex.py +67 -53
- sphinx/writers/manpage.py +9 -5
- sphinx/writers/texinfo.py +11 -9
- sphinx/writers/text.py +14 -9
- sphinx/writers/xml.py +3 -2
- {sphinx-7.1.2.dist-info → sphinx-7.2.0.dist-info}/METADATA +7 -5
- sphinx-7.2.0.dist-info/RECORD +568 -0
- sphinx/testing/comparer.py +0 -97
- sphinx-7.1.2.dist-info/RECORD +0 -564
- {sphinx-7.1.2.dist-info → sphinx-7.2.0.dist-info}/LICENSE +0 -0
- {sphinx-7.1.2.dist-info → sphinx-7.2.0.dist-info}/WHEEL +0 -0
- {sphinx-7.1.2.dist-info → sphinx-7.2.0.dist-info}/entry_points.txt +0 -0
sphinx/writers/latex.py
CHANGED
|
@@ -8,19 +8,19 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
import re
|
|
10
10
|
from collections import defaultdict
|
|
11
|
+
from collections.abc import Iterable
|
|
11
12
|
from os import path
|
|
12
|
-
from typing import TYPE_CHECKING, Any,
|
|
13
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
13
14
|
|
|
14
15
|
from docutils import nodes, writers
|
|
15
|
-
from docutils.nodes import Element, Node, Text
|
|
16
16
|
|
|
17
17
|
from sphinx import addnodes, highlighting
|
|
18
|
-
from sphinx.domains import IndexEntry
|
|
19
18
|
from sphinx.domains.std import StandardDomain
|
|
20
19
|
from sphinx.errors import SphinxError
|
|
21
20
|
from sphinx.locale import _, __, admonitionlabels
|
|
22
|
-
from sphinx.util import logging,
|
|
21
|
+
from sphinx.util import logging, texescape
|
|
23
22
|
from sphinx.util.docutils import SphinxTranslator
|
|
23
|
+
from sphinx.util.index_entries import split_index_msg
|
|
24
24
|
from sphinx.util.nodes import clean_astext, get_prev_node
|
|
25
25
|
from sphinx.util.template import LaTeXRenderer
|
|
26
26
|
from sphinx.util.texescape import tex_replace_map
|
|
@@ -29,11 +29,14 @@ try:
|
|
|
29
29
|
from docutils.utils.roman import toRoman
|
|
30
30
|
except ImportError:
|
|
31
31
|
# In Debian/Ubuntu, roman package is provided as roman, not as docutils.utils.roman
|
|
32
|
-
from roman import toRoman # type: ignore
|
|
32
|
+
from roman import toRoman # type: ignore[no-redef]
|
|
33
33
|
|
|
34
34
|
if TYPE_CHECKING:
|
|
35
|
+
from docutils.nodes import Element, Node, Text
|
|
36
|
+
|
|
35
37
|
from sphinx.builders.latex import LaTeXBuilder
|
|
36
38
|
from sphinx.builders.latex.theming import Theme
|
|
39
|
+
from sphinx.domains import IndexEntry
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
logger = logging.getLogger(__name__)
|
|
@@ -74,12 +77,11 @@ class LaTeXWriter(writers.Writer):
|
|
|
74
77
|
))
|
|
75
78
|
settings_defaults: dict[str, Any] = {}
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
theme: Theme
|
|
78
81
|
|
|
79
82
|
def __init__(self, builder: LaTeXBuilder) -> None:
|
|
80
83
|
super().__init__()
|
|
81
84
|
self.builder = builder
|
|
82
|
-
self.theme: Theme = None
|
|
83
85
|
|
|
84
86
|
def translate(self) -> None:
|
|
85
87
|
visitor = self.builder.create_translator(self.document, self.builder, self.theme)
|
|
@@ -109,17 +111,18 @@ class Table:
|
|
|
109
111
|
elif 'colorrows' in self.classes:
|
|
110
112
|
self.styles.append('colorrows')
|
|
111
113
|
self.colcount = 0
|
|
112
|
-
self.colspec: str =
|
|
113
|
-
self.colsep: str = None
|
|
114
|
+
self.colspec: str = ''
|
|
114
115
|
if 'booktabs' in self.styles or 'borderless' in self.styles:
|
|
115
|
-
self.colsep = ''
|
|
116
|
+
self.colsep: str | None = ''
|
|
116
117
|
elif 'standard' in self.styles:
|
|
117
118
|
self.colsep = '|'
|
|
119
|
+
else:
|
|
120
|
+
self.colsep = None
|
|
118
121
|
self.colwidths: list[int] = []
|
|
119
122
|
self.has_problematic = False
|
|
120
123
|
self.has_oldproblematic = False
|
|
121
124
|
self.has_verbatim = False
|
|
122
|
-
self.caption: list[str] =
|
|
125
|
+
self.caption: list[str] = []
|
|
123
126
|
self.stubs: list[int] = []
|
|
124
127
|
|
|
125
128
|
# current position
|
|
@@ -168,6 +171,7 @@ class Table:
|
|
|
168
171
|
return self.colspec
|
|
169
172
|
|
|
170
173
|
_colsep = self.colsep
|
|
174
|
+
assert _colsep is not None
|
|
171
175
|
if self.colwidths and 'colwidths-given' in self.classes:
|
|
172
176
|
total = sum(self.colwidths)
|
|
173
177
|
colspecs = [r'\X{%d}{%d}' % (width, total) for width in self.colwidths]
|
|
@@ -659,6 +663,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
659
663
|
def depart_title(self, node: Element) -> None:
|
|
660
664
|
self.in_title = 0
|
|
661
665
|
if isinstance(node.parent, nodes.table):
|
|
666
|
+
assert self.table is not None
|
|
662
667
|
self.table.caption = self.popbody()
|
|
663
668
|
else:
|
|
664
669
|
self.body.append(self.context.pop())
|
|
@@ -991,6 +996,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
991
996
|
|
|
992
997
|
def visit_table(self, node: Element) -> None:
|
|
993
998
|
if len(self.tables) == 1:
|
|
999
|
+
assert self.table is not None
|
|
994
1000
|
if self.table.get_table_type() == 'longtable':
|
|
995
1001
|
raise UnsupportedError(
|
|
996
1002
|
'%s:%s: longtable does not support nesting a table.' %
|
|
@@ -1003,26 +1009,28 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1003
1009
|
'%s:%s: deeply nested tables are not implemented.' %
|
|
1004
1010
|
(self.curfilestack[-1], node.line or ''))
|
|
1005
1011
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
'
|
|
1011
|
-
|
|
1012
|
+
table = Table(node)
|
|
1013
|
+
self.tables.append(table)
|
|
1014
|
+
if table.colsep is None:
|
|
1015
|
+
table.colsep = '|' * (
|
|
1016
|
+
'booktabs' not in self.builder.config.latex_table_style
|
|
1017
|
+
and 'borderless' not in self.builder.config.latex_table_style
|
|
1018
|
+
)
|
|
1012
1019
|
if self.next_table_colspec:
|
|
1013
|
-
|
|
1014
|
-
if '|' in
|
|
1015
|
-
|
|
1016
|
-
|
|
1020
|
+
table.colspec = '{%s}' % self.next_table_colspec + CR
|
|
1021
|
+
if '|' in table.colspec:
|
|
1022
|
+
table.styles.append('vlines')
|
|
1023
|
+
table.colsep = '|'
|
|
1017
1024
|
else:
|
|
1018
|
-
|
|
1019
|
-
|
|
1025
|
+
table.styles.append('novlines')
|
|
1026
|
+
table.colsep = ''
|
|
1020
1027
|
if 'colwidths-given' in node.get('classes', []):
|
|
1021
1028
|
logger.info(__('both tabularcolumns and :widths: option are given. '
|
|
1022
1029
|
':widths: is ignored.'), location=node)
|
|
1023
1030
|
self.next_table_colspec = None
|
|
1024
1031
|
|
|
1025
1032
|
def depart_table(self, node: Element) -> None:
|
|
1033
|
+
assert self.table is not None
|
|
1026
1034
|
labels = self.hypertarget_to(node)
|
|
1027
1035
|
table_type = self.table.get_table_type()
|
|
1028
1036
|
table = self.render(table_type + '.tex_t',
|
|
@@ -1034,6 +1042,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1034
1042
|
self.tables.pop()
|
|
1035
1043
|
|
|
1036
1044
|
def visit_colspec(self, node: Element) -> None:
|
|
1045
|
+
assert self.table is not None
|
|
1037
1046
|
self.table.colcount += 1
|
|
1038
1047
|
if 'colwidth' in node:
|
|
1039
1048
|
self.table.colwidths.append(node['colwidth'])
|
|
@@ -1050,6 +1059,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1050
1059
|
pass
|
|
1051
1060
|
|
|
1052
1061
|
def visit_thead(self, node: Element) -> None:
|
|
1062
|
+
assert self.table is not None
|
|
1053
1063
|
# Redirect head output until header is finished.
|
|
1054
1064
|
self.pushbody(self.table.header)
|
|
1055
1065
|
|
|
@@ -1059,6 +1069,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1059
1069
|
self.popbody()
|
|
1060
1070
|
|
|
1061
1071
|
def visit_tbody(self, node: Element) -> None:
|
|
1072
|
+
assert self.table is not None
|
|
1062
1073
|
# Redirect body output until table is finished.
|
|
1063
1074
|
self.pushbody(self.table.body)
|
|
1064
1075
|
|
|
@@ -1068,6 +1079,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1068
1079
|
self.popbody()
|
|
1069
1080
|
|
|
1070
1081
|
def visit_row(self, node: Element) -> None:
|
|
1082
|
+
assert self.table is not None
|
|
1071
1083
|
self.table.col = 0
|
|
1072
1084
|
_colsep = self.table.colsep
|
|
1073
1085
|
# fill columns if the row starts with the bottom of multirow cell
|
|
@@ -1087,9 +1099,11 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1087
1099
|
(cell.width, _colsep, _colsep, cell.cell_id))
|
|
1088
1100
|
|
|
1089
1101
|
def depart_row(self, node: Element) -> None:
|
|
1102
|
+
assert self.table is not None
|
|
1090
1103
|
self.body.append(r'\\' + CR)
|
|
1091
1104
|
cells = [self.table.cell(self.table.row, i) for i in range(self.table.colcount)]
|
|
1092
|
-
underlined = [cell.row + cell.height == self.table.row + 1
|
|
1105
|
+
underlined = [cell.row + cell.height == self.table.row + 1 # type: ignore[union-attr]
|
|
1106
|
+
for cell in cells]
|
|
1093
1107
|
if all(underlined):
|
|
1094
1108
|
self.body.append(r'\sphinxhline')
|
|
1095
1109
|
else:
|
|
@@ -1098,7 +1112,7 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1098
1112
|
if underlined[0] is False:
|
|
1099
1113
|
i = 1
|
|
1100
1114
|
while i < self.table.colcount and underlined[i] is False:
|
|
1101
|
-
if cells[i - 1].cell_id != cells[i].cell_id:
|
|
1115
|
+
if cells[i - 1].cell_id != cells[i].cell_id: # type: ignore[union-attr]
|
|
1102
1116
|
self.body.append(r'\sphinxvlinecrossing{%d}' % i)
|
|
1103
1117
|
i += 1
|
|
1104
1118
|
while i < self.table.colcount:
|
|
@@ -1108,17 +1122,19 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1108
1122
|
i += j
|
|
1109
1123
|
i += 1
|
|
1110
1124
|
while i < self.table.colcount and underlined[i] is False:
|
|
1111
|
-
if cells[i - 1].cell_id != cells[i].cell_id:
|
|
1125
|
+
if cells[i - 1].cell_id != cells[i].cell_id: # type: ignore[union-attr]
|
|
1112
1126
|
self.body.append(r'\sphinxvlinecrossing{%d}' % i)
|
|
1113
1127
|
i += 1
|
|
1114
1128
|
self.body.append(r'\sphinxfixclines{%d}' % self.table.colcount)
|
|
1115
1129
|
self.table.row += 1
|
|
1116
1130
|
|
|
1117
1131
|
def visit_entry(self, node: Element) -> None:
|
|
1132
|
+
assert self.table is not None
|
|
1118
1133
|
if self.table.col > 0:
|
|
1119
1134
|
self.body.append('&')
|
|
1120
1135
|
self.table.add_cell(node.get('morerows', 0) + 1, node.get('morecols', 0) + 1)
|
|
1121
1136
|
cell = self.table.cell()
|
|
1137
|
+
assert cell is not None
|
|
1122
1138
|
context = ''
|
|
1123
1139
|
_colsep = self.table.colsep
|
|
1124
1140
|
if cell.width > 1:
|
|
@@ -1165,7 +1181,9 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1165
1181
|
|
|
1166
1182
|
self.body.append(self.context.pop())
|
|
1167
1183
|
|
|
1184
|
+
assert self.table is not None
|
|
1168
1185
|
cell = self.table.cell()
|
|
1186
|
+
assert cell is not None
|
|
1169
1187
|
self.table.col += cell.width
|
|
1170
1188
|
_colsep = self.table.colsep
|
|
1171
1189
|
|
|
@@ -1482,8 +1500,9 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1482
1500
|
length = self.latex_image_length(node['width'])
|
|
1483
1501
|
elif isinstance(node[0], nodes.image) and 'width' in node[0]:
|
|
1484
1502
|
length = self.latex_image_length(node[0]['width'])
|
|
1485
|
-
|
|
1486
|
-
|
|
1503
|
+
# Insert a blank line to prevent an infinite loop
|
|
1504
|
+
# https://github.com/sphinx-doc/sphinx/issues/7059
|
|
1505
|
+
self.body.append(BLANKLINE)
|
|
1487
1506
|
self.body.append(r'\begin{wrapfigure}{%s}{%s}' %
|
|
1488
1507
|
('r' if node['align'] == 'right' else 'l', length or '0pt') + CR)
|
|
1489
1508
|
self.body.append(r'\centering')
|
|
@@ -1626,8 +1645,8 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1626
1645
|
if has_dup_label(prev):
|
|
1627
1646
|
ids = node['ids'][:] # copy to avoid side-effects
|
|
1628
1647
|
while has_dup_label(prev):
|
|
1629
|
-
ids.remove(prev['refid']) # type: ignore
|
|
1630
|
-
prev = get_prev_node(prev)
|
|
1648
|
+
ids.remove(prev['refid']) # type: ignore[index]
|
|
1649
|
+
prev = get_prev_node(prev) # type: ignore[arg-type]
|
|
1631
1650
|
else:
|
|
1632
1651
|
ids = iter(node['ids']) # read-only iterator
|
|
1633
1652
|
else:
|
|
@@ -1672,37 +1691,32 @@ class LaTeXTranslator(SphinxTranslator):
|
|
|
1672
1691
|
if ismain:
|
|
1673
1692
|
m = '|spxpagem'
|
|
1674
1693
|
try:
|
|
1694
|
+
parts = tuple(map(escape, split_index_msg(type, string)))
|
|
1695
|
+
styled = tuple(map(style, parts))
|
|
1675
1696
|
if type == 'single':
|
|
1676
1697
|
try:
|
|
1677
|
-
p1, p2 =
|
|
1678
|
-
P1, P2 =
|
|
1698
|
+
p1, p2 = parts
|
|
1699
|
+
P1, P2 = styled
|
|
1679
1700
|
self.body.append(fr'\index{{{p1}@{P1}!{p2}@{P2}{m}}}')
|
|
1680
1701
|
except ValueError:
|
|
1681
|
-
p =
|
|
1682
|
-
P =
|
|
1702
|
+
p, = parts
|
|
1703
|
+
P, = styled
|
|
1683
1704
|
self.body.append(fr'\index{{{p}@{P}{m}}}')
|
|
1684
1705
|
elif type == 'pair':
|
|
1685
|
-
p1, p2 =
|
|
1686
|
-
P1, P2 =
|
|
1687
|
-
self.body.append(
|
|
1688
|
-
|
|
1706
|
+
p1, p2 = parts
|
|
1707
|
+
P1, P2 = styled
|
|
1708
|
+
self.body.append(fr'\index{{{p1}@{P1}!{p2}@{P2}{m}}}'
|
|
1709
|
+
fr'\index{{{p2}@{P2}!{p1}@{P1}{m}}}')
|
|
1689
1710
|
elif type == 'triple':
|
|
1690
|
-
p1, p2, p3 =
|
|
1691
|
-
P1, P2, P3 =
|
|
1711
|
+
p1, p2, p3 = parts
|
|
1712
|
+
P1, P2, P3 = styled
|
|
1692
1713
|
self.body.append(
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
elif type == 'see':
|
|
1700
|
-
p1, p2 = (escape(x) for x in split_into(2, 'see', string))
|
|
1701
|
-
P1 = style(p1)
|
|
1702
|
-
self.body.append(fr'\index{{{p1}@{P1}|see{{{p2}}}}}')
|
|
1703
|
-
elif type == 'seealso':
|
|
1704
|
-
p1, p2 = (escape(x) for x in split_into(2, 'seealso', string))
|
|
1705
|
-
P1 = style(p1)
|
|
1714
|
+
fr'\index{{{p1}@{P1}!{p2} {p3}@{P2} {P3}{m}}}'
|
|
1715
|
+
fr'\index{{{p2}@{P2}!{p3}, {p1}@{P3}, {P1}{m}}}'
|
|
1716
|
+
fr'\index{{{p3}@{P3}!{p1} {p2}@{P1} {P2}{m}}}')
|
|
1717
|
+
elif type in {'see', 'seealso'}:
|
|
1718
|
+
p1, p2 = parts
|
|
1719
|
+
P1, _P2 = styled
|
|
1706
1720
|
self.body.append(fr'\index{{{p1}@{P1}|see{{{p2}}}}}')
|
|
1707
1721
|
else:
|
|
1708
1722
|
logger.warning(__('unknown index entry type %s found'), type)
|
sphinx/writers/manpage.py
CHANGED
|
@@ -2,21 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from collections.abc import Iterable
|
|
6
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
6
7
|
|
|
7
8
|
from docutils import nodes
|
|
8
|
-
from docutils.nodes import Element
|
|
9
9
|
from docutils.writers.manpage import Translator as BaseTranslator
|
|
10
10
|
from docutils.writers.manpage import Writer
|
|
11
11
|
|
|
12
12
|
from sphinx import addnodes
|
|
13
|
-
from sphinx.builders import Builder
|
|
14
13
|
from sphinx.locale import _, admonitionlabels
|
|
15
14
|
from sphinx.util import logging
|
|
16
15
|
from sphinx.util.docutils import SphinxTranslator
|
|
17
16
|
from sphinx.util.i18n import format_date
|
|
18
17
|
from sphinx.util.nodes import NodeMatcher
|
|
19
18
|
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from docutils.nodes import Element
|
|
21
|
+
|
|
22
|
+
from sphinx.builders import Builder
|
|
23
|
+
|
|
20
24
|
logger = logging.getLogger(__name__)
|
|
21
25
|
|
|
22
26
|
|
|
@@ -240,7 +244,7 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator):
|
|
|
240
244
|
super().visit_term(node)
|
|
241
245
|
|
|
242
246
|
# overwritten -- we don't want source comments to show up
|
|
243
|
-
def visit_comment(self, node: Element) -> None: # type: ignore
|
|
247
|
+
def visit_comment(self, node: Element) -> None: # type: ignore[override]
|
|
244
248
|
raise nodes.SkipNode
|
|
245
249
|
|
|
246
250
|
# overwritten -- added ensure_eol()
|
|
@@ -308,7 +312,7 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator):
|
|
|
308
312
|
self.body.append(self.defs['reference'][0])
|
|
309
313
|
# avoid repeating escaping code... fine since
|
|
310
314
|
# visit_Text calls astext() and only works on that afterwards
|
|
311
|
-
self.visit_Text(node) # type: ignore
|
|
315
|
+
self.visit_Text(node) # type: ignore[arg-type]
|
|
312
316
|
self.body.append(self.defs['reference'][1])
|
|
313
317
|
|
|
314
318
|
uri = node.get('refuri', '')
|
sphinx/writers/texinfo.py
CHANGED
|
@@ -4,14 +4,13 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import re
|
|
6
6
|
import textwrap
|
|
7
|
+
from collections.abc import Iterable, Iterator
|
|
7
8
|
from os import path
|
|
8
|
-
from typing import TYPE_CHECKING, Any,
|
|
9
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
9
10
|
|
|
10
11
|
from docutils import nodes, writers
|
|
11
|
-
from docutils.nodes import Element, Node, Text
|
|
12
12
|
|
|
13
13
|
from sphinx import __display_version__, addnodes
|
|
14
|
-
from sphinx.domains import IndexEntry
|
|
15
14
|
from sphinx.domains.index import IndexDomain
|
|
16
15
|
from sphinx.errors import ExtensionError
|
|
17
16
|
from sphinx.locale import _, __, admonitionlabels
|
|
@@ -21,7 +20,10 @@ from sphinx.util.i18n import format_date
|
|
|
21
20
|
from sphinx.writers.latex import collected_footnote
|
|
22
21
|
|
|
23
22
|
if TYPE_CHECKING:
|
|
23
|
+
from docutils.nodes import Element, Node, Text
|
|
24
|
+
|
|
24
25
|
from sphinx.builders.texinfo import TexinfoBuilder
|
|
26
|
+
from sphinx.domains import IndexEntry
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
logger = logging.getLogger(__name__)
|
|
@@ -232,9 +234,9 @@ class TexinfoTranslator(SphinxTranslator):
|
|
|
232
234
|
# filename
|
|
233
235
|
if not elements['filename']:
|
|
234
236
|
elements['filename'] = self.document.get('source') or 'untitled'
|
|
235
|
-
if elements['filename'][-4:] in ('.txt', '.rst'): # type: ignore
|
|
236
|
-
elements['filename'] = elements['filename'][:-4] # type: ignore
|
|
237
|
-
elements['filename'] += '.info' # type: ignore
|
|
237
|
+
if elements['filename'][-4:] in ('.txt', '.rst'): # type: ignore[index]
|
|
238
|
+
elements['filename'] = elements['filename'][:-4] # type: ignore[index]
|
|
239
|
+
elements['filename'] += '.info' # type: ignore[operator]
|
|
238
240
|
# direntry
|
|
239
241
|
if self.settings.texinfo_dir_entry:
|
|
240
242
|
entry = self.format_menu_entry(
|
|
@@ -428,7 +430,7 @@ class TexinfoTranslator(SphinxTranslator):
|
|
|
428
430
|
entries = self.node_menus[name]
|
|
429
431
|
if not entries:
|
|
430
432
|
return
|
|
431
|
-
self.body.append('\n
|
|
433
|
+
self.body.append(f'\n{self.escape(self.node_names[name], )}\n\n')
|
|
432
434
|
self.add_menu_entries(entries)
|
|
433
435
|
for subentry in entries:
|
|
434
436
|
_add_detailed_menu(subentry)
|
|
@@ -862,7 +864,7 @@ class TexinfoTranslator(SphinxTranslator):
|
|
|
862
864
|
except (KeyError, IndexError) as exc:
|
|
863
865
|
raise nodes.SkipNode from exc
|
|
864
866
|
# footnotes are repeated for each reference
|
|
865
|
-
footnode.walkabout(self) # type: ignore
|
|
867
|
+
footnode.walkabout(self) # type: ignore[union-attr]
|
|
866
868
|
raise nodes.SkipChildren
|
|
867
869
|
|
|
868
870
|
def visit_citation(self, node: Element) -> None:
|
|
@@ -1213,7 +1215,7 @@ class TexinfoTranslator(SphinxTranslator):
|
|
|
1213
1215
|
width = self.tex_image_length(node.get('width', ''))
|
|
1214
1216
|
height = self.tex_image_length(node.get('height', ''))
|
|
1215
1217
|
alt = self.escape_arg(node.get('alt', ''))
|
|
1216
|
-
filename = f"{self.elements['filename'][:-5]}-figures/{name}" # type: ignore
|
|
1218
|
+
filename = f"{self.elements['filename'][:-5]}-figures/{name}" # type: ignore[index]
|
|
1217
1219
|
self.body.append('\n@image{%s,%s,%s,%s,%s}\n' %
|
|
1218
1220
|
(filename, width, height, alt, ext[1:]))
|
|
1219
1221
|
|
sphinx/writers/text.py
CHANGED
|
@@ -5,11 +5,11 @@ import math
|
|
|
5
5
|
import os
|
|
6
6
|
import re
|
|
7
7
|
import textwrap
|
|
8
|
+
from collections.abc import Generator, Iterable, Sequence
|
|
8
9
|
from itertools import chain, groupby
|
|
9
|
-
from typing import TYPE_CHECKING, Any,
|
|
10
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
10
11
|
|
|
11
12
|
from docutils import nodes, writers
|
|
12
|
-
from docutils.nodes import Element, Text
|
|
13
13
|
from docutils.utils import column_width
|
|
14
14
|
|
|
15
15
|
from sphinx import addnodes
|
|
@@ -17,6 +17,8 @@ from sphinx.locale import _, admonitionlabels
|
|
|
17
17
|
from sphinx.util.docutils import SphinxTranslator
|
|
18
18
|
|
|
19
19
|
if TYPE_CHECKING:
|
|
20
|
+
from docutils.nodes import Element, Text
|
|
21
|
+
|
|
20
22
|
from sphinx.builders.text import TextBuilder
|
|
21
23
|
|
|
22
24
|
|
|
@@ -154,7 +156,8 @@ class Table:
|
|
|
154
156
|
This takes into account cells spanning multiple columns.
|
|
155
157
|
"""
|
|
156
158
|
if cell.row is None or cell.col is None:
|
|
157
|
-
|
|
159
|
+
msg = 'Cell co-ordinates have not been set'
|
|
160
|
+
raise ValueError(msg)
|
|
158
161
|
width = 0
|
|
159
162
|
for i in range(self[cell.row, cell.col].colspan):
|
|
160
163
|
width += source[cell.col + i]
|
|
@@ -179,7 +182,8 @@ class Table:
|
|
|
179
182
|
if not cell.wrapped:
|
|
180
183
|
continue
|
|
181
184
|
if cell.row is None or cell.col is None:
|
|
182
|
-
|
|
185
|
+
msg = 'Cell co-ordinates have not been set'
|
|
186
|
+
raise ValueError(msg)
|
|
183
187
|
width = math.ceil(max(column_width(x) for x in cell.wrapped) / cell.colspan)
|
|
184
188
|
for col in range(cell.col, cell.col + cell.colspan):
|
|
185
189
|
self.measured_widths[col] = max(self.measured_widths[col], width)
|
|
@@ -415,7 +419,7 @@ class TextTranslator(SphinxTranslator):
|
|
|
415
419
|
self.stateindent.append(indent)
|
|
416
420
|
|
|
417
421
|
def end_state(
|
|
418
|
-
self, wrap: bool = True, end:
|
|
422
|
+
self, wrap: bool = True, end: Sequence[str] | None = ('',), first: str | None = None,
|
|
419
423
|
) -> None:
|
|
420
424
|
content = self.states.pop()
|
|
421
425
|
maxindent = sum(self.stateindent)
|
|
@@ -435,10 +439,10 @@ class TextTranslator(SphinxTranslator):
|
|
|
435
439
|
result.append((indent, res))
|
|
436
440
|
for itemindent, item in content:
|
|
437
441
|
if itemindent == -1:
|
|
438
|
-
toformat.append(item) # type: ignore
|
|
442
|
+
toformat.append(item) # type: ignore[arg-type]
|
|
439
443
|
else:
|
|
440
444
|
do_format()
|
|
441
|
-
result.append((indent + itemindent, item)) # type: ignore
|
|
445
|
+
result.append((indent + itemindent, item)) # type: ignore[arg-type]
|
|
442
446
|
toformat = []
|
|
443
447
|
do_format()
|
|
444
448
|
if first is not None and result:
|
|
@@ -520,7 +524,7 @@ class TextTranslator(SphinxTranslator):
|
|
|
520
524
|
else:
|
|
521
525
|
char = '^'
|
|
522
526
|
text = ''
|
|
523
|
-
text = ''.join(x[1] for x in self.states.pop() if x[0] == -1) # type: ignore
|
|
527
|
+
text = ''.join(x[1] for x in self.states.pop() if x[0] == -1) # type: ignore[misc]
|
|
524
528
|
if self.add_secnumbers:
|
|
525
529
|
text = self.get_section_number_string(node) + text
|
|
526
530
|
self.stateindent.pop()
|
|
@@ -890,7 +894,8 @@ class TextTranslator(SphinxTranslator):
|
|
|
890
894
|
|
|
891
895
|
def visit_table(self, node: Element) -> None:
|
|
892
896
|
if hasattr(self, 'table'):
|
|
893
|
-
|
|
897
|
+
msg = 'Nested tables are not supported.'
|
|
898
|
+
raise NotImplementedError(msg)
|
|
894
899
|
self.new_state(0)
|
|
895
900
|
self.table = Table()
|
|
896
901
|
|
sphinx/writers/xml.py
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
6
|
|
|
7
7
|
from docutils.writers.docutils_xml import Writer as BaseXMLWriter
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from sphinx.builders import Builder
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class XMLWriter(BaseXMLWriter):
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Sphinx
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.2.0
|
|
4
4
|
Summary: Python documentation generator
|
|
5
5
|
Author-email: Georg Brandl <georg@python.org>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
7
|
Description-Content-Type: text/x-rst
|
|
8
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: Environment :: Console
|
|
@@ -18,10 +18,11 @@ Classifier: Operating System :: OS Independent
|
|
|
18
18
|
Classifier: Programming Language :: Python
|
|
19
19
|
Classifier: Programming Language :: Python :: 3
|
|
20
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
26
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
27
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
27
28
|
Classifier: Framework :: Sphinx
|
|
@@ -47,7 +48,7 @@ Requires-Dist: sphinxcontrib-htmlhelp>=2.0.0
|
|
|
47
48
|
Requires-Dist: sphinxcontrib-serializinghtml>=1.1.5
|
|
48
49
|
Requires-Dist: sphinxcontrib-qthelp
|
|
49
50
|
Requires-Dist: Jinja2>=3.0
|
|
50
|
-
Requires-Dist: Pygments>=2.
|
|
51
|
+
Requires-Dist: Pygments>=2.14
|
|
51
52
|
Requires-Dist: docutils>=0.18.1,<0.21
|
|
52
53
|
Requires-Dist: snowballstemmer>=2.0
|
|
53
54
|
Requires-Dist: babel>=2.9
|
|
@@ -68,7 +69,8 @@ Requires-Dist: docutils-stubs ; extra == "lint"
|
|
|
68
69
|
Requires-Dist: types-requests ; extra == "lint"
|
|
69
70
|
Requires-Dist: pytest>=4.6 ; extra == "test"
|
|
70
71
|
Requires-Dist: html5lib ; extra == "test"
|
|
71
|
-
Requires-Dist: cython ; extra == "test"
|
|
72
|
+
Requires-Dist: cython>=3.0 ; extra == "test"
|
|
73
|
+
Requires-Dist: setuptools>=67.0 ; extra == "test"
|
|
72
74
|
Requires-Dist: filelock ; extra == "test"
|
|
73
75
|
Project-URL: Changelog, https://www.sphinx-doc.org/en/master/changes.html
|
|
74
76
|
Project-URL: Code, https://github.com/sphinx-doc/sphinx
|