From nobody Tue Feb 10 12:58:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506954125775127.75262978299156; Mon, 2 Oct 2017 07:22:05 -0700 (PDT) Received: from localhost ([::1]:52538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz1bZ-0004xh-0k for importer@patchew.org; Mon, 02 Oct 2017 10:21:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz1Tq-00077t-2L for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:13:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz1Tj-0003eU-L0 for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:13:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52134) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dz1Tj-0003e2-CO for qemu-devel@nongnu.org; Mon, 02 Oct 2017 10:13:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 822BF356DB for ; Mon, 2 Oct 2017 14:13:50 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-91.ams2.redhat.com [10.36.116.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95A72183DC; Mon, 2 Oct 2017 14:13:47 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EA6FF1156277; Mon, 2 Oct 2017 16:13:41 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 822BF356DB Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=armbru@redhat.com From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 2 Oct 2017 16:13:39 +0200 Message-Id: <20171002141341.24616-10-armbru@redhat.com> In-Reply-To: <20171002141341.24616-1-armbru@redhat.com> References: <20171002141341.24616-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Oct 2017 14:13:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/11] qapi2texi: Simplify representation of section text X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use a string instead of a list of strings. While there, generate fewer superfluous blank lines. Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi2texi.py | 33 ++++++++++++++++----------------- tests/qapi-schema/doc-good.texi | 10 ---------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index 379d27643d..58add26c11 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.py @@ -13,7 +13,6 @@ MSG_FMT =3D """ @deftypefn {type} {{}} {name} =20 {body} - @end deftypefn =20 """.format @@ -22,7 +21,6 @@ TYPE_FMT =3D """ @deftp {{{type}}} {name} =20 {body} - @end deftp =20 """.format @@ -74,7 +72,7 @@ def texi_format(doc): - 1. or 1): generates an @enumerate @item - */-: generates an @itemize list """ - lines =3D [] + ret =3D '' doc =3D subst_braces(doc) doc =3D subst_vars(doc) doc =3D subst_emph(doc) @@ -100,32 +98,32 @@ def texi_format(doc): line =3D '@subsection ' + line[3:] elif re.match(r'^([0-9]*\.) ', line): if not inlist: - lines.append('@enumerate') + ret +=3D '@enumerate\n' inlist =3D 'enumerate' + ret +=3D '@item\n' line =3D line[line.find(' ')+1:] - lines.append('@item') elif re.match(r'^[*-] ', line): if not inlist: - lines.append('@itemize %s' % {'*': '@bullet', - '-': '@minus'}[line[0]]) + ret +=3D '@itemize %s\n' % {'*': '@bullet', + '-': '@minus'}[line[0]] inlist =3D 'itemize' - lines.append('@item') + ret +=3D '@item\n' line =3D line[2:] elif lastempty and inlist: - lines.append('@end %s\n' % inlist) + ret +=3D '@end %s\n\n' % inlist inlist =3D '' =20 lastempty =3D empty - lines.append(line) + ret +=3D line + '\n' =20 if inlist: - lines.append('@end %s\n' % inlist) - return '\n'.join(lines) + ret +=3D '@end %s\n\n' % inlist + return ret =20 =20 def texi_body(doc): """Format the main documentation body""" - return texi_format(doc.body.text) + '\n' + return texi_format(doc.body.text) =20 =20 def texi_enum_value(value): @@ -154,10 +152,11 @@ def texi_members(doc, what, base, variants, member_fu= nc): elif (variants and variants.tag_member =3D=3D section.member and not section.member.type.doc_type()): values =3D section.member.type.member_names() - desc =3D 'One of ' + ', '.join(['@t{"%s"}' % v for v in values= ]) + members_text =3D ', '.join(['@t{"%s"}' % v for v in values]) + desc =3D 'One of ' + members_text + '\n' else: - desc =3D 'Not documented' - items +=3D member_func(section.member) + desc + '\n' + desc =3D 'Not documented\n' + items +=3D member_func(section.member) + desc if base: items +=3D '@item The members of @code{%s}\n' % base.doc_type() if variants: @@ -182,7 +181,7 @@ def texi_sections(doc): for section in doc.sections: if section.name: # prefer @b over @strong, so txt doesn't translate it to *Foo:* - body +=3D '\n\n@b{%s:}\n' % section.name + body +=3D '\n@b{%s:}\n' % section.name if section.name and section.name.startswith('Example'): body +=3D texi_example(section.text) else: diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.t= exi index c032f23fc1..1778312581 100644 --- a/tests/qapi-schema/doc-good.texi +++ b/tests/qapi-schema/doc-good.texi @@ -101,7 +101,6 @@ Not documented the first member @end table =20 - @end deftp =20 =20 @@ -118,7 +117,6 @@ Another paragraph (but no @code{var}: line) Not documented @end table =20 - @end deftp =20 =20 @@ -127,7 +125,6 @@ Not documented =20 =20 =20 - @end deftp =20 =20 @@ -143,7 +140,6 @@ Not documented @item The members of @code{Variant2} when @code{base1} is @t{"two"} @end table =20 - @end deftp =20 =20 @@ -160,7 +156,6 @@ One of @t{"one"}, @t{"two"} @item @code{data: Variant2} when @code{type} is @t{"two"} @end table =20 - @end deftp =20 =20 @@ -182,7 +177,6 @@ argument Not documented @end table =20 - @b{Note:} @code{arg3} is undocumented =20 @@ -209,14 +203,12 @@ Duis aute irure dolor <- out @end example =20 - @b{Examples:} @example - *verbatim* - @{braces@} @end example =20 - @b{Since:} 2.10 =20 @@ -230,7 +222,6 @@ If you're bored enough to read this, go see a video of = boxed cats =20 @b{Arguments:} the members of @code{Object} =20 - @b{Example:} @example -> in @@ -238,7 +229,6 @@ If you're bored enough to read this, go see a video of = boxed cats <- out @end example =20 - @end deftypefn =20 =20 --=20 2.13.6