summaryrefslogtreecommitdiff
path: root/sphinx/util
diff options
context:
space:
mode:
authorJeremy Maitin-Shepard <jbms@google.com>2022-03-10 22:03:42 -0800
committerJeremy Maitin-Shepard <jbms@google.com>2022-03-10 22:03:42 -0800
commit670e8b149fa3349f08619f4d44617c0df9b84f8a (patch)
tree7dcd789f2f997b9c29f9dc85541cbca013d94f1d /sphinx/util
parentb3812f72a98b01bae4b1158761082edc46cfa87f (diff)
downloadsphinx-git-670e8b149fa3349f08619f4d44617c0df9b84f8a.tar.gz
[C++] Support attributes on class and union and improve formatting
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/cfamily.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sphinx/util/cfamily.py b/sphinx/util/cfamily.py
index a86cb6f4b..a69b9d7da 100644
--- a/sphinx/util/cfamily.py
+++ b/sphinx/util/cfamily.py
@@ -15,6 +15,7 @@ from typing import Any, Callable, List, Match, Optional, Pattern, Tuple, Union
from docutils import nodes
from docutils.nodes import TextElement
+import sphinx.addnodes
from sphinx.config import Config
from sphinx.util import logging
@@ -134,8 +135,9 @@ class ASTCPPAttribute(ASTAttribute):
return "[[" + self.arg + "]]"
def describe_signature(self, signode: TextElement) -> None:
- txt = str(self)
- signode.append(nodes.Text(txt, txt))
+ signode.append(sphinx.addnodes.desc_sig_punctuation('[[', '[['))
+ signode.append(sphinx.addnodes.desc_sig_keyword(self.arg, self.arg))
+ signode.append(sphinx.addnodes.desc_sig_punctuation(']]', ']]'))
class ASTGnuAttribute(ASTBaseBase):