From patchwork Thu Feb 6 17:30:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 183129 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1849080ile; Thu, 6 Feb 2020 09:49:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwlfDfUGXd1UwEy8HivwcMhtJqN7QW5zh+qphV+JfCs4ZvTx0+RLXTEQ7LYZzoPKCMOkK8Y X-Received: by 2002:a05:620a:6b8:: with SMTP id i24mr3741352qkh.9.1581011353994; Thu, 06 Feb 2020 09:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581011353; cv=none; d=google.com; s=arc-20160816; b=ciX9/zBfSx+P7BSLpT6nBoi0FsMs6beDWGu1/N8KuJ5S26K5WTB1rKBUgmdb6cZCSg 9Of7QgSq48VFb8Y4abNSO6nszQZZGCU6q/7258uuaEWQQu6QRZUl9RByzXqEmR3m4NWn E6vsPyhlYFw/nX8tUr33qt89JUd5zJEb7R3RQDKbqIHi2pSTRPc8sJ/RNITLcTeoqdSc CtK3JpsoPCvSNE7qL7gpiXGEFQ+hRAfwRXQ5RWi6u4f1fds0RNNGdJm2nn5KQ/2t84g1 RFMUxTwJ1o024XFycCEb7vgcg2LEEJ9mb9QQ7oDmYe7rQMrnth8PGWxtfmmAbnJhJURM yAIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=AtxEKrKRqNjfOrT9JbNHlMjgTudjr9VoMdnqfaiOYHo=; b=vCI/cXWL+9UiwqUkMGvyZLo4mTsdwXFLCrVQUDLDhJImGIBmcdNs46CBoPAdaoulhC XVrgkCSe55h//Q6om7SpT4uXGcv8UJtAhJwDZRP5lFhwSFvScminuqq4COkp0N+e5w81 P/h1AaeA1sq/LE9HirC0aMEogWKTmZtaGONmdTzsjKH5aETpL0pti6zfVM+5HKZd6Hzp Jhwa4pV41abGS/iUGLFc4zfN1SafR6sDZfLsbHaXr2A3ab9+wVpostWdT10z0hWY5Vu5 L8EtkGsnTJeBpNjjUxnHvxSHz9rymKNo/LJQUFUZknU11CugWo1O904iCxCNw3Ekesu8 LWpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pbmruM8Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e25si2033643qkl.373.2020.02.06.09.49.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Feb 2020 09:49:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pbmruM8Y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izlH7-0003RR-Gc for patch@linaro.org; Thu, 06 Feb 2020 12:49:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43720) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izl0E-00077M-RN for qemu-devel@nongnu.org; Thu, 06 Feb 2020 12:31:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izl0D-0007PV-8r for qemu-devel@nongnu.org; Thu, 06 Feb 2020 12:31:46 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izl0D-0007Lw-0q for qemu-devel@nongnu.org; Thu, 06 Feb 2020 12:31:45 -0500 Received: by mail-wr1-x441.google.com with SMTP id m16so8171841wrx.11 for ; Thu, 06 Feb 2020 09:31:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AtxEKrKRqNjfOrT9JbNHlMjgTudjr9VoMdnqfaiOYHo=; b=pbmruM8YbkTpjiYhOedn8z5wFg4jSKmwzn+kn7hTm033lhV5v/TH2hoBMf2l+Yrdwz a8sK1QuJFXpobaSBLsNX1TIaJw+JVic0fgh1rVToMc8wG9V07K0N9i0LtzF6wLJUFOTO 4L4y9fbb7aHVaq//1iEaOycU2VUhHvKudyCdOM+gyDd3elrqHFcOpZ0F0agw0woHpJNQ ZsXuAY0KnyGvzt4yszJRz/WtRXKiQoQOPJat89e3Q3IXMJtmW6/jEq9JPKABepuiGOMd /TmwuP2aeGmkowe8xTWHZjOWYhSwrYgbZ/SrXOyd3xEwRm/gULTQYNf/Rc+cwOrVXzQX qGIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AtxEKrKRqNjfOrT9JbNHlMjgTudjr9VoMdnqfaiOYHo=; b=pBm23kMOT6cwHo1RKzQ6kRgstJXNYaOq4WNKwvFkmgtSJsE/ruYZKxGeMotnH52Qej 5XQUvAPw3sm9dAxfcX4Ca6e2oOErhdh/tS6U7SN8si8eDvRvKgqLQl2pckFUoAGt8LH6 bwL64BRYfwDaIK+D2Z5NHRJ61GoQ9NhLatQ0XFLvx4ExZSYPcJOdq2OY2rz0QOCk+pzU jmAAoauAbhpMM0Bo6M4GHLh+HmFPuoWf9bVm7P/XmIkSE96HcVSWfUGadTpabK8yziV4 R+ux2/5XVth/+9G0MGOgPLr/NhICrOoKlb2ks+1DR0B8Ym6owc7QLRwpuZajtYStPzfu /hOA== X-Gm-Message-State: APjAAAU8fPJkN9xOyxouXXLnuxhI8VNonyWLdVJDO0Vj3jeRu+XxoBVr HP72aFZL+U31P0dgj84LbSY5sRIsXps= X-Received: by 2002:adf:f3cc:: with SMTP id g12mr4802565wrp.236.1581010303402; Thu, 06 Feb 2020 09:31:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w15sm5204214wrs.80.2020.02.06.09.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 09:31:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 29/29] docs/devel/qapi-code-gen.txt: Update to new rST backend conventions Date: Thu, 6 Feb 2020 17:30:40 +0000 Message-Id: <20200206173040.17337-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200206173040.17337-1-peter.maydell@linaro.org> References: <20200206173040.17337-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Michael Roth , Stefan Hajnoczi , John Snow Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update the documentation of QAPI document comment syntax to match the new rST backend requirements. The principal changes are: * whitespace is now significant, and multiline definitions must have their second and subsequent lines indented to match the first line * general rST format markup is permitted, not just the small set of markup the old texinfo generator handled. For most things (notably bulleted and itemized lists) the old format is the same as rST was. * Specific things that might trip people up: - instead of *bold* and _italic_ rST has **bold** and *italic* - lists need a preceding and following blank line - a lone literal '*' will need to be backslash-escaped to avoid a rST syntax error * the old leading '|' for example (literal text) blocks is replaced by the standard rST '::' literal block. * headings and subheadings must now be in a freeform documentation comment of their own * we support arbitrary levels of sub- and sub-sub-heading, not just a main and sub-heading like the old texinfo generator Signed-off-by: Peter Maydell --- docs/devel/qapi-code-gen.txt | 90 ++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 29 deletions(-) -- 2.20.1 diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 59d6973e1ec..688eb2a0237 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -795,21 +795,39 @@ See below for more on definition documentation. Free-form documentation may be used to provide additional text and structuring content. +==== Headings and subheadings ==== + +A free-form documentation comment containing a single line +which starts with some '=' symbols and then a space defines +a section heading: + + ## + # = This is a top level heading + ## + + ## + # This is a free-form comment which will go under the + # top level heading. + ## + + ## + # == This is a second level heading + ## + +Section headings must always be correctly nested, so you can only +define a third-level heading inside a second-level heading, and so +on. The documentation generator will catch nesting mistakes and report +a syntax error. ==== Documentation markup ==== -Comment text starting with '=' is a section title: +Documentation comments can use most rST markup. In particular, +a '::' literal block can be used for examples: - # = Section title - -Double the '=' for a subsection title: - - # == Subsection title - -'|' denotes examples: - - # | Text of the example, may span - # | multiple lines + # :: + # + # Text of the example, may span + # multiple lines '*' starts an itemized list: @@ -825,37 +843,35 @@ A decimal number followed by '.' starts a numbered list: # multiple lines # 2. Second item -The actual number doesn't matter. You could even use '*' instead of -'2.' for the second item. +The actual number doesn't matter. -Lists can't be nested. Blank lines are currently not supported within -lists. +Lists of either kind must be preceded and followed by a blank line. +If a list item's text spans multiple lines, then the second and +subsequent lines must be correctly indented to line up with the +first character of the first line. -Additional whitespace between the initial '#' and the comment text is -permitted. - -*foo* and _foo_ are for strong and emphasis styles respectively (they -do not work over multiple lines). @foo is used to reference a name in -the schema. +The usual '**strong**', '*emphasised*' and '``literal``' markup should +be used. If you need a single literal '*' you will need to backslash-escape it. +As an extension beyond the usual rST syntax, you can also +use '@foo' to reference a name in the schema; this is rendered +the same way as '``foo``'. Example: ## -# = Section -# == Subsection -# -# Some text foo with *strong* and _emphasis_ +# Some text foo with **bol** and *emphasis* # 1. with a list # 2. like that # # And some code: -# | $ echo foo -# | -> do this -# | <- get that # +# :: +# +# $ echo foo +# -> do this +# <- get that ## - ==== Definition documentation ==== Definition documentation, if present, must immediately precede the @@ -870,6 +886,12 @@ commands and events), member (for structs and unions), branch (for alternates), or value (for enums), and finally optional tagged sections. +Descriptions of arguments can span multiple lines; if they +do then the second and subsequent lines must be indented +to line up with the first character of the first line of the +description. The parser will report a syntax error if there +is insufficient indentation. + FIXME: the parser accepts these things in almost any order. FIXME: union branches should be described, too. @@ -883,6 +905,16 @@ The section ends with the start of a new section. A 'Since: x.y.z' tagged section lists the release that introduced the definition. +The text of a section can start on a new line, in +which case it must not be indented at all. It can also start +on the same line as the 'Note:', 'Returns:', etc tag. In this +case if it spans multiple lines then second and subsequent +lines must be indented to match the first. + +An 'Example' or 'Examples' section is automatically rendered +entirely as literal fixed-width text. In other sections, +the text is formatted, and rST markup can be used. + For example: ##