diff options
author | Jakob Lykke Andersen <Jakob@caput.dk> | 2021-03-14 12:25:29 +0300 |
---|---|---|
committer | Jakob Lykke Andersen <Jakob@caput.dk> | 2021-03-14 12:25:29 +0300 |
commit | 58b6b45993d9b188d34c489588b5be82eeadc533 (patch) | |
tree | 7350d8e2437f3da6bcc206afa03d28c466f7a469 /sphinx/domains | |
parent | 57220411dafcff0fbb7e871eb7244115cdf842b4 (diff) |
C, fix linking of names in array declarators
Diffstat (limited to 'sphinx/domains')
-rw-r--r-- | sphinx/domains/c.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index 0fecbad6d..0c5f41ba1 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -182,10 +182,19 @@ class ASTNestedName(ASTBase): verify_description_mode(mode) # just print the name part, with template args, not template params if mode == 'noneIsName': - signode += nodes.Text(str(self)) + if self.rooted: + signode += nodes.Text('.') + for i in range(len(self.names)): + if i != 0: + signode += nodes.Text('.') + n = self.names[i] + n.describe_signature(signode, mode, env, '', symbol) elif mode == 'param': - name = str(self) - signode += nodes.emphasis(name, name) + assert not self.rooted, str(self) + assert len(self.names) == 1 + node = nodes.emphasis() + self.names[0].describe_signature(node, 'noneIsName', env, '', symbol) + signode += node elif mode == 'markType' or mode == 'lastIsName' or mode == 'markName': # Each element should be a pending xref targeting the complete # prefix. @@ -869,7 +878,7 @@ class ASTArray(ASTBase): elif self.size: if addSpace: signode += nodes.Text(' ') - self.size.describe_signature(signode, mode, env, symbol) + self.size.describe_signature(signode, 'markType', env, symbol) signode.append(nodes.Text("]")) |