QEMU-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael Roth" <michael.roth@amd.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2 08/13] qapi/docs: Add rendering for INTRO sections
Date: Wed, 13 May 2026 08:25:58 +0200	[thread overview]
Message-ID: <87ecjfvn9l.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFn=p-Z5U8Zy0OiDuM8fpR26xvBHQZ8v=6yCBvU899jOPJYQwQ@mail.gmail.com> (John Snow's message of "Tue, 12 May 2026 17:13:09 -0400")

John Snow <jsnow@redhat.com> writes:

> On Mon, May 4, 2026 at 8:05 AM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> John Snow <jsnow@redhat.com> writes:
>>
>> > The only real difference here is that we need to dedent all but the
>> > first line so that it renders correctly. We don't need to do this for
>> > members and features because they are always rendered as part of a field
>> > list directive which expects indented lines - Undecorated plaintext
>> > doesn't, so we chop the indent off.
>> >
>> > This does not reflow the text or mess with the source info in any way,
>> > so "blame" for error messages should be unchanged.
>> >
>> > Signed-off-by: John Snow <jsnow@redhat.com>
>> > ---
>> >  docs/sphinx/qapidoc.py | 14 +++++++++++---
>> >  1 file changed, 11 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
>> > index 70ab9cdc214..6b8e4ecd76a 100644
>> > --- a/docs/sphinx/qapidoc.py
>> > +++ b/docs/sphinx/qapidoc.py
>> > @@ -35,6 +35,7 @@
>> >  from pathlib import Path
>> >  import re
>> >  import sys
>> > +import textwrap
>> >  from typing import TYPE_CHECKING
>> >
>> >  from docutils import nodes
>> > @@ -150,8 +151,14 @@ def add_lines(
>> >          self,
>> >          content: str,
>> >          info: QAPISourceInfo,
>> > +        dedent: bool = False,
>> >      ) -> None:
>> >          lines = content.splitlines(True)
>> > +
>> > +        if dedent:
>> > +            txt = "".join(lines[1:])
>> > +            lines[1:] = textwrap.dedent(txt).splitlines(True)
>> > +
>>
>> Sure you want to wrap and not just remove indentation?
>
> "textwrap" is the module, "dedent" is the function. This really is
> just removing indentation. It just happens to be bundled with the
> "textwrap" stdlib module.

Basic reading comprehension fail, my apologies.

>> >          for i, line in enumerate(lines):
>> >              self.add_line_raw(line, info.fname, info.line + i)
>> >
>> > @@ -223,13 +230,14 @@ def reformat_arobase(text: str) -> str:
>> >
>> >      # Transmogrification helpers
>> >
>> > -    def visit_paragraph(self, section: QAPIDoc.Section) -> None:
>> > +    def visit_text(self, section: QAPIDoc.Section) -> None:
>>
>> This is what gets used for sections of kind PLAIN and INTRO.  Can we
>> come up with a better term for these than "text"?  Your turf, so I
>> *will* take no for an answer.
>
> "patches welcome" - I was just avoiding the use of "paragraph" for
> something that might be multiple paragraphs.

Could use "paragraphs".

>                                              Once the literal "PLAIN"
> section is removed (in favor of semantic successors INTRO and
> DETAILS), we can use "visit_plaintext" to refer to the general
> category, but currently it's semantically overloaded.
>
> How about I just do "visit_plaintext" and we suffer with the slight
> ambiguity for the interim? not married to "text", "plaintext" or
> anything else, just don't have better ideas and naming is one of the
> two hard problems in CS.

The temporary ambiguity feels tolerable.

"plaintext" is probably clearer than "paragraphs" once it's no longer
ambiguous.

Thanks!



  reply	other threads:[~2026-05-13  6:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 19:25 [PATCH v2 00/13] qapi: add formal "intro" section John Snow
2026-04-29 19:25 ` [PATCH v2 01/13] tests/qapi: generate output in source order John Snow
2026-05-04  9:50   ` Markus Armbruster
2026-05-04 17:55     ` John Snow
2026-04-29 19:26 ` [PATCH v2 02/13] qapi/docs: remove unused QAPIDoc subsection members John Snow
2026-05-04  9:51   ` Markus Armbruster
2026-04-29 19:26 ` [PATCH v2 03/13] qapi/docs: make remaining subsection members "private" John Snow
2026-05-04  9:54   ` Markus Armbruster
2026-05-04 18:07     ` John Snow
2026-04-29 19:26 ` [PATCH v2 04/13] qapi/docs: add "Intro" section John Snow
2026-04-29 19:26 ` [PATCH v2 05/13] qapi/docs: adjust stub member insertion algorithm John Snow
2026-05-04 11:20   ` Markus Armbruster
2026-05-04 18:30     ` John Snow
2026-05-05 13:54       ` Markus Armbruster
2026-05-04 18:33     ` John Snow
2026-04-29 19:26 ` [PATCH v2 06/13] qapi/docs: remove implicit Plain section John Snow
2026-04-29 19:26 ` [PATCH v2 07/13] qapi/docs: add "Intro" section parsing John Snow
2026-05-04 11:57   ` Markus Armbruster
2026-05-04 18:44     ` John Snow
2026-05-05 13:30       ` Markus Armbruster
2026-04-29 19:26 ` [PATCH v2 08/13] qapi/docs: Add rendering for INTRO sections John Snow
2026-05-04 12:05   ` Markus Armbruster
2026-05-12 21:13     ` John Snow
2026-05-13  6:25       ` Markus Armbruster [this message]
2026-04-29 19:26 ` [PATCH v2 09/13] qapi: convert intro sections for accelerator.json John Snow
2026-04-29 19:26 ` [PATCH v2 10/13] qapi: convert intro sections for acpi-hest.json John Snow
2026-04-29 19:26 ` [PATCH v2 11/13] qapi: convert intro sections for acpi.json John Snow
2026-04-29 19:26 ` [PATCH v2 12/13] qapi: convert intro sections for audio.json John Snow
2026-04-29 19:26 ` [PATCH v2 13/13] rfc: intro starts on next line John Snow

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=87ecjfvn9l.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=eblake@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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