Skip to content

Commit 8cb0a41

Browse files
jnsnowMarkus Armbruster
authored andcommitted
docs/qapidoc: add visit_sections() method
Implement the actual main dispatch method that processes and handles the list of doc sections for a given QAPI entity. Process doc sections in strict source order. This is good; reordering doc text is undesirable. Improvement over the old doc generator, which can reorder doc comments that don't adhere to (largely unspoken) conventions. Signed-off-by: John Snow <[email protected]> Message-ID: <[email protected]> Acked-by: Markus Armbruster <[email protected]> [Commit message extended] Signed-off-by: Markus Armbruster <[email protected]>
1 parent dbf51d1 commit 8cb0a41

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/sphinx/qapidoc.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,31 @@ def preamble(self, ent: QAPISchemaDefinition) -> None:
288288

289289
self.ensure_blank_line()
290290

291+
def visit_sections(self, ent: QAPISchemaDefinition) -> None:
292+
sections = ent.doc.all_sections if ent.doc else []
293+
294+
# Add sections in source order:
295+
for section in sections:
296+
if section.kind == QAPIDoc.Kind.PLAIN:
297+
self.visit_paragraph(section)
298+
elif section.kind == QAPIDoc.Kind.MEMBER:
299+
assert isinstance(section, QAPIDoc.ArgSection)
300+
self.visit_member(section)
301+
elif section.kind == QAPIDoc.Kind.FEATURE:
302+
assert isinstance(section, QAPIDoc.ArgSection)
303+
self.visit_feature(section)
304+
elif section.kind in (QAPIDoc.Kind.SINCE, QAPIDoc.Kind.TODO):
305+
# Since is handled in preamble, TODO is skipped intentionally.
306+
pass
307+
elif section.kind == QAPIDoc.Kind.RETURNS:
308+
self.visit_returns(section)
309+
elif section.kind == QAPIDoc.Kind.ERRORS:
310+
self.visit_errors(section)
311+
else:
312+
assert False
313+
314+
self.ensure_blank_line()
315+
291316
# Transmogrification core methods
292317

293318
def visit_module(self, path: str) -> None:

0 commit comments

Comments
 (0)