From: John Snow <jsnow@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Victor Toso de Carvalho" <victortoso@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Konstantin Kostiuk" <kkostiuk@redhat.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Lukas Straub" <lukasstraub2@web.de>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Mads Ynddal" <mads@ynddal.dk>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Peter Xu" <peterx@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
Qemu-block <qemu-block@nongnu.org>,
"Jiri Pirko" <jiri@resnulli.us>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>, "Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH 09/13] qapi: convert "Note" sections to plain rST
Date: Thu, 20 Jun 2024 11:39:35 -0400 [thread overview]
Message-ID: <CAFn=p-aF1_1dvEyihagePrgRF_d7=JDXLUttyJzcxbo355xoCQ@mail.gmail.com> (raw)
In-Reply-To: <87wmmlyu64.fsf@pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 13632 bytes --]
On Wed, Jun 19, 2024, 8:49 AM Markus Armbruster <armbru@redhat.com> wrote:
> John Snow <jsnow@redhat.com> writes:
>
> > We do not need a dedicated section for notes. By eliminating a specially
> > parsed section, these notes can be treated as normal rST paragraphs in
> > the new QMP reference manual, and can be placed and styled much more
> > flexibly.
> >
> > Convert all existing "Note" and "Notes" sections to pure rST. As part of
> > the conversion, capitalize the first letter of each sentence and add
> > trailing punctuation where appropriate to ensure notes look sensible and
> > consistent in rendered HTML documentation.
> >
> > Update docs/devel/qapi-code-gen.rst to reflect the new paradigm, and ...
> >
> > ... Update the QAPI parser to prohibit "Note" sections while suggesting
>
> Scratch "... ..." and downcase "Update"?
>
> > a new syntax. The exact formatting to use is a matter of taste, but a
> > good candidate is simply:
> >
> > .. note:: lorem ipsum ...
> >
> > ... but there are other choices, too. The Sphinx readthedocs theme
> > offers theming for the following forms (capitalization unimportant); all
> > are adorned with a (!) symbol in the title bar for rendered HTML docs.
> >
> > See
> >
> https://sphinx-rtd-theme.readthedocs.io/en/stable/demo/demo.html#admonitions
> > for examples of each directive/admonition in use.
> >
> > These are rendered in orange:
> >
> > .. Attention:: ...
> > .. Caution:: ...
> > .. WARNING:: ...
> >
> > These are rendered in red:
> >
> > .. DANGER:: ...
> > .. Error:: ...
> >
> > These are rendered in green:
> >
> > .. Hint:: ...
> > .. Important:: ...
> > .. Tip:: ...
> >
> > These are rendered in blue:
> >
> > .. Note:: ...
> > .. admonition:: custom title
> >
> > admonition body text
> >
> > This patch uses ".. note::" almost everywhere, with just two "caution"
> > directives. ".. admonition:: notes" is used in a few places where we had
> > an ordered list of multiple notes that would not make sense as
> > standalone/separate admonitions.
> >
> > Signed-off-by: John Snow <jsnow@redhat.com>
> > Acked-by: Stefan Hajnoczi <stefanha@redhat.com> [for block*.json]
>
> [...]
>
> > diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
> > index b3de1fb6b3a..57598331c5c 100644
> > --- a/qga/qapi-schema.json
> > +++ b/qga/qapi-schema.json
> > @@ -422,8 +422,9 @@
> > # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined
> > # below)
> > #
> > -# Note: This may fail to properly report the current state as a result
> > -# of some other guest processes having issued an fs freeze/thaw.
> > +# .. note:: This may fail to properly report the current state as a
> > +# result of some other guest processes having issued an fs
> > +# freeze/thaw.
> > #
> > # Since: 0.15.0
> > ##
> > @@ -443,9 +444,9 @@
> > #
> > # Returns: Number of file systems currently frozen.
> > #
> > -# Note: On Windows, the command is implemented with the help of a
> > -# Volume Shadow-copy Service DLL helper. The frozen state is
> > -# limited for up to 10 seconds by VSS.
> > +# .. note:: On Windows, the command is implemented with the help of a
> > +# Volume Shadow-copy Service DLL helper. The frozen state is limited
> > +# for up to 10 seconds by VSS.
> > #
> > # Since: 0.15.0
> > ##
> > @@ -479,10 +480,10 @@
> > #
> > # Returns: Number of file systems thawed by this call
> > #
> > -# Note: if return value does not match the previous call to
> > -# guest-fsfreeze-freeze, this likely means some freezable
> > -# filesystems were unfrozen before this call, and that the
> > -# filesystem state may have changed before issuing this command.
> > +# .. note:: If return value does not match the previous call to
> > +# guest-fsfreeze-freeze, this likely means some freezable filesystems
> > +# were unfrozen before this call, and that the filesystem state may
> > +# have changed before issuing this command.
> > #
> > # Since: 0.15.0
> > ##
> > @@ -560,8 +561,8 @@
> > # Errors:
> > # - If suspend to disk is not supported, Unsupported
> > #
> > -# Notes: It's strongly recommended to issue the guest-sync command
> > -# before sending commands when the guest resumes
> > +# .. note:: It's strongly recommended to issue the guest-sync command
> > +# before sending commands when the guest resumes.
> > #
> > # Since: 1.1
> > ##
> > @@ -596,8 +597,8 @@
> > # Errors:
> > # - If suspend to ram is not supported, Unsupported
> > #
> > -# Notes: It's strongly recommended to issue the guest-sync command
> > -# before sending commands when the guest resumes
> > +# .. note:: It's strongly recommended to issue the guest-sync command
> > +# before sending commands when the guest resumes.
> > #
> > # Since: 1.1
> > ##
> > @@ -631,8 +632,8 @@
> > # Errors:
> > # - If hybrid suspend is not supported, Unsupported
> > #
> > -# Notes: It's strongly recommended to issue the guest-sync command
> > -# before sending commands when the guest resumes
> > +# .. note:: It's strongly recommended to issue the guest-sync command
> > +# before sending commands when the guest resumes.
> > #
> > # Since: 1.1
> > ##
> > @@ -1461,16 +1462,15 @@
> > # * POSIX: as defined by os-release(5)
> > # * Windows: contains string "server" or "client"
> > #
> > -# Notes: On POSIX systems the fields @id, @name, @pretty-name,
> > -# @version, @version-id, @variant and @variant-id follow the
> > -# definition specified in os-release(5). Refer to the manual page
> > -# for exact description of the fields. Their values are taken
> > -# from the os-release file. If the file is not present in the
> > -# system, or the values are not present in the file, the fields
> > -# are not included.
> > +# .. note:: On POSIX systems the fields @id, @name, @pretty-name,
> > +# @version, @version-id, @variant and @variant-id follow the
> > +# definition specified in os-release(5). Refer to the manual page for
> > +# exact description of the fields. Their values are taken from the
> > +# os-release file. If the file is not present in the system, or the
> > +# values are not present in the file, the fields are not included.
> > #
> > -# On Windows the values are filled from information gathered from
> > -# the system.
> > +# On Windows the values are filled from information gathered from
> > +# the system.
>
> Please don't change the indentation here. I get the same output with
>
> @@ -1461,7 +1462,7 @@
> # * POSIX: as defined by os-release(5)
> # * Windows: contains string "server" or "client"
> #
> -# Notes: On POSIX systems the fields @id, @name, @pretty-name,
> +# .. note:: On POSIX systems the fields @id, @name, @pretty-name,
> # @version, @version-id, @variant and @variant-id follow the
> # definition specified in os-release(5). Refer to the manual page
> # for exact description of the fields. Their values are taken
>
>
> > #
> > # Since: 2.10
> > ##
> > diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
> > index dfd6a6c5bee..53b06a94508 100644
> > --- a/scripts/qapi/parser.py
> > +++ b/scripts/qapi/parser.py
> > @@ -548,6 +548,21 @@ def get_doc(self) -> 'QAPIDoc':
> > r'(Returns|Errors|Since|Notes?|Examples?|TODO):
> *',
> > line):
> > # tagged section
> > +
> > + # TODO: Remove this error sometime in 2025 or so
> > + # after we've fully transitioned to the new qapidoc
> > + # generator.
> > +
> > + # See commit message for more markup suggestions
> O:-)
> > + if 'Note' in match.group(1):
> > + emsg = (
> > + f"The '{match.group(1)}' section is no
> longer "
> > + "supported. Please use rST's '.. note::' or
> "
> > + "'.. admonition:: notes' directives, or
> another "
> > + "suitable admonition instead."
> > + )
> > + raise QAPIParseError(self, emsg)
> > +
> > doc.new_tagged_section(self.info, match.group(1))
> > text = line[match.end():]
> > if text:
> > diff --git a/tests/qapi-schema/doc-empty-section.err
> b/tests/qapi-schema/doc-empty-section.err
> > index 5f03a6d733f..711a0d629c2 100644
> > --- a/tests/qapi-schema/doc-empty-section.err
> > +++ b/tests/qapi-schema/doc-empty-section.err
> > @@ -1 +1 @@
> > -doc-empty-section.json:6: text required after 'Note:'
> > +doc-empty-section.json:6: text required after 'Errors:'
> > diff --git a/tests/qapi-schema/doc-empty-section.json
> b/tests/qapi-schema/doc-empty-section.json
> > index f3384e9a3bb..f179d3eff6d 100644
> > --- a/tests/qapi-schema/doc-empty-section.json
> > +++ b/tests/qapi-schema/doc-empty-section.json
> > @@ -3,6 +3,6 @@
> > ##
> > # @foo:
> > #
> > -# Note:
> > +# Errors:
> > ##
> > { 'command': 'foo', 'data': {'a': 'int'} }
> > diff --git a/tests/qapi-schema/doc-good.json
> b/tests/qapi-schema/doc-good.json
> > index 8b39eb946af..4b338cc0186 100644
> > --- a/tests/qapi-schema/doc-good.json
> > +++ b/tests/qapi-schema/doc-good.json
> > @@ -29,7 +29,7 @@
> > # - Second list
> > # Note: still in list
> > #
> > -# Note: not in list
> > +# .. note:: not in list
>
> Uh... see [*] below.
>
> > #
> > # 1. Third list
> > # is numbered
> > @@ -157,7 +157,7 @@
> > # @cmd-feat1: a feature
> > # @cmd-feat2: another feature
> > #
> > -# Note: @arg3 is undocumented
> > +# .. note:: @arg3 is undocumented
> > #
> > # Returns: @Object
> > #
> > @@ -165,7 +165,7 @@
> > #
> > # TODO: frobnicate
> > #
> > -# Notes:
> > +# .. admonition:: Notes
> > #
> > # - Lorem ipsum dolor sit amet
> > # - Ut enim ad minim veniam
> > diff --git a/tests/qapi-schema/doc-good.out
> b/tests/qapi-schema/doc-good.out
> > index 435f6e6d768..2c9b4e419cb 100644
> > --- a/tests/qapi-schema/doc-good.out
> > +++ b/tests/qapi-schema/doc-good.out
> > @@ -76,7 +76,7 @@ Not in list
> > - Second list
> > Note: still in list
> >
> > -Note: not in list
>
> [*] This demonstrates the "Note: ..." is *not* recognized as a "Note"
> section before the patch (compare to the change we get for recognized
> sections below).
>
> Obscure fact: the doc parser recognizes tagged sections *only* in
> definition documentation. Arguably a misfeature.
>
> Your series makes the misfeature even more obscure, because afterwards,
> the only tagged section left that could make sense in a free-form doc
> comment is "TODO". Let's not worry about the misfeature now.
>
Right, it's gonna go away or be heavily reduced. A fish for another fry.
> Two sensible solutions:
>
> 1. Since the patch converts tagged sections, and this isn't, don't touch
> it. If you feel you want to mention this in the commit message, go
> ahead.
>
Oh, uh. Alright. I wonder why I changed it then. I thought I was playing
error message whackamole with this one, but maybe I did do a regexp at some
point.
I'll leave it be if I can. If I can't, for some reason, then ...
> 2. Touch it anyway. Do mention it in the commit message then.
>
... This, with why I couldn't leave it be.
> > +.. note:: not in list
> >
> > 1. Third list
> > is numbered
> > @@ -169,15 +169,17 @@ description starts on the same line
> > a feature
> > feature=cmd-feat2
> > another feature
> > - section=Note
> > -@arg3 is undocumented
> > + section=None
> > +.. note:: @arg3 is undocumented
> > section=Returns
> > @Object
> > section=Errors
> > some
> > section=TODO
> > frobnicate
> > - section=Notes
> > + section=None
> > +.. admonition:: Notes
> > +
> > - Lorem ipsum dolor sit amet
> > - Ut enim ad minim veniam
> >
> > diff --git a/tests/qapi-schema/doc-good.txt
> b/tests/qapi-schema/doc-good.txt
> > index 847db70412d..b89f35d5476 100644
> > --- a/tests/qapi-schema/doc-good.txt
> > +++ b/tests/qapi-schema/doc-good.txt
> > @@ -17,7 +17,9 @@ Not in list
> >
> > * Second list Note: still in list
> >
> > -Note: not in list
> > +Note:
> > +
> > + not in list
> >
> > 1. Third list is numbered
> >
> > @@ -193,11 +195,9 @@ Features
> > "cmd-feat2"
> > another feature
> >
> > +Note:
> >
> > -Note
> > -~~~~
> > -
> > -"arg3" is undocumented
> > + "arg3" is undocumented
> >
> >
> > Returns
> > @@ -211,9 +211,7 @@ Errors
> >
> > some
> >
> > -
> > -Notes
> > -~~~~~
> > +Notes:
> >
> > * Lorem ipsum dolor sit amet
> >
> > diff --git a/tests/qapi-schema/doc-interleaved-section.json
> b/tests/qapi-schema/doc-interleaved-section.json
> > index adb29e98daa..b26bc0bbb79 100644
> > --- a/tests/qapi-schema/doc-interleaved-section.json
> > +++ b/tests/qapi-schema/doc-interleaved-section.json
> > @@ -10,7 +10,7 @@
> > #
> > # bao
> > #
> > -# Note: a section.
> > +# Returns: a section.
> > #
> > # @foobar: catch this
> > #
>
> "Returns:" is only valid for commands, and this is a struct. Let's use
> "TODO:" instead.
>
Weird that it didn't prohibit it. Bug?
--js
>
[-- Attachment #2: Type: text/html, Size: 18007 bytes --]
next prev parent reply other threads:[~2024-06-20 15:40 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 0:29 [PATCH 00/13] qapi: convert "Note" and "Example" sections to rST John Snow
2024-06-19 0:30 ` [PATCH 01/13] [DO-NOT-MERGE]: Add some ad-hoc linting helpers John Snow
2024-06-19 0:30 ` [PATCH 02/13] qapi: linter fixups John Snow
2024-06-19 0:30 ` [PATCH 03/13] docs/qapidoc: delint a tiny portion of the module John Snow
2024-06-19 6:28 ` Markus Armbruster
2024-06-19 17:06 ` John Snow
2024-06-19 0:30 ` [PATCH 04/13] qapi/parser: preserve indentation in QAPIDoc sections John Snow
2024-06-19 12:03 ` Markus Armbruster
2024-06-20 14:47 ` John Snow
2024-06-20 15:07 ` Markus Armbruster
2024-06-20 15:14 ` John Snow
2024-06-21 6:38 ` Markus Armbruster
2024-06-21 17:28 ` John Snow
2024-06-22 8:48 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 05/13] qapi/parser: fix comment parsing immediately following a doc block John Snow
2024-06-19 12:04 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 06/13] docs/qapidoc: fix nested parsing under untagged sections John Snow
2024-06-19 12:05 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 07/13] qapi: fix non-compliant JSON examples John Snow
2024-06-19 12:07 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 08/13] qapi: ensure all errors sections are uniformly typset John Snow
2024-06-19 12:10 ` Markus Armbruster
2024-06-20 15:25 ` John Snow
2024-06-19 0:30 ` [PATCH 09/13] qapi: convert "Note" sections to plain rST John Snow
2024-06-19 12:49 ` Markus Armbruster
2024-06-20 13:35 ` Markus Armbruster
2024-06-20 15:46 ` John Snow
2024-06-20 18:44 ` John Snow
2024-06-21 12:23 ` Markus Armbruster
2024-06-21 17:41 ` John Snow
2024-06-22 8:52 ` Markus Armbruster
2024-06-20 15:39 ` John Snow [this message]
2024-06-21 10:20 ` Markus Armbruster
2024-06-19 13:07 ` Markus Armbruster
2024-06-20 15:40 ` John Snow
2024-06-21 6:39 ` Markus Armbruster
2024-06-20 13:54 ` Markus Armbruster
2024-06-20 15:52 ` John Snow
2024-06-21 12:08 ` Markus Armbruster
2024-06-21 17:33 ` John Snow
2024-06-19 0:30 ` [PATCH 10/13] qapi: update prose in note blocks John Snow
2024-06-19 12:18 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 11/13] qapi: add markup to " John Snow
2024-06-19 12:19 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 12/13] qapi/parser: don't parse rST markup as section headers John Snow
2024-06-19 12:55 ` Markus Armbruster
2024-06-19 0:30 ` [PATCH 13/13] qapi: convert "Example" sections to rST John Snow
2024-06-19 13:20 ` Markus Armbruster
2024-06-19 17:32 ` John Snow
2024-06-26 5:17 ` Markus Armbruster
2024-06-26 14:39 ` John Snow
2024-06-26 5:35 ` [PATCH 00/13] qapi: convert "Note" and " Markus Armbruster
2024-07-01 20:28 ` Michael S. Tsirkin
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='CAFn=p-aF1_1dvEyihagePrgRF_d7=JDXLUttyJzcxbo355xoCQ@mail.gmail.com' \
--to=jsnow@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=anisinha@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=clg@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).