On Fri, Mar 7, 2025 at 7:27 AM Markus Armbruster <arm...@redhat.com> wrote:
> John Snow <js...@redhat.com> writes: > > > Finally, the core entry method for a qapi entity. > > > > Signed-off-by: John Snow <js...@redhat.com> > > --- > > docs/sphinx/qapidoc.py | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py > > index 7308fa0a767..fb2ad7492ae 100644 > > --- a/docs/sphinx/qapidoc.py > > +++ b/docs/sphinx/qapidoc.py > > @@ -78,6 +78,8 @@ > > > > > > class Transmogrifier: > > + # pylint: disable=too-many-public-methods > > + > > Tsk, tsk, tsk ... ;-P > Strongly tempted to make all the "visit_foo" methods "_handle_foo" and delete this line. ... But I don't want to fight with the rebase conflicts on all of the chunk context not lining up anymore. So I'll live with this little dishonor for now. > > > # Field names used for different entity types: > > field_types = { > > "enum": "value", > > @@ -368,6 +370,25 @@ def visit_freeform(self, doc: QAPIDoc) -> None: > > 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 > >