mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '3.x'
This commit is contained in:
commit
9969239b22
3
CHANGES
3
CHANGES
@ -54,6 +54,7 @@ Incompatible changes
|
||||
Deprecated
|
||||
----------
|
||||
|
||||
* ``sphinx.writers.texinfo.TexinfoWriter.desc``
|
||||
* C, parsing of pre-v3 style type directives and roles, along with the options
|
||||
:confval:`c_allow_pre_v3` and :confval:`c_warn_on_allowed_pre_v3`.
|
||||
|
||||
@ -120,6 +121,8 @@ Bugs fixed
|
||||
translation
|
||||
* #7768: i18n: The ``root`` element for :confval:`figure_language_filename` is
|
||||
not a path that user specifies in the document
|
||||
* #7993: texinfo: TypeError is raised for nested object descriptions
|
||||
* #7993: texinfo: a warning not supporting desc_signature_line node is shown
|
||||
* #7869: :rst:role:`abbr` role without an explanation will show the explanation
|
||||
from the previous abbr role
|
||||
* C and C++, removed ``noindex`` directive option as it did
|
||||
|
@ -56,6 +56,11 @@ The following is a list of deprecated interfaces.
|
||||
- 6.0
|
||||
- ``docutils.utils.smartyquotes``
|
||||
|
||||
* - ``sphinx.writers.texinfo.TexinfoWriter.desc``
|
||||
- 3.2
|
||||
- 5.0
|
||||
- ``sphinx.writers.texinfo.TexinfoWriter.descs``
|
||||
|
||||
* - The first argument for
|
||||
``sphinx.ext.autosummary.generate.AutosummaryRenderer`` has been changed
|
||||
to Sphinx object
|
||||
|
@ -482,7 +482,7 @@ def evaluate_signature(sig: inspect.Signature, globalns: Dict = None, localns: D
|
||||
"""Evaluate unresolved type annotations in a signature object."""
|
||||
def evaluate_forwardref(ref: ForwardRef, globalns: Dict, localns: Dict) -> Any:
|
||||
"""Evaluate a forward reference."""
|
||||
if sys.version_info > (3, 10):
|
||||
if sys.version_info > (3, 9):
|
||||
return ref._evaluate(globalns, localns, frozenset())
|
||||
else:
|
||||
return ref._evaluate(globalns, localns)
|
||||
|
@ -10,14 +10,16 @@
|
||||
|
||||
import re
|
||||
import textwrap
|
||||
import warnings
|
||||
from os import path
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Pattern, Set, Tuple, Union
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Optional, Pattern, Set, Tuple, Union
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
||||
from docutils import nodes, writers
|
||||
from docutils.nodes import Element, Node, Text
|
||||
|
||||
from sphinx import addnodes, __display_version__
|
||||
from sphinx.deprecation import RemovedInSphinx50Warning
|
||||
from sphinx.domains import IndexEntry
|
||||
from sphinx.domains.index import IndexDomain
|
||||
from sphinx.errors import ExtensionError
|
||||
@ -188,6 +190,7 @@ class TexinfoTranslator(SphinxTranslator):
|
||||
|
||||
self.body = [] # type: List[str]
|
||||
self.context = [] # type: List[str]
|
||||
self.descs = [] # type: List[addnodes.desc]
|
||||
self.previous_section = None # type: nodes.section
|
||||
self.section_level = 0
|
||||
self.seen_title = False
|
||||
@ -1364,12 +1367,12 @@ class TexinfoTranslator(SphinxTranslator):
|
||||
|
||||
# -- Desc
|
||||
|
||||
def visit_desc(self, node: Element) -> None:
|
||||
self.desc = node
|
||||
def visit_desc(self, node: addnodes.desc) -> None:
|
||||
self.descs.append(node)
|
||||
self.at_deffnx = '@deffn'
|
||||
|
||||
def depart_desc(self, node: Element) -> None:
|
||||
self.desc = None
|
||||
def depart_desc(self, node: addnodes.desc) -> None:
|
||||
self.descs.pop()
|
||||
self.ensure_eol()
|
||||
self.body.append('@end deffn\n')
|
||||
|
||||
@ -1398,6 +1401,12 @@ class TexinfoTranslator(SphinxTranslator):
|
||||
self.escape_hyphens -= 1
|
||||
self.desc_type_name = None
|
||||
|
||||
def visit_desc_signature_line(self, node: Element) -> None:
|
||||
pass
|
||||
|
||||
def depart_desc_signature_line(self, node: Element) -> None:
|
||||
pass
|
||||
|
||||
def visit_desc_name(self, node: Element) -> None:
|
||||
pass
|
||||
|
||||
@ -1453,9 +1462,8 @@ class TexinfoTranslator(SphinxTranslator):
|
||||
# -- instead of --
|
||||
# @deffn {Class} class Foo
|
||||
txt = node.astext().strip()
|
||||
if txt == self.desc['desctype'] or \
|
||||
txt == self.desc['objtype'] or \
|
||||
txt in self.desc_type_name.split():
|
||||
if ((self.descs and txt == self.descs[-1]['objtype']) or
|
||||
(self.desc_type_name and txt in self.desc_type_name.split())):
|
||||
raise nodes.SkipNode
|
||||
|
||||
def depart_desc_annotation(self, node: Element) -> None:
|
||||
@ -1525,3 +1533,11 @@ class TexinfoTranslator(SphinxTranslator):
|
||||
self.body.append('\n\n@example\n%s\n@end example\n\n' %
|
||||
self.escape_arg(node.astext()))
|
||||
raise nodes.SkipNode
|
||||
|
||||
@property
|
||||
def desc(self) -> Optional[addnodes.desc]:
|
||||
warnings.warn('TexinfoWriter.desc is deprecated.', RemovedInSphinx50Warning)
|
||||
if len(self.descs):
|
||||
return self.descs[-1]
|
||||
else:
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user