From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUygP-0002MN-Mx for qemu-devel@nongnu.org; Thu, 06 Dec 2018 13:47:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUygM-0002Gd-Eu for qemu-devel@nongnu.org; Thu, 06 Dec 2018 13:47:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUygM-0002G9-68 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 13:47:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D5D9A834C for ; Thu, 6 Dec 2018 18:47:29 +0000 (UTC) From: Markus Armbruster References: <20180706105753.26700-1-marcandre.lureau@redhat.com> <20180706105753.26700-24-marcandre.lureau@redhat.com> Date: Thu, 06 Dec 2018 19:46:58 +0100 In-Reply-To: <20180706105753.26700-24-marcandre.lureau@redhat.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Fri, 6 Jul 2018 12:57:49 +0200") Message-ID: <875zw67asd.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v6 23/27] qapi: add 'If:' condition to enum values documentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: qemu-devel@nongnu.org Marc-Andr=C3=A9 Lureau writes: > Signed-off-by: Marc-Andr=C3=A9 Lureau > --- > scripts/qapi/doc.py | 5 ++++- > tests/qapi-schema/doc-good.json | 4 +++- > tests/qapi-schema/doc-good.out | 1 + > tests/qapi-schema/doc-good.texi | 2 ++ > 4 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py > index 76cb186ff9..196deea11d 100755 > --- a/scripts/qapi/doc.py > +++ b/scripts/qapi/doc.py > @@ -128,7 +128,10 @@ def texi_body(doc): >=20=20 > def texi_enum_value(value): > """Format a table of members item for an enumeration value""" > - return '@item @code{%s}\n' % value.name > + return '@item @code{%s}%s\n' % ( > + value.name, > + '\n@b{If:} @code{%s}\n' % > + ', '.join(value.ifcond) if value.ifcond else '') >=20=20 >=20=20 This code is a puzzle. I don't like code puzzles. > def texi_member(member, suffix=3D''): > diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good= .json > index 984cd8ed06..c7fe08c530 100644 > --- a/tests/qapi-schema/doc-good.json > +++ b/tests/qapi-schema/doc-good.json > @@ -55,7 +55,9 @@ > # > # @two is undocumented > ## > -{ 'enum': 'Enum', 'data': [ 'one', 'two' ], 'if': 'defined(IFCOND)' } > +{ 'enum': 'Enum', 'data': > + [ { 'name': 'one', 'if': 'defined(IFENUM)' }, 'two' ], > + 'if': 'defined(IFCOND)' } >=20=20 > ## > # @Base: > diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.= out > index c2fc5c774a..a05535b69b 100644 > --- a/tests/qapi-schema/doc-good.out > +++ b/tests/qapi-schema/doc-good.out > @@ -11,6 +11,7 @@ enum QType > module doc-good.json > enum Enum > member one > + if ['defined(IFENUM)'] > member two > if ['defined(IFCOND)'] > object Base > diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good= .texi > index e42eace474..2446a1c702 100644 > --- a/tests/qapi-schema/doc-good.texi > +++ b/tests/qapi-schema/doc-good.texi > @@ -83,6 +83,8 @@ Examples: > @b{Values:} > @table @asis > @item @code{one} > +@b{If:} @code{defined(IFENUM)} > + > The @emph{one} @{and only@} > @item @code{two} > Not documented Odd: the @item is followed by a blank line only if its conditional. Formatted to plain text, it looks like this: -- Enum: Enum Values: 'one' If: 'defined(IFENUM)' The _one_ {and only} 'two' Not documented 'two' is undocumented If: 'defined(IFCOND)' Odd^2: the "If:" line comes first for members, last for top-level expressions like types.