diff options
author | John Snow <jsnow@redhat.com> | 2025-03-10 23:42:12 -0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2025-03-11 10:07:03 +0100 |
commit | 700d51a45c614068393f9754d3ef366e2c05a884 (patch) | |
tree | 0ed0596238b4b9ffa8e19e88f22a1b81bab7663c | |
parent | 758bbdcd1212bb0b7369fea249114ad02d4b7fd0 (diff) | |
download | qemu-700d51a45c614068393f9754d3ef366e2c05a884.zip qemu-700d51a45c614068393f9754d3ef366e2c05a884.tar.gz qemu-700d51a45c614068393f9754d3ef366e2c05a884.tar.bz2 |
docs/qapi-domain: add :since: directive option
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>
-rw-r--r-- | docs/sphinx/qapi_domain.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/sphinx/qapi_domain.py b/docs/sphinx/qapi_domain.py index 547040f..222b420 100644 --- a/docs/sphinx/qapi_domain.py +++ b/docs/sphinx/qapi_domain.py @@ -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: """ |