All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael Roth" <michael.roth@amd.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"John Snow" <jsnow@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 04/10] docs/qapidoc: support header-less freeform sections
Date: Sun, 23 Feb 2025 22:37:35 -0500	[thread overview]
Message-ID: <20250224033741.222749-5-jsnow@redhat.com> (raw)
In-Reply-To: <20250224033741.222749-1-jsnow@redhat.com>

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>
---
 docs/sphinx/qapidoc.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index 5f96b46270b..5a4d7388b29 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -421,6 +421,8 @@ def freeform(self, doc):
             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
-- 
2.48.1



  parent reply	other threads:[~2025-02-24  3:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  3:37 [PATCH 00/10] qapi: misc testing and doc patches John Snow
2025-02-24  3:37 ` [PATCH 01/10] qapi: update pylintrc config John Snow
2025-02-26  9:19   ` Markus Armbruster
2025-02-24  3:37 ` [PATCH 02/10] python: add qapi static analysis tests John Snow
2025-02-24 12:36   ` Markus Armbruster
2025-02-24 15:07     ` John Snow
2025-02-26  9:29       ` Markus Armbruster
2025-02-26 15:12         ` John Snow
2025-02-24  3:37 ` [PATCH 03/10] qapi: delete un-needed python static analysis configs John Snow
2025-02-24 12:43   ` Markus Armbruster
2025-02-26  7:23     ` Markus Armbruster
2025-02-26  7:27   ` Markus Armbruster
2025-02-26 15:05     ` John Snow
2025-02-27  7:05       ` Markus Armbruster
2025-02-24  3:37 ` John Snow [this message]
2025-02-24 12:45   ` [PATCH 04/10] docs/qapidoc: support header-less freeform sections Markus Armbruster
2025-02-26  9:36     ` Markus Armbruster
2025-02-26 15:28       ` John Snow
2025-02-24  3:37 ` [PATCH 05/10] qapi/parser: adjust info location for doc body section John Snow
2025-02-25  8:15   ` Markus Armbruster
2025-02-24  3:37 ` [PATCH 06/10] docs/qapidoc: remove example section support John Snow
2025-02-26  9:38   ` Markus Armbruster
2025-02-24  3:37 ` [PATCH 07/10] qapi: expand tags to all doc sections John Snow
2025-02-28 12:37   ` Markus Armbruster
2025-02-24  3:37 ` [PATCH 08/10] qapi/schema: add __repr__ to QAPIDoc.Section John Snow
2025-02-24  3:37 ` [PATCH 09/10] qapi/source: allow multi-line QAPISourceInfo advancing John Snow
2025-02-24  3:37 ` [PATCH 10/10] docs: disambiguate cross-references John Snow
2025-02-26 10:09 ` [PATCH 00/10] qapi: misc testing and doc patches Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250224033741.222749-5-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=crosa@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.