From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org, "Peter Xu" <peterx@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
"Ani Sinha" <anisinha@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Kevin Wolf" <kwolf@redhat.com>, "Jiri Pirko" <jiri@resnulli.us>,
"Mads Ynddal" <mads@ynddal.dk>,
"Jason Wang" <jasowang@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-block@nongnu.org,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Victor Toso de Carvalho" <victortoso@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Konstantin Kostiuk" <kkostiuk@redhat.com>,
"Lukas Straub" <lukasstraub2@web.de>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Hanna Reitz" <hreitz@redhat.com>
Subject: Re: [PATCH 08/20] qapi/parser: differentiate intro and outro paragraphs
Date: Thu, 16 May 2024 11:34:26 +0200 [thread overview]
Message-ID: <87a5kqnlr1.fsf@pond.sub.org> (raw)
In-Reply-To: <20240514215740.940155-9-jsnow@redhat.com> (John Snow's message of "Tue, 14 May 2024 17:57:27 -0400")
John Snow <jsnow@redhat.com> writes:
> Add a semantic tag to paragraphs that appear *before* tagged
> sections/members/features and those that appear after. This will control
> how they are inlined when doc sections are merged and flattened.
This future use is not obvious to me now. I guess the effective way to
help me see it is actual patches, which will come in due time.
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qapi/parser.py | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
> index cf4cbca1c1f..b1794f71e12 100644
> --- a/scripts/qapi/parser.py
> +++ b/scripts/qapi/parser.py
> @@ -503,6 +503,10 @@ def get_doc(self) -> 'QAPIDoc':
> self.accept(False)
> line = self.get_doc_line()
> no_more_args = False
> + # Paragraphs before members/features/tagged are "intro" paragraphs.
> + # Any appearing subsequently are "outro" paragraphs.
> + # This is only semantic metadata for the doc generator.
Not sure about the last sentence. Isn't it true for almost everything
around here?
Also, long line.
> + intro = True
>
> while line is not None:
> # Blank lines
> @@ -532,6 +536,7 @@ def get_doc(self) -> 'QAPIDoc':
> raise QAPIParseError(
> self, 'feature descriptions expected')
> no_more_args = True
> + intro = False
After feature descriptions.
> elif match := self._match_at_name_colon(line):
> # description
> if no_more_args:
> @@ -547,6 +552,7 @@ def get_doc(self) -> 'QAPIDoc':
> doc.append_line(text)
> line = self.get_doc_indented(doc)
> no_more_args = True
> + intro = False
Or after member descriptions.
> elif match := re.match(
> r'(Returns|Errors|Since|Notes?|Examples?|TODO): *',
> line):
> @@ -557,13 +563,14 @@ def get_doc(self) -> 'QAPIDoc':
> doc.append_line(text)
> line = self.get_doc_indented(doc)
> no_more_args = True
> + intro = False
Or after the first tagged section.
Okay, it does what it says on the tin.
> elif line.startswith('='):
> raise QAPIParseError(
> self,
> "unexpected '=' markup in definition documentation")
> else:
> # tag-less paragraph
> - doc.ensure_untagged_section(self.info)
> + doc.ensure_untagged_section(self.info, intro)
> doc.append_line(line)
> line = self.get_doc_paragraph(doc)
> else:
> @@ -617,7 +624,7 @@ def __init__(
> self,
> info: QAPISourceInfo,
> tag: Optional[str] = None,
> - kind: str = 'paragraph',
> + kind: str = 'intro-paragraph',
The question "why is this optional?" crossed my mind when reviewing the
previous patch. I left it unasked, because I felt challenging the
overlap between @kind and @tag was more useful. However, the new
default value 'intro-paragraph' feels more arbitrary to me than the old
one 'paragraph', and that makes the question pop right back into my
mind.
Unless I'm mistaken, all calls but one @tag and @kind. Making that one
pass it too feels simpler to me.
Moot if we fuse @tag and @kind, of course.
> ):
> # section source info, i.e. where it begins
> self.info = info
> @@ -625,7 +632,7 @@ def __init__(
> self.tag = tag
> # section text without tag
> self.text = ''
> - # section type - {paragraph, feature, member, tagged}
> + # section type - {<intro|outro>-paragraph, feature, member, tagged}
Long line.
> self.kind = kind
>
> def append_line(self, line: str) -> None:
> @@ -666,7 +673,11 @@ def end(self) -> None:
> raise QAPISemError(
> section.info, "text required after '%s:'" % section.tag)
>
> - def ensure_untagged_section(self, info: QAPISourceInfo) -> None:
> + def ensure_untagged_section(
> + self,
> + info: QAPISourceInfo,
> + intro: bool = True,
Two callers, one passes @info, one doesn't. Passing it always might be
simpler.
> + ) -> None:
> if self.all_sections and not self.all_sections[-1].tag:
> section = self.all_sections[-1]
> # Section is empty so far; update info to start *here*.
> @@ -677,7 +688,8 @@ def ensure_untagged_section(self, info: QAPISourceInfo) -> None:
> self.all_sections[-1].text += '\n'
> return
> # start new section
> - section = self.Section(info)
> + kind = ("intro" if intro else "outro") + "-paragraph"
> + section = self.Section(info, kind=kind)
> self.sections.append(section)
> self.all_sections.append(section)
next prev parent reply other threads:[~2024-05-16 9:35 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 21:57 [PATCH 00/20] qapi: new sphinx qapi domain pre-requisites John Snow
2024-05-14 21:57 ` [PATCH 01/20] [DO-NOT-MERGE]: Add some ad-hoc linting helpers John Snow
2024-05-14 21:57 ` [PATCH 02/20] qapi: linter fixups John Snow
2024-05-15 9:10 ` Markus Armbruster
2024-05-14 21:57 ` [PATCH 03/20] docs/qapidoc: delint a tiny portion of the module John Snow
2024-05-15 9:16 ` Markus Armbruster
2024-05-15 12:02 ` John Snow
2024-05-15 16:09 ` John Snow
2024-05-15 17:27 ` Markus Armbruster
2024-05-15 17:52 ` John Snow
2024-05-14 21:57 ` [PATCH 04/20] qapi/parser: preserve indentation in QAPIDoc sections John Snow
2024-05-15 11:50 ` Markus Armbruster
2024-05-15 12:24 ` John Snow
2024-05-15 14:17 ` Markus Armbruster
2024-05-15 17:03 ` John Snow
2024-05-14 21:57 ` [PATCH 05/20] qapi/parser: adjust info location for doc body section John Snow
2024-05-16 5:58 ` Markus Armbruster
2024-05-16 14:30 ` John Snow
2024-05-27 11:58 ` Markus Armbruster
2024-06-21 21:18 ` John Snow
2024-05-14 21:57 ` [PATCH 06/20] qapi/parser: fix comment parsing immediately following a doc block John Snow
2024-05-16 6:01 ` Markus Armbruster
2024-05-16 17:32 ` John Snow
2024-06-13 14:32 ` Markus Armbruster
2024-06-17 15:40 ` John Snow
2024-05-14 21:57 ` [PATCH 07/20] qapi/parser: add semantic 'kind' parameter to QAPIDoc.Section John Snow
2024-05-16 6:18 ` Markus Armbruster
2024-05-16 14:46 ` John Snow
2024-06-13 14:45 ` Markus Armbruster
2024-06-17 15:47 ` John Snow
2024-05-14 21:57 ` [PATCH 08/20] qapi/parser: differentiate intro and outro paragraphs John Snow
2024-05-16 9:34 ` Markus Armbruster [this message]
2024-05-16 15:06 ` John Snow
2024-05-16 17:43 ` John Snow
2024-05-14 21:57 ` [PATCH 09/20] qapi/parser: add undocumented stub members to all_sections John Snow
2024-06-14 8:52 ` Markus Armbruster
2024-06-17 16:54 ` John Snow
2024-06-18 11:32 ` Markus Armbruster
2024-05-14 21:57 ` [PATCH 10/20] qapi/schema: add __iter__ method to QAPISchemaVariants John Snow
2024-05-14 21:57 ` [PATCH 11/20] qapi/schema: add doc_visible property to QAPISchemaDefinition John Snow
2024-06-14 9:40 ` Markus Armbruster
2024-06-17 17:33 ` John Snow
2024-05-14 21:57 ` [PATCH 12/20] qapi/source: allow multi-line QAPISourceInfo advancing John Snow
2024-05-14 21:57 ` [PATCH 13/20] docs/qapidoc: fix nested parsing under untagged sections John Snow
2024-06-14 9:45 ` Markus Armbruster
2024-06-17 17:42 ` John Snow
2024-05-14 21:57 ` [PATCH 14/20] qapi: fix non-compliant JSON examples John Snow
2024-06-14 10:55 ` Markus Armbruster
2024-06-17 17:52 ` John Snow
2024-06-18 8:48 ` Markus Armbruster
2024-05-14 21:57 ` [PATCH 15/20] qapi: remove developer factoring comments from QAPI doc blocks John Snow
2024-05-14 21:57 ` [PATCH 16/20] qapi: rewrite StatsFilter comment John Snow
2024-05-14 21:57 ` [PATCH 17/20] qapi: rewrite BlockExportOptions doc block John Snow
2024-05-14 21:57 ` [PATCH 18/20] qapi: ensure all errors sections are uniformly typset John Snow
2024-06-14 11:24 ` Markus Armbruster
2024-06-17 17:56 ` John Snow
2024-06-18 8:52 ` Markus Armbruster
2024-05-14 21:57 ` [PATCH 19/20] qapi: convert "Note" sections to plain rST John Snow
2024-06-14 13:44 ` Markus Armbruster
2024-06-17 19:56 ` John Snow
2024-06-18 11:08 ` Markus Armbruster
2024-05-14 21:57 ` [PATCH 20/20] qapi: convert "Example" sections to rST John Snow
2024-06-14 14:38 ` Markus Armbruster
2024-06-17 21:27 ` John Snow
2024-06-18 11:25 ` Markus Armbruster
2024-05-16 17:56 ` [PATCH 00/20] qapi: new sphinx qapi domain pre-requisites Stefan Hajnoczi
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=87a5kqnlr1.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=anisinha@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=jiri@resnulli.us \
--cc=jsnow@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=lukasstraub2@web.de \
--cc=mads@ynddal.dk \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
--cc=victortoso@redhat.com \
--cc=wangyanan55@huawei.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.