[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 01/23] docs/qapidoc: support header-less freeform sections
From: |
John Snow |
Subject: |
[PATCH v2 01/23] docs/qapidoc: support header-less freeform sections |
Date: |
Tue, 14 Jan 2025 13:58:18 -0500 |
The code as written can't handle if a header isn't found and will crash,
because `node` will be uninitialized. If we don't have a section title,
create a generic block to insert text into instead.
(This patch also removes a lingering pylint warning in the QAPIDoc
implementation that prevents getting a clean baseline to use for
forthcoming additions.)
I am not attempting to *fully* clean up the existing QAPIDoc
implementation in pylint because I intend to delete it anyway; this
patch merely accomplishes a baseline under a specific pylint
configuration:
PYTHONPATH=../../scripts/ pylint --disable=fixme,too-many-lines,\
consider-using-f-string,missing-docstring,unused-argument,\
too-many-arguments,too-many-positional-arguments,\
too-many-public-methods \
qapidoc.py
(under at least pylint 3.3.1; more robust tamping down of the
environment needed to consistently perform checks will happen later -
hopefully soon, sorry for the inconvenience.)
This at least ensures there aren't regressions outside of these general
warnings in the new qapidoc.py code to be committed.
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.47.1
- [PATCH v2 00/23] docs: add basic sphinx-domain rST generator to qapidoc, John Snow, 2025/01/14
- [PATCH v2 01/23] docs/qapidoc: support header-less freeform sections,
John Snow <=
- [PATCH v2 08/23] docs/qapidoc: add visit_module() method, John Snow, 2025/01/14
- [PATCH v2 02/23] qapi/parser: adjust info location for doc body section, John Snow, 2025/01/14
- [PATCH v2 13/23] docs/qapidoc: add visit_errors() method, John Snow, 2025/01/14
- [PATCH v2 15/23] docs/qapidoc: add add_field() and generate_field() helper methods, John Snow, 2025/01/14
- [PATCH v2 14/23] docs/qapidoc: add format_type() method, John Snow, 2025/01/14
- [PATCH v2 06/23] docs/qapidoc: add transmogrifier stub, John Snow, 2025/01/14
- [PATCH v2 04/23] qapi: expand tags to all doc sections, John Snow, 2025/01/14
- [PATCH v2 09/23] qapi/source: allow multi-line QAPISourceInfo advancing, John Snow, 2025/01/14
- [PATCH v2 11/23] docs/qapidoc: add preamble() method, John Snow, 2025/01/14
- [PATCH v2 19/23] docs/qapidoc: add visit_member() method, John Snow, 2025/01/14