Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-16 15:51:46 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-16 15:51:46 +0300
commit30f8640bab786b28e2fbc3a12a4cf212e6f953d1 (patch)
treef5cf23900a7bc509fe970262195995ddc526fda1 /sphinx/domains
parent5460ea103bd91ce910e50e11e05c1e5340c2a9e0 (diff)
parent7c340e1c1c43f173f11efc14feb29cd08cedb995 (diff)
Merge branch '3.x'
Diffstat (limited to 'sphinx/domains')
-rw-r--r--sphinx/domains/c.py21
-rw-r--r--sphinx/domains/cpp.py43
-rw-r--r--sphinx/domains/std.py4
3 files changed, 33 insertions, 35 deletions
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py
index fb4da502d..064318e08 100644
--- a/sphinx/domains/c.py
+++ b/sphinx/domains/c.py
@@ -3657,15 +3657,18 @@ class CDomain(Domain):
name = 'c'
label = 'C'
object_types = {
- 'function': ObjType(_('function'), 'func'),
- 'member': ObjType(_('member'), 'member'),
- 'macro': ObjType(_('macro'), 'macro'),
- 'type': ObjType(_('type'), 'type'),
- 'var': ObjType(_('variable'), 'data'),
- 'enum': ObjType(_('enum'), 'enum'),
- 'enumerator': ObjType(_('enumerator'), 'enumerator'),
- 'struct': ObjType(_('struct'), 'struct'),
- 'union': ObjType(_('union'), 'union'),
+ # 'identifier' is the one used for xrefs generated in signatures, not in roles
+ 'member': ObjType(_('member'), 'var', 'member', 'data', 'identifier'),
+ 'var': ObjType(_('variable'), 'var', 'member', 'data', 'identifier'),
+ 'function': ObjType(_('function'), 'func', 'identifier', 'type'),
+ 'macro': ObjType(_('macro'), 'macro', 'identifier'),
+ 'struct': ObjType(_('struct'), 'struct', 'identifier', 'type'),
+ 'union': ObjType(_('union'), 'union', 'identifier', 'type'),
+ 'enum': ObjType(_('enum'), 'enum', 'identifier', 'type'),
+ 'enumerator': ObjType(_('enumerator'), 'enumerator', 'identifier'),
+ 'type': ObjType(_('type'), 'identifier', 'type'),
+ # generated object types
+ 'functionParam': ObjType(_('function parameter'), 'identifier', 'var', 'member', 'data'), # noqa
}
directives = {
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py
index f6e746809..4d6e189a3 100644
--- a/sphinx/domains/cpp.py
+++ b/sphinx/domains/cpp.py
@@ -7251,14 +7251,18 @@ class CPPDomain(Domain):
name = 'cpp'
label = 'C++'
object_types = {
- 'class': ObjType(_('class'), 'class', 'type', 'identifier'),
- 'union': ObjType(_('union'), 'union', 'type', 'identifier'),
- 'function': ObjType(_('function'), 'function', 'func', 'type', 'identifier'),
- 'member': ObjType(_('member'), 'member', 'var'),
- 'type': ObjType(_('type'), 'type', 'identifier'),
- 'concept': ObjType(_('concept'), 'concept', 'identifier'),
- 'enum': ObjType(_('enum'), 'enum', 'type', 'identifier'),
- 'enumerator': ObjType(_('enumerator'), 'enumerator')
+ 'class': ObjType(_('class'), 'class', 'struct', 'identifier', 'type'),
+ 'union': ObjType(_('union'), 'union', 'identifier', 'type'),
+ 'function': ObjType(_('function'), 'func', 'identifier', 'type'),
+ 'member': ObjType(_('member'), 'member', 'var', 'identifier'),
+ 'type': ObjType(_('type'), 'identifier', 'type'),
+ 'concept': ObjType(_('concept'), 'concept', 'identifier'),
+ 'enum': ObjType(_('enum'), 'enum', 'identifier', 'type'),
+ 'enumerator': ObjType(_('enumerator'), 'enumerator', 'identifier'),
+ # generated object types
+ 'functionParam': ObjType(_('function parameter'), 'identifier', 'member', 'var'), # noqa
+ 'templateParam': ObjType(_('template parameter'),
+ 'identifier', 'class', 'struct', 'union', 'member', 'var', 'type'), # noqa
}
directives = {
@@ -7435,30 +7439,19 @@ class CPPDomain(Domain):
if typ.startswith('cpp:'):
typ = typ[4:]
- origTyp = typ
- if typ == 'func':
- typ = 'function'
- if typ == 'struct':
- typ = 'class'
declTyp = s.declaration.objectType
def checkType() -> bool:
- if typ == 'any' or typ == 'identifier':
+ if typ == 'any':
return True
- if declTyp == 'templateParam':
- # TODO: perhaps this should be strengthened one day
- return True
- if declTyp == 'functionParam':
- if typ == 'var' or typ == 'member':
- return True
objtypes = self.objtypes_for_role(typ)
if objtypes:
return declTyp in objtypes
- print("Type is %s (originally: %s), declType is %s" % (typ, origTyp, declTyp))
+ print("Type is %s, declaration type is %s" % (typ, declTyp))
assert False
if not checkType():
logger.warning("cpp:%s targets a %s (%s).",
- origTyp, s.declaration.objectType,
+ typ, s.declaration.objectType,
s.get_full_nested_name(),
location=node)
@@ -7488,10 +7481,10 @@ class CPPDomain(Domain):
if env.config.add_function_parentheses and typ == 'any':
addParen += 1
# and now this stuff for operator()
- if (env.config.add_function_parentheses and typ == 'function' and
+ if (env.config.add_function_parentheses and typ == 'func' and
title.endswith('operator()')):
addParen += 1
- if ((typ == 'any' or typ == 'function') and
+ if ((typ == 'any' or typ == 'func') and
title.endswith('operator') and
displayName.endswith('operator()')):
addParen += 1
@@ -7500,7 +7493,7 @@ class CPPDomain(Domain):
if env.config.add_function_parentheses:
if typ == 'any' and displayName.endswith('()'):
addParen += 1
- elif typ == 'function':
+ elif typ == 'func':
if title.endswith('()') and not displayName.endswith('()'):
title = title[:-2]
else:
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
index 18e62c3cb..864c338f4 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -730,9 +730,11 @@ class StandardDomain(Domain):
name, env.doc2path(self.labels[name][0]),
location=node)
self.anonlabels[name] = docname, labelid
- if node.tagname in ('section', 'rubric'):
+ if node.tagname == 'section':
title = cast(nodes.title, node[0])
sectname = clean_astext(title)
+ elif node.tagname == 'rubric':
+ sectname = clean_astext(node)
elif self.is_enumerable_node(node):
sectname = self.get_numfig_title(node)
if not sectname: