All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"Jiri Pirko" <jiri@resnulli.us>, "Fan Ni" <fan.ni@samsung.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Jonathan Cameron" <jonathan.cameron@huawei.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Kashyap Chamarthy" <kchamart@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>, "Mads Ynddal" <mads@ynddal.dk>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Kevin Wolf" <kwolf@redhat.com>, "Eric Blake" <eblake@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Peter Xu" <peterx@redhat.com>, "Cleber Rosa" <crosa@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Konstantin Kostiuk" <kkostiuk@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Zhenwei Pi" <pizhenwei@bytedance.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Lukas Straub" <lukasstraub2@web.de>
Subject: Re: [PATCH v3 4/5] docs/sphinx: remove special parsing for freeform sections
Date: Mon, 30 Jun 2025 14:32:56 +0200	[thread overview]
Message-ID: <875xgd9zpj.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFn=p-ZkBt8ck7WWg_1FFBi5GoYmyEhVPZGfdL4ODN6GBn3YSw@mail.gmail.com> (John Snow's message of "Fri, 27 Jun 2025 12:49:53 -0400")

John Snow <jsnow@redhat.com> writes:

> On Fri, Jun 27, 2025, 5:52 AM Markus Armbruster <armbru@redhat.com> wrote:
>
>> John Snow <jsnow@redhat.com> writes:
>>
>> > This change removes special parsing for freeform sections and allows
>> > them to simply be unmodified rST syntax. The existing headings in the
>> > QAPI schema are adjusted to reflect the new paradigm.
>>
>> "Allows them to" suggests the patch enables use of rST headings.  Is
>> this the case?  Or do they just work, and this patch just switches
>> schema code to use them, and drops now unnecessary generator code?
>>
>
> Ehm... Kind of both? I guess I hadn't considered that rST headings might
> already work without the switch. I guess they didn't because of the
> headerless freeform section bug I fix in this series.

To double-check master, I use

diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 14b808f909..201462688f 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -8,7 +8,9 @@
     'documentation-exceptions': [ 'Enum', 'Variant1', 'Alternate', 'cmd' ] } }
 
 ##
-# = Section
+# *******
+# Section
+# *******
 ##
 
 ##

Doesn't work with the legacy doc generator:

    Exception occurred:
      File "/work/armbru/qemu/docs/sphinx/qapidoc_legacy.py", line 360, in _start_new_heading
        raise QAPISemError(self._cur_doc.info,
        ...<2 lines>...
                           % (level, level - 1))
    qapi.error.QAPISemError: /work/armbru/qemu/docs/../tests/qapi-schema/doc-good.json:20: Level 2 subheading found outside a level 1 heading

So switch to the new one:

diff --git a/tests/qapi-schema/doc-good.rst b/tests/qapi-schema/doc-good.rst
index 1e4c23305a..9978ac2e9c 100644
--- a/tests/qapi-schema/doc-good.rst
+++ b/tests/qapi-schema/doc-good.rst
@@ -3,3 +3,4 @@
    a plain-text output file and compare it against a reference.
 
 .. qapi-doc:: tests/qapi-schema/doc-good.json
+   :transmogrify:

Chokes on "# Errors: some", you fix this (unrelated) bug in PATCH 1.  I
could apply that fix, but instead I simply work around the bug:

diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 14b808f909..201462688f 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -165,7 +167,8 @@
 #
 # Returns: @Object
 #
-# Errors: some
+# Errors:
+#     some
 #
 # TODO: frobnicate
 #

The rST heading seems to work fine then.

The next-level heading

diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 14b808f9090..fac13425b72 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -16,7 +18,8 @@
 ##
 
 ##
-# == Subsection
+# Subsection
+# ==========
 #
 # *with emphasis*
 # @var {in braces}

doesn't:

    Extension error:
    /work/armbru/qemu/docs/../tests/qapi-schema/doc-good.json:22:1: '=' heading must come first in a comment block

Removed in this patch.

So you're right, "kind of both": they work just fine with the new doc
generator, except for the "====" rST headings, because the parser still
recognizes them as old-style schema doc headings.

> I guess you're technically right, I just never thought of it in that way.
>
> I'll update the message so I don't confuse you in the future.

Yes, please.

[...]



  reply	other threads:[~2025-06-30 12:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 16:53 [PATCH v3 0/5] docs: remove legacy qapidoc John Snow
2025-06-18 16:53 ` [PATCH v3 1/5] docs/sphinx: adjust qapidoc to cope with same-line error sections John Snow
2025-06-30 12:23   ` Markus Armbruster
2025-07-14  7:24     ` Markus Armbruster
2025-06-18 16:53 ` [PATCH v3 2/5] docs/sphinx: parse @references in freeform text John Snow
2025-06-27  9:54   ` Markus Armbruster
2025-06-27 16:40     ` John Snow
2025-06-18 16:53 ` [PATCH v3 3/5] docs/sphinx: remove legacy QAPI manual generator John Snow
2025-06-27  9:53   ` Markus Armbruster
2025-06-18 16:53 ` [PATCH v3 4/5] docs/sphinx: remove special parsing for freeform sections John Snow
2025-06-27  9:52   ` Markus Armbruster
2025-06-27 16:44     ` John Snow
2025-06-27 16:49     ` John Snow
2025-06-30 12:32       ` Markus Armbruster [this message]
2025-07-14  7:20         ` Markus Armbruster
2025-06-18 16:53 ` [PATCH v3 5/5] qapi: lift restriction on using '=' in doc blocks John Snow
2025-06-27  9:41   ` Markus Armbruster
2025-07-14  8:09 ` [PATCH v3 0/5] docs: remove legacy qapidoc Markus Armbruster

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=875xgd9zpj.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=berrange@redhat.com \
    --cc=clg@redhat.com \
    --cc=crosa@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=fan.ni@samsung.com \
    --cc=farosas@suse.de \
    --cc=hreitz@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=jonathan.cameron@huawei.com \
    --cc=jsnow@redhat.com \
    --cc=kchamart@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=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pizhenwei@bytedance.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@yandex-team.ru \
    --cc=wangyanan55@huawei.com \
    --cc=zhao1.liu@intel.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.