<feed xmlns='http://www.w3.org/2005/Atom'>
<title>qemu/tests/qapi-schema, branch master</title>
<subtitle>QEMU development tree</subtitle>
<id>https://git.zx2c4.com/qemu/atom/tests/qapi-schema?h=master</id>
<link rel='self' href='https://git.zx2c4.com/qemu/atom/tests/qapi-schema?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/'/>
<updated>2024-07-17T08:20:54Z</updated>
<entry>
<title>qapi: remove "Example" doc section</title>
<updated>2024-07-17T08:20:54Z</updated>
<author>
<name>John Snow</name>
<email>jsnow@redhat.com</email>
</author>
<published>2024-07-17T02:13:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=3c5f6114d9ffc70bc9b1a7cc0dddd72a911f966d'/>
<id>urn:sha1:3c5f6114d9ffc70bc9b1a7cc0dddd72a911f966d</id>
<content type='text'>
Fully eliminate the "Example" sections in QAPI doc blocks now that they
have all been converted to arbitrary rST syntax using the
".. qmp-example::" directive. Update tests to match.

Migrating to the new syntax
---------------------------

The old "Example:" or "Examples:" section syntax is now caught as an
error, but "Example::" is stil permitted as explicit rST syntax for an
un-lexed, generic preformatted text block.

('Example' is not special in this case, any sentence that ends with "::"
will start an indented code block in rST.)

Arbitrary rST for Examples is now possible, but it's strongly
recommended that documentation authors use the ".. qmp-example::"
directive for consistent visual formatting in rendered HTML docs. The
":title:" directive option may be used to add extra information into the
title bar for the example. The ":annotated:" option can be used to write
arbitrary rST instead, with nested "::" blocks applying QMP formatting
where desired.

Other choices available are ".. code-block:: QMP" which will not create
an "Example:" box, or the short-form "::" code-block syntax which will
not apply QMP highlighting when used outside of the qmp-example
directive.

Why?
----

This patch has several benefits:

1. Example sections can now be written more arbitrarily, mixing
   explanatory paragraphs and code blocks however desired.

2. Example sections can now use fully arbitrary rST.

3. All code blocks are now lexed and validated as QMP; increasing
   usability of the docs and ensuring validity of example snippets.

   (To some extent - This patch only gaurantees it lexes correctly, not
   that it's valid under the JSON or QMP grammars. It will catch most
   small mistakes, however.)

4. Each qmp-example can be titled or annotated independently without
   bypassing the QMP lexer/validator.

   (i.e. code blocks are now for *code* only, so we don't have to
   sacrifice exposition for having lexically valid examples.)

NOTE: As with the "Notes" conversion (d461c279737), this patch (and the
      three preceding) may change the rendering order for Examples in
      the current generator. The forthcoming qapidoc rewrite will fix
      this by always generating documentation in source order.

Signed-off-by: John Snow &lt;jsnow@redhat.com&gt;
Message-ID: &lt;20240717021312.606116-10-jsnow@redhat.com&gt;
Reviewed-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi/parser: don't parse rST markup as section headers</title>
<updated>2024-07-06T06:58:24Z</updated>
<author>
<name>John Snow</name>
<email>jsnow@redhat.com</email>
</author>
<published>2024-06-26T22:21:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=65fa48c79f20a37c7204f9e43dd7cc3058aa066c'/>
<id>urn:sha1:65fa48c79f20a37c7204f9e43dd7cc3058aa066c</id>
<content type='text'>
The double-colon synax is rST formatting that precedes a literal code
block. We do not want to capture these as QAPI-specific sections.

Coerce blocks that start with e.g. "Example::" to be parsed as untagged
paragraphs instead of special tagged sections.

Signed-off-by: John Snow &lt;jsnow@redhat.com&gt;
Message-ID: &lt;20240626222128.406106-14-jsnow@redhat.com&gt;
Reviewed-by: Markus Armbruster &lt;armbru@redhat.com&gt;
[Indentation tweaked for consistency]
Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: convert "Note" sections to plain rST</title>
<updated>2024-07-06T06:58:24Z</updated>
<author>
<name>John Snow</name>
<email>jsnow@redhat.com</email>
</author>
<published>2024-06-26T22:21:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=d461c2797374e0becc5227cdc099d85bc329b236'/>
<id>urn:sha1:d461c2797374e0becc5227cdc099d85bc329b236</id>
<content type='text'>
We do not need a dedicated section for notes. By eliminating a specially
parsed section, these notes can be treated as normal rST paragraphs in
the new QMP reference manual, and can be placed and styled much more
flexibly.

Convert all existing "Note" and "Notes" sections to pure rST. As part of
the conversion, capitalize the first letter of each sentence and add
trailing punctuation where appropriate to ensure notes look sensible and
consistent in rendered HTML documentation. Markup is also re-aligned to
the de-facto standard of 3 spaces for directives.

Update docs/devel/qapi-code-gen.rst to reflect the new paradigm, and
update the QAPI parser to prohibit "Note" sections while suggesting a
new syntax. The exact formatting to use is a matter of taste, but a good
candidate is simply:

.. note:: lorem ipsum ...
   ... dolor sit amet ...
   ... consectetur adipiscing elit ...

... but there are other choices, too. The Sphinx readthedocs theme
offers theming for the following forms (capitalization unimportant); all
are adorned with a (!) symbol () in the title bar for rendered HTML
docs.

See
https://sphinx-rtd-theme.readthedocs.io/en/stable/demo/demo.html#admonitions
for examples of each directive/admonition in use.

These are rendered in orange:

.. Attention:: ...
.. Caution:: ...
.. WARNING:: ...

These are rendered in red:

.. DANGER:: ...
.. Error:: ...

These are rendered in green:

.. Hint:: ...
.. Important:: ...
.. Tip:: ...

These are rendered in blue:

.. Note:: ...
.. admonition:: custom title

   admonition body text

This patch uses ".. note::" almost everywhere, with just two "caution"
directives. Several instances of "Notes:" have been converted to
merely ".. note::", or multiple ".. note::" where appropriate.
".. admonition:: notes" is used in a few places where we had an
ordered list of multiple notes that would not make sense as
standalone/separate admonitions.  Two "Note:" following "Example:"
have been turned into ordinary paragraphs within the example.

NOTE: Because qapidoc.py does not attempt to preserve source ordering of
sections, the conversion of Notes from a "tagged section" to an
"untagged section" means that rendering order for some notes *may
change* as a result of this patch. The forthcoming qapidoc.py rewrite
strictly preserves source ordering in the rendered documentation, so
this issue will be rectified in the new generator.

Signed-off-by: John Snow &lt;jsnow@redhat.com&gt;
Acked-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt; [for block*.json]
Message-ID: &lt;20240626222128.406106-11-jsnow@redhat.com&gt;
Reviewed-by: Markus Armbruster &lt;armbru@redhat.com&gt;
[Commit message clarified slightly, period added to one more note]
Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi/parser: fix comment parsing immediately following a doc block</title>
<updated>2024-07-06T06:58:24Z</updated>
<author>
<name>John Snow</name>
<email>jsnow@redhat.com</email>
</author>
<published>2024-06-26T22:21:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=83deda876940116d31bf47c51e62e0fe625e8655'/>
<id>urn:sha1:83deda876940116d31bf47c51e62e0fe625e8655</id>
<content type='text'>
If a comment immediately follows a doc block, the parser doesn't ignore
that token appropriately. Fix that.

e.g.

&gt; ##
&gt; # = Hello World!
&gt; ##
&gt;
&gt; # I'm a comment!

will break the parser, because it does not properly ignore the comment
token if it immediately follows a doc block.

Fixes: 3d035cd2cca6 (qapi: Rewrite doc comment parser)
Signed-off-by: John Snow &lt;jsnow@redhat.com&gt;
Reviewed-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Message-ID: &lt;20240626222128.406106-7-jsnow@redhat.com&gt;
Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi/parser: preserve indentation in QAPIDoc sections</title>
<updated>2024-07-06T06:58:24Z</updated>
<author>
<name>John Snow</name>
<email>jsnow@redhat.com</email>
</author>
<published>2024-06-26T22:21:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=939c639e1d7c1d78bcc262368ab1fb78f09d0bfe'/>
<id>urn:sha1:939c639e1d7c1d78bcc262368ab1fb78f09d0bfe</id>
<content type='text'>
Change get_doc_indented() to preserve indentation on all subsequent text
lines, and create a compatibility dedent() function for qapidoc.py that
removes indentation the same way get_doc_indented() did.

This is being done for the benefit of a new qapidoc generator which
requires that indentation in argument and features sections are
preserved.

Prior to this patch, a section like this:

```
@name: lorem ipsum
   dolor sit amet
     consectetur adipiscing elit
```

would have its body text be parsed into:

```
lorem ipsum
dolor sit amet
  consectetur adipiscing elit
```

We want to preserve the indentation for even the first body line so that
the entire block can be parsed directly as rST. This patch would now
parse that segment into:

```
lorem ipsum
   dolor sit amet
     consectetur adipiscing elit
```

This is helpful for formatting arguments and features as field lists in
rST, where the new generator will format this information as:

```
:arg type name: lorem ipsum
   dolor sit amet
     consectetur apidiscing elit
```

...and can be formed by the simple concatenation of the field list
construct and the body text. The indents help preserve the continuation
of a block-level element, and further allow the use of additional rST
block-level constructs such as code blocks, lists, and other such
markup.

This understandably breaks the existing qapidoc.py; so a new function is
added there to dedent the text for compatibility. Once the new generator
is merged, this function will not be needed any longer and can be
dropped.

I verified this patch changes absolutely nothing by comparing the
md5sums of the QMP ref html pages both before and after the change, so
it's certified inert. QAPI test output has been updated to reflect the
new strategy of preserving indents for rST.

Signed-off-by: John Snow &lt;jsnow@redhat.com&gt;
Reviewed-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Message-ID: &lt;20240626222128.406106-6-jsnow@redhat.com&gt;
[Lost commit message paragraph restored]
Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: Rename visitor parameter @variants to @alternatives</title>
<updated>2024-05-06T10:38:27Z</updated>
<author>
<name>Markus Armbruster</name>
<email>armbru@redhat.com</email>
</author>
<published>2024-03-16T06:43:36Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=41d0ad1d045a1af51200ff5f2a1309e4aada0a96'/>
<id>urn:sha1:41d0ad1d045a1af51200ff5f2a1309e4aada0a96</id>
<content type='text'>
A previous commit narrowed the type of .visit_alternate_type()
parameter @variants from QAPISchemaVariants to QAPISchemaAlternatives.
Rename it to @alternatives.

One of them passes @alternatives to helper function
gen_visit_alternate().  Rename its @variants parameter to
@alternatives as well.

Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: Rename visitor parameter @variants to @branches</title>
<updated>2024-05-06T10:38:27Z</updated>
<author>
<name>Markus Armbruster</name>
<email>armbru@redhat.com</email>
</author>
<published>2024-03-15T15:28:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=d1da8af897340ed3773c09add93c3b9f494f2c2b'/>
<id>urn:sha1:d1da8af897340ed3773c09add93c3b9f494f2c2b</id>
<content type='text'>
The previous commit narrowed the type of .visit_object_type()
parameter @variants from QAPISchemaVariants to QAPISchemaBranches.
Rename it to @branches.

Same for .visit_object_type_flat().

A few of these pass @branches to helper functions:
QAPISchemaGenRSTVisitor.visit_object_type() to ._nodes_for_members()
and ._nodes_for_variant_when(), and
QAPISchemaGenVisitVisitor.visit_object_type() to
gen_visit_object_members().  Rename the helpers' @variants parameters
to @branches as well.

Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: Reject "Returns" section when command doesn't return anything</title>
<updated>2024-03-04T06:12:40Z</updated>
<author>
<name>Markus Armbruster</name>
<email>armbru@redhat.com</email>
</author>
<published>2024-02-27T11:39:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=e1f684ea2e80800e74feeeaa36deed41cd3ff30f'/>
<id>urn:sha1:e1f684ea2e80800e74feeeaa36deed41cd3ff30f</id>
<content type='text'>
Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Message-ID: &lt;20240227113921.236097-14-armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: New documentation section tag "Errors"</title>
<updated>2024-03-04T06:12:40Z</updated>
<author>
<name>Markus Armbruster</name>
<email>armbru@redhat.com</email>
</author>
<published>2024-02-27T11:39:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=3a025d3d1ffa63903aba7775a1061b0e30da4d13'/>
<id>urn:sha1:3a025d3d1ffa63903aba7775a1061b0e30da4d13</id>
<content type='text'>
We use section "Returns" for documenting both success and error
response of commands.

I intend to generate better command success response documentation.
Easier when "Returns" documents just he success response.

Create new section tag "Errors".  The next two commits will move error
response documentation from "Returns" sections to "Errors" sections.

Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Message-ID: &lt;20240227113921.236097-4-armbru@redhat.com&gt;
</content>
</entry>
<entry>
<title>qapi: Slightly clearer error message for invalid "Returns" section</title>
<updated>2024-03-04T06:12:40Z</updated>
<author>
<name>Markus Armbruster</name>
<email>armbru@redhat.com</email>
</author>
<published>2024-02-27T11:39:10Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/qemu/commit/?id=51e97c14fb54efaab57ee3b617bdd252ecf31c7b'/>
<id>urn:sha1:51e97c14fb54efaab57ee3b617bdd252ecf31c7b</id>
<content type='text'>
Change "'Returns:' is only valid for commands" to "'Returns' section
is only valid for commands".

Signed-off-by: Markus Armbruster &lt;armbru@redhat.com&gt;
Message-ID: &lt;20240227113921.236097-3-armbru@redhat.com&gt;
</content>
</entry>
</feed>
