diff options
| author | John Snow <jsnow@redhat.com> | 2025-02-23 22:37:35 -0500 |
|---|---|---|
| committer | Markus Armbruster <armbru@redhat.com> | 2025-03-04 07:11:06 +0100 |
| commit | b61a4eb3f32ce74c5ffe001806f9e786788a546f (patch) | |
| tree | ca2988c9b713ce4f16954eec7b7863da4d049d65 /docs/sphinx/qapidoc.py | |
| parent | 6a2c7fc29ab6e8fdce4829d3229db534abf923bb (diff) | |
| download | focaccia-qemu-b61a4eb3f32ce74c5ffe001806f9e786788a546f.tar.gz focaccia-qemu-b61a4eb3f32ce74c5ffe001806f9e786788a546f.zip | |
docs/qapidoc: support header-less freeform sections
The code as written crashes when a free-form documentation block doesn't start with a heading or subheading, for example: | ## | # Just text, no heading. | ## The code will attempt to use the `node` variable uninitialized. To fix, create a generic block to insert the doc text into. (This patch also removes a lingering pylint warning in the QAPIDoc implementation that prevents getting a clean baseline to use for forthcoming additions.) Fixes: 43e0d14ee09a (docs/sphinx: fix extra stuff in TOC after freeform QMP sections) Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20250224033741.222749-5-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Test updated to cover this] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'docs/sphinx/qapidoc.py')
| -rw-r--r-- | docs/sphinx/qapidoc.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index 5f96b46270..5a4d7388b2 100644 --- a/docs/sphinx/qapidoc.py +++ b/docs/sphinx/qapidoc.py @@ -421,6 +421,8 @@ class QAPISchemaGenRSTVisitor(QAPISchemaVisitor): node = self._start_new_heading(heading, len(leader)) if text == '': return + else: + node = nodes.container() self._parse_text_into_node(text, node) self._cur_doc = None |