[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/20] qapi/parser: adjust info location for doc body section
From: |
John Snow |
Subject: |
[PATCH 05/20] qapi/parser: adjust info location for doc body section |
Date: |
Tue, 14 May 2024 17:57:24 -0400 |
Instead of using the info object for the doc block as a whole, update
the info pointer for each call to ensure_untagged_section when the
existing section is otherwise empty. This way, Sphinx error information
will match precisely to where the text actually starts.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/parser.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 8cdd5334ec6..41b9319e5cb 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -662,8 +662,13 @@ def end(self) -> None:
def ensure_untagged_section(self, info: QAPISourceInfo) -> None:
if self.all_sections and not self.all_sections[-1].tag:
- # extend current section
- self.all_sections[-1].text += '\n'
+ section = self.all_sections[-1]
+ # Section is empty so far; update info to start *here*.
+ if not section.text:
+ section.info = info
+ else:
+ # extend current section
+ self.all_sections[-1].text += '\n'
return
# start new section
section = self.Section(info)
--
2.44.0
[PATCH 11/20] qapi/schema: add doc_visible property to QAPISchemaDefinition, John Snow, 2024/05/14
[PATCH 15/20] qapi: remove developer factoring comments from QAPI doc blocks, John Snow, 2024/05/14
[PATCH 12/20] qapi/source: allow multi-line QAPISourceInfo advancing, John Snow, 2024/05/14
[PATCH 16/20] qapi: rewrite StatsFilter comment, John Snow, 2024/05/14
[PATCH 14/20] qapi: fix non-compliant JSON examples, John Snow, 2024/05/14
[PATCH 17/20] qapi: rewrite BlockExportOptions doc block, John Snow, 2024/05/14
[PATCH 18/20] qapi: ensure all errors sections are uniformly typset, John Snow, 2024/05/14