From nobody Sun Feb 8 23:26:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599548317; cv=none; d=zohomail.com; s=zohoarc; b=SUyeJCaBk0Vdy5fz8mTEM7Fcj6ihjCyisVCEYDG3G1S0EeTNGjZph+335+4gqO+A71YS/dyCkbSpe4wOvEOA78ouX6maNrO4cNHaRhwVAmGGTgASAgpXH7WOCQhUb25Pe9KIv3bt+pqMX+N362nngjJOus5h0ngPguQbyEkc/W8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599548317; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e0Ubs2uV2UEdHWgEjuOwfwCOCjyIjZmVF40Od2GCpBI=; b=d5m9/IXcfJCGY/ZUaS/YubYgULjATo2eYar0tLmN527vpt61Bnk/VPd/nJ+VgL2/wJdVXCSzSHr3yTSHA26bcWxTN4kV6DsIzkUQIE6zEIXqwgIwvTglOmP/Q9dS6W6qHbOr/hY0PMToW2DS5jpSDq4N48Cpgb7n3HwWarqSl3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599548317127948.3320430640214; Mon, 7 Sep 2020 23:58:37 -0700 (PDT) Received: from localhost ([::1]:49218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFXaN-0006rE-Nr for importer@patchew.org; Tue, 08 Sep 2020 02:58:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFXWO-0001Jj-Um for qemu-devel@nongnu.org; Tue, 08 Sep 2020 02:54:28 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:27143 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kFXWK-0008Co-JL for qemu-devel@nongnu.org; Tue, 08 Sep 2020 02:54:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-eQcoPOgNPMmKwCWY0Lv22g-1; Tue, 08 Sep 2020 02:54:20 -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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 868361008548; Tue, 8 Sep 2020 06:54:19 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-68.ams2.redhat.com [10.36.113.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3EB9360C0F; Tue, 8 Sep 2020 06:54:19 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 894B91132941; Tue, 8 Sep 2020 08:54:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599548064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e0Ubs2uV2UEdHWgEjuOwfwCOCjyIjZmVF40Od2GCpBI=; b=T3hPel38Ebam7owlJlwgED9Wv0/gsNBPrXsLxcCKKDpAVuqWmPUdh3H5qN21pM7xKRudTb o8wvwSNVMjYBemxc9lNpJrKUgkh9P0NPfekjhT/+jKK11Q9+vD3xKDH8LQvteloa6hLkzl v8F7MWS3ExeY5wX7Dv1DEfXDlR4AH0E= X-MC-Unique: eQcoPOgNPMmKwCWY0Lv22g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 2/5] qapi: Make section headings start a new doc comment block Date: Tue, 8 Sep 2020 08:54:14 +0200 Message-Id: <20200908065417.3158250-3-armbru@redhat.com> In-Reply-To: <20200908065417.3158250-1-armbru@redhat.com> References: <20200908065417.3158250-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 00:33:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Our current QAPI doc-comment markup allows section headers (introduced with a leading '=3D' or '=3D=3D') anywhere in a free-form documentation comment. This works for Texinfo because the generator simply prints a Texinfo section command at that point in the output stream. For rST generation, since we're assembling a tree of docutils nodes, this is awkward because a new section implies starting a new section node at the top level of the tree and generating text into there. Make section headers start a new free-form documentation block, so the future rST document generator doesn't have to look at every line in free-form blocks and handle headings in odd places. This change makes no difference to the generated Texinfo. Signed-off-by: Markus Armbruster Message-Id: <20200320091805.5585-3-armbru@redhat.com> --- scripts/qapi/parser.py | 21 +++++++++++++-------- tests/qapi-schema/doc-good.out | 3 ++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index f12c67d7d2..165925ca72 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -52,8 +52,8 @@ class QAPISchemaParser: info =3D self.info if self.tok =3D=3D '#': self.reject_expr_doc(cur_doc) - cur_doc =3D self.get_doc(info) - self.docs.append(cur_doc) + for cur_doc in self.get_doc(info): + self.docs.append(cur_doc) continue =20 expr =3D self.get_expr(False) @@ -270,7 +270,8 @@ class QAPISchemaParser: raise QAPIParseError( self, "junk after '##' at start of documentation comment") =20 - doc =3D QAPIDoc(self, info) + docs =3D [] + cur_doc =3D QAPIDoc(self, info) self.accept(False) while self.tok =3D=3D '#': if self.val.startswith('##'): @@ -279,15 +280,20 @@ class QAPISchemaParser: raise QAPIParseError( self, "junk after '##' at end of documentation comment") - doc.end_comment() + cur_doc.end_comment() + docs.append(cur_doc) self.accept() - return doc + return docs if self.val.startswith('# =3D'): - if doc.symbol: + if cur_doc.symbol: raise QAPIParseError( self, "unexpected '=3D' markup in definition documentati= on") - doc.append(self.val) + if cur_doc.body.text: + cur_doc.end_comment() + docs.append(cur_doc) + cur_doc =3D QAPIDoc(self, info) + cur_doc.append(self.val) self.accept(False) =20 raise QAPIParseError(self, "documentation comment must end with '#= #'") @@ -316,7 +322,6 @@ class QAPIDoc: def __init__(self, name=3DNone): # optional section name (argument/member or section name) self.name =3D name - # the list of lines for this section self.text =3D '' =20 def append(self, line): diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index 6757dd26a2..d78a424cd9 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -69,7 +69,8 @@ event EVT-BOXED Object doc freeform body=3D =3D Section - +doc freeform + body=3D =3D=3D Subsection =20 *strong* _with emphasis_ --=20 2.26.2