]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
docs/qapi-domain: add :since: directive option
authorJohn Snow <jsnow@redhat.com>
Tue, 11 Mar 2025 03:42:12 +0000 (23:42 -0400)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 11 Mar 2025 09:07:03 +0000 (10:07 +0100)
Add a little special markup for registering "Since:" information. Adding
it as an option instead of generic content lets us hoist the information
into the Signature bar, optionally put it in the index, etc.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250311034303.75779-15-jsnow@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
docs/sphinx/qapi_domain.py

index 547040f75a7a8d9bc124b6944f9bdd0b41710428..222b420d2a78df48f4decc93f6b7a5e9a4ba6cca 100644 (file)
@@ -214,6 +214,8 @@ class QAPIObject(QAPIDescription):
         {
             # Borrowed from the Python domain:
             "module": directives.unchanged,  # Override contextual module name
+            # These are QAPI originals:
+            "since": directives.unchanged,
         }
     )
 
@@ -227,7 +229,17 @@ class QAPIObject(QAPIDescription):
 
     def get_signature_suffix(self) -> List[nodes.Node]:
         """Return a suffix to put after the object name in the signature."""
-        return []
+        ret: List[nodes.Node] = []
+
+        if "since" in self.options:
+            ret += [
+                SpaceNode(" "),
+                addnodes.desc_sig_element(
+                    "", f"(Since: {self.options['since']})"
+                ),
+            ]
+
+        return ret
 
     def handle_signature(self, sig: str, signode: desc_signature) -> Signature:
         """