diff --git a/CHANGES b/CHANGES index f34d4ae65..7abae4b18 100644 --- a/CHANGES +++ b/CHANGES @@ -40,6 +40,8 @@ Incompatible changes functions and methods * The C domain has been rewritten, with additional directives and roles. The existing ones are now more strict, resulting in new warnings. +* The attribute ``sphinx_cpp_tagname`` in the ``desc_signature_line`` node + has been renamed to ``sphinx_line_type``. Deprecated ---------- diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py index fa04e9344..847a6d715 100644 --- a/sphinx/addnodes.py +++ b/sphinx/addnodes.py @@ -119,7 +119,7 @@ class desc_signature_line(nodes.Part, nodes.Inline, nodes.FixedTextElement): It should only be used in a ``desc_signature`` with ``is_multiline`` set. Set ``add_permalink = True`` for the line that should get the permalink. """ - sphinx_cpp_tagname = '' + sphinx_line_type = '' # nodes to use within a desc_signature or desc_signature_line diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index 243f57488..49d1cf6a3 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -10,7 +10,7 @@ import re from typing import ( - Any, Callable, Dict, Iterator, List, Tuple, Type, Union + Any, Callable, Dict, Iterator, List, Type, Tuple, Union ) from typing import cast @@ -25,7 +25,6 @@ from sphinx.builders import Builder from sphinx.directives import ObjectDescription from sphinx.domains import Domain, ObjType from sphinx.environment import BuildEnvironment -from sphinx.errors import NoUri from sphinx.locale import _, __ from sphinx.roles import XRefRole from sphinx.util import logging @@ -1220,7 +1219,7 @@ class ASTDeclaration(ASTBase): signode['is_multiline'] = True # Put each line in a desc_signature_line node. mainDeclNode = addnodes.desc_signature_line() - mainDeclNode.sphinx_c_tagname = 'declarator' + mainDeclNode.sphinx_line_type = 'declarator' mainDeclNode['add_permalink'] = not self.symbol.isRedeclaration signode += mainDeclNode diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 639ac20b6..5a85d56a6 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -9,9 +9,8 @@ """ import re -import warnings from typing import ( - Any, Callable, Dict, Iterator, List, Match, Pattern, Tuple, Type, TypeVar, Union + Any, Callable, Dict, Iterator, List, Tuple, Type, TypeVar, Union ) from docutils import nodes, utils @@ -24,7 +23,6 @@ from sphinx.addnodes import desc_signature, pending_xref from sphinx.application import Sphinx from sphinx.builders import Builder from sphinx.config import Config -from sphinx.deprecation import RemovedInSphinx40Warning from sphinx.directives import ObjectDescription from sphinx.domains import Domain, ObjType from sphinx.environment import BuildEnvironment @@ -70,7 +68,7 @@ T = TypeVar('T') Each signature is in a desc_signature node, where all children are desc_signature_line nodes. Each of these lines will have the attribute - 'sphinx_cpp_tagname' set to one of the following (prioritized): + 'sphinx_line_type' set to one of the following (prioritized): - 'declarator', if the line contains the name of the declared object. - 'templateParams', if the line starts a template parameter list, - 'templateParams', if the line has template parameters @@ -1604,7 +1602,7 @@ class ASTTemplateParams(ASTBase): def makeLine(parentNode: desc_signature = parentNode) -> addnodes.desc_signature_line: signode = addnodes.desc_signature_line() parentNode += signode - signode.sphinx_cpp_tagname = 'templateParams' + signode.sphinx_line_type = 'templateParams' return signode if self.isNested: lineNode = parentNode # type: Element @@ -1713,7 +1711,7 @@ class ASTTemplateIntroduction(ASTBase): # Note: 'lineSpec' has no effect on template introductions. signode = addnodes.desc_signature_line() parentNode += signode - signode.sphinx_cpp_tagname = 'templateIntroduction' + signode.sphinx_line_type = 'templateIntroduction' self.concept.describe_signature(signode, 'markType', env, symbol) signode += nodes.Text('{') first = True @@ -3416,7 +3414,7 @@ class ASTDeclaration(ASTBase): signode['is_multiline'] = True # Put each line in a desc_signature_line node. mainDeclNode = addnodes.desc_signature_line() - mainDeclNode.sphinx_cpp_tagname = 'declarator' + mainDeclNode.sphinx_line_type = 'declarator' mainDeclNode['add_permalink'] = not self.symbol.isRedeclaration if self.templatePrefix: diff --git a/sphinx/util/cfamily.py b/sphinx/util/cfamily.py index 87e438851..67fdc114b 100644 --- a/sphinx/util/cfamily.py +++ b/sphinx/util/cfamily.py @@ -1,10 +1,10 @@ """ sphinx.util.cfamily - ~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~ Utility functions common to the C and C++ domains. - :copyright: Copyright 2020-2020 by the Sphinx team, see AUTHORS. + :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -12,7 +12,7 @@ import re import warnings from copy import deepcopy from typing import ( - Any, Callable, Dict, Iterator, List, Match, Pattern, Tuple, Type, TypeVar, Union + Any, Callable, List, Match, Pattern, Tuple ) from sphinx.deprecation import RemovedInSphinx40Warning @@ -244,4 +244,4 @@ class BaseParser: def assert_end(self) -> None: self.skip_ws() if not self.eof: - self.fail('Expected end of definition.') \ No newline at end of file + self.fail('Expected end of definition.')