e389929d | 28-Jun-2024 |
Markus Armbruster <armbru@redhat.com> |
sphinx/qapidoc: Fix to generate doc for explicit, unboxed arguments
When a command's arguments are specified as an explicit type T, generated documentation points to the members of T.
Example:
sphinx/qapidoc: Fix to generate doc for explicit, unboxed arguments
When a command's arguments are specified as an explicit type T, generated documentation points to the members of T.
Example:
## # @announce-self: # # Trigger generation of broadcast RARP frames to update network [...] ## { 'command': 'announce-self', 'boxed': true, 'data' : 'AnnounceParameters'}
generates
"announce-self" (Command) -------------------------
Trigger generation of broadcast RARP frames to update network [...]
Arguments ~~~~~~~~~
The members of "AnnounceParameters"
Except when the command takes its arguments unboxed , i.e. it doesn't have 'boxed': true, we generate *nothing*. A few commands have a reference in their doc comment to compensate, but most don't.
Example:
## # @blockdev-snapshot-sync: # # Takes a synchronous snapshot of a block device. # # For the arguments, see the documentation of BlockdevSnapshotSync. [...] ## { 'command': 'blockdev-snapshot-sync', 'data': 'BlockdevSnapshotSync', 'allow-preconfig': true }
generates
"blockdev-snapshot-sync" (Command) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Takes a synchronous snapshot of a block device.
For the arguments, see the documentation of BlockdevSnapshotSync. [...]
Same for event data.
Fix qapidoc.py to generate the reference regardless of boxing. Delete now redundant references in the doc comments.
Fixes: 4078ee5469e5 (docs/sphinx: Add new qapi-doc Sphinx extension) Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240628112756.794237-1-armbru@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
show more ...
|
2664f317 | 26-Jun-2024 |
John Snow <jsnow@redhat.com> |
docs/qapidoc: fix nested parsing under untagged sections
Sphinx does not like sections without titles, because it wants to convert every section into a reference. When there is no title, it struggle
docs/qapidoc: fix nested parsing under untagged sections
Sphinx does not like sections without titles, because it wants to convert every section into a reference. When there is no title, it struggles to do this and transforms the tree inproperly.
Depending on the rST used, this may result in an assertion error deep in the docutils HTMLWriter.
(Observed when using ".. admonition:: Notes" under such a section - When this is transformed with its own <title> element, Sphinx is fooled into believing this title belongs to the section and incorrect mutates the docutils tree, leading to errors during rendering time.)
When parsing an untagged section (free paragraphs), skip making a hollow section and instead append the parse results to the prior section.
Many Bothans died to bring us this information.
The resulting output changes are basically invisible.
Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240626222128.406106-8-jsnow@redhat.com> [Mention output changes in commit message] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
939c639e | 26-Jun-2024 |
John Snow <jsnow@redhat.com> |
qapi/parser: preserve indentation in QAPIDoc sections
Change get_doc_indented() to preserve indentation on all subsequent text lines, and create a compatibility dedent() function for qapidoc.py that
qapi/parser: preserve indentation in QAPIDoc sections
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 <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240626222128.406106-6-jsnow@redhat.com> [Lost commit message paragraph restored] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
36c6dcc2 | 26-Jun-2024 |
John Snow <jsnow@redhat.com> |
docs/qapidoc: delint a tiny portion of the module
In a forthcoming series that adds a new QMP documentation generator, it will be helpful to have a linting baseline. However, there's no need to shuf
docs/qapidoc: delint a tiny portion of the module
In a forthcoming series that adds a new QMP documentation generator, it will be helpful to have a linting baseline. However, there's no need to shuffle around the deck chairs too much, because most of this code will be removed once that new qapidoc generator (the "transmogrifier") is in place.
To ease my pain: just turn off the black auto-formatter for most, but not all, of qapidoc.py. This will help ensure that *new* code follows a coding standard without bothering too much with cleaning up the existing code.
Code that I intend to keep is still subject to the delinting beam.
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240626222128.406106-5-jsnow@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
31c54b92 | 16-Feb-2024 |
Markus Armbruster <armbru@redhat.com> |
qapi: Rename QAPIDoc.Section.name to .tag
Since the previous commit, QAPIDoc.Section.name is either None (untagged section) or the section's tag string ('Returns', '@name', ...). Rename it to .tag.
qapi: Rename QAPIDoc.Section.name to .tag
Since the previous commit, QAPIDoc.Section.name is either None (untagged section) or the section's tag string ('Returns', '@name', ...). Rename it to .tag.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240216145841.2099240-9-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|
0dd35c16 | 08-Oct-2021 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
docs/sphinx: add templates files to generated depfile
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@re
docs/sphinx: add templates files to generated depfile
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
905655ea | 08-Oct-2021 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
docs/sphinx: add static files to generated depfile
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redha
docs/sphinx: add static files to generated depfile
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
d806f89f | 04-Aug-2021 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qapidoc: introduce QAPISchemaIfCond.docgen()
Instead of building the condition documentation from a list of string, use the result generated from QAPISchemaIfCond.docgen().
This changes the generat
qapidoc: introduce QAPISchemaIfCond.docgen()
Instead of building the condition documentation from a list of string, use the result generated from QAPISchemaIfCond.docgen().
This changes the generated documentation from: - COND1, COND2... (where COND1, COND2 are Literal nodes, and ',' is Text) to: - COND1 and COND2 (the whole string as a Literal node)
This will allow us to generate more complex conditions in the following patches, such as "(COND1 and COND2) or COND3".
Adding back the differentiated formatting is left to the wish list.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-6-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [TODO comment added] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|