From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Konstantin Kostiuk" <kkostiuk@redhat.com>,
"Victor Toso" <victortoso@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: qapi: [RFC] Doc comment convention for @arg: sections
Date: Fri, 24 Mar 2023 15:25:35 +0100 [thread overview]
Message-ID: <87wn36mdk0.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA9A5Gbfz3-os+NV1ACYrH90sGXeNOMzE-1qcZp+Xvqh-g@mail.gmail.com> (Peter Maydell's message of "Fri, 24 Mar 2023 12:42:26 +0000")
Peter Maydell <peter.maydell@linaro.org> writes:
> On Fri, 24 Mar 2023 at 12:05, Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>> > On Thu, 23 Mar 2023 at 14:48, Markus Armbruster <armbru@redhat.com> wrote:
>> >>
>> >> The QAPI schema doc comment language provides special syntax for command
>> >> and event arguments, struct and union members, alternate branches,
>> >> enumeration values, and features: "sections" starting with @arg:.
>> >>
>> >> By convention, we format them like this:
>> >>
>> >> # @arg: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
>> >> # do eiusmod tempor incididunt ut labore et dolore magna
>> >> # aliqua.
>> >>
>> >> Okay for names as short as "name", but we have much longer ones. Their
>> >> description gets squeezed against the right margin, like this:
>> >>
>> >> # @dirty-sync-missed-zero-copy: Number of times dirty RAM synchronization could
>> >> # not avoid copying dirty pages. This is between
>> >> # 0 and @dirty-sync-count * @multifd-channels.
>> >> # (since 7.1)
>> >>
>> >> The description is effectively 50 characters wide. Easy enough to read,
>> >> but awkward to write.
>> >
>> > The documentation also permits a second form:
>> >
>> > # @argone:
>> > # This is a two line description
>> > # in the first style.
>>
>> Yes. We use this in exactly one place: the guest agent's GuestOSInfo.
>>
>> > We tend to use that for type names, not field names, but IIRC
>> > it's the same handling for both.
>>
>> Kind of.
>>
>> Definition documentation consist of "sections".
>>
>> The first section (called "body" in the code) starts with a line of the
>> from
>>
>> # @NAME:
>>
>> Nothing may follow the colon.
>>
>> Ordinary text may follow. Indentation is not stripped.
>
> I guess this has changed since I added the rst stuff. Back
> at the time (assuming my email comments at that time are
> correct) this was all basically in the same code path, so
> the "allow field descriptions that start on the following line"
> falls out of having to handle "allow section definitions with
> text that starts on the following line".
Could be the same path in qapidoc.py, but has always been separate in
parser.py, as far as I remember.
>> Our current doc comment syntax has two layers:
>>
>> 1. The upper layer uses home-grown markup (= heading, @def: for special
>> definition lists, @ref to reference QAPI names, tag: special
>> sections).
>>
>> 2. The lower layer is reStructuredText.
>>
>> Parsing mirrors this:
>>
>> 1. parser.py parses the upper layer into an internal representation.
>>
>> 2. Sphinx extension qapidoc.py maps this internal representation to
>> Sphinx's. It feeds its text parts to the rST parser, and splices its
>> output into the Sphinx IR.
>>
>> I'm wary of blurring the boundary between the two. If we use rST syntax
>> for argument sections, parser.py effectively parses a limited subset of
>> rST. Second-guessing the real rST parser doesn't feel wise to me.
>
> I didn't mean to say "use rst syntax entirely throughout"
> so much as "use the same rules for multi-line syntax that rst does,
> not a subtly different set of rules". We could keep our @markup stuff.
Fair point.
prev parent reply other threads:[~2023-03-24 15:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 14:48 qapi: [RFC] Doc comment convention for @arg: sections Markus Armbruster
2023-03-23 16:20 ` Peter Maydell
2023-03-24 12:05 ` Markus Armbruster
2023-03-24 12:42 ` Peter Maydell
2023-03-24 14:25 ` Markus Armbruster [this message]
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=87wn36mdk0.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=kkostiuk@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=victortoso@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 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).