diff options
author | John Snow <jsnow@redhat.com> | 2025-03-10 23:42:51 -0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2025-03-11 10:26:52 +0100 |
commit | c05de7235a24dd1719ee6132fc45802b15ce49df (patch) | |
tree | 1e4f2a9ee0ae595955d5d6b483023bcaa316b108 /docs | |
parent | 8cb0a41490364400bc6b1c361b8e1abf9c21bd76 (diff) | |
download | qemu-c05de7235a24dd1719ee6132fc45802b15ce49df.zip qemu-c05de7235a24dd1719ee6132fc45802b15ce49df.tar.gz qemu-c05de7235a24dd1719ee6132fc45802b15ce49df.tar.bz2 |
docs/qapidoc: add visit_entity()
Finally, the core entry method for a qapi entity.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250311034303.75779-54-jsnow@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/sphinx/qapidoc.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 83022b1..aaf5b6e2 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -78,6 +78,8 @@ __version__ = "1.0" class Transmogrifier: + # pylint: disable=too-many-public-methods + # Field names used for different entity types: field_types = { "enum": "value", @@ -362,6 +364,25 @@ class Transmogrifier: self.add_lines(text, info) self.ensure_blank_line() + def visit_entity(self, ent: QAPISchemaDefinition) -> None: + assert ent.info + + try: + self._curr_ent = ent + + # Squish structs and unions together into an "object" directive. + meta = ent.meta + if meta in ("struct", "union"): + meta = "object" + + # This line gets credited to the start of the /definition/. + self.add_line(f".. qapi:{meta}:: {ent.name}", ent.info) + with self.indented(): + self.preamble(ent) + self.visit_sections(ent) + finally: + self._curr_ent = None + class QAPISchemaGenDepVisitor(QAPISchemaVisitor): """A QAPI schema visitor which adds Sphinx dependencies each module |