[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/27] docs/qapi-domain: add qapi:alternate directive
From: |
John Snow |
Subject: |
[PATCH 14/27] docs/qapi-domain: add qapi:alternate directive |
Date: |
Fri, 19 Apr 2024 00:38:02 -0400 |
Add the .. qapi:alternate:: directive, object, and qapi:alt:`name`
cross-reference role.
Add the "Choices:" field list for describing alternate choices. Like
other field lists that reference QAPI types, a forthcoming commit will
add cross-referencing support to this field.
RFC: In the future, it would be nice to directly inline Alternates as
part of the type information in the containing object (i.e. directly in
arguments/members) - but that's a task for another series. For now, the
branch "names" are documented just like qapidoc.py does, even though
this information is superfluous for user documentation. Room for future
improvement, but not now.
Signed-off-by: John Snow <jsnow@redhat.com>
---
docs/qapi/index.rst | 7 +++++++
docs/sphinx/qapi-domain.py | 19 +++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst
index cf794e6e739..9bfe4d9f454 100644
--- a/docs/qapi/index.rst
+++ b/docs/qapi/index.rst
@@ -127,3 +127,10 @@ Explicit cross-referencing syntax for QAPI modules is
available with
is treated solely as a read-only manifest of blocks to copy.
:value always: The bitmap is always synchronized with the operation,
regardless of whether or not the operation was successful.
+
+.. qapi:alternate:: BlockDirtyBitmapOrStr
+ :since: 4.1
+
+ :choice str local: name of the bitmap, attached to the same node as
+ target bitmap.
+ :choice BlockDirtyBitmap external: bitmap with specified node
diff --git a/docs/sphinx/qapi-domain.py b/docs/sphinx/qapi-domain.py
index 6759c39290d..c6eb6324594 100644
--- a/docs/sphinx/qapi-domain.py
+++ b/docs/sphinx/qapi-domain.py
@@ -305,6 +305,22 @@ class QAPIEnum(QAPIObject):
)
+class QAPIAlternate(QAPIObject):
+ """Description of a QAPI Alternate."""
+
+ doc_field_types = QAPIObject.doc_field_types.copy()
+ doc_field_types.extend(
+ [
+ TypedField(
+ "choice",
+ label=_("Choices"),
+ names=("choice",),
+ can_collapse=True,
+ ),
+ ]
+ )
+
+
class QAPIModule(SphinxDirective):
"""
Directive to mark description of a new module.
@@ -458,6 +474,7 @@ class QAPIDomain(Domain):
"module": ObjType(_("module"), "mod", "obj"),
"command": ObjType(_("command"), "cmd", "obj"),
"enum": ObjType(_("enum"), "enum", "obj", "type"),
+ "alternate": ObjType(_("alternate"), "alt", "obj", "type"),
}
# Each of these provides a ReST directive,
@@ -466,6 +483,7 @@ class QAPIDomain(Domain):
"module": QAPIModule,
"command": QAPICommand,
"enum": QAPIEnum,
+ "alternate": QAPIAlternate,
}
# These are all cross-reference roles; e.g.
@@ -475,6 +493,7 @@ class QAPIDomain(Domain):
"mod": QAPIXRefRole(),
"cmd": QAPIXRefRole(),
"enum": QAPIXRefRole(),
+ "alt": QAPIXRefRole(),
"type": QAPIXRefRole(), # reference any data type (excludes modules,
commands, events)
"obj": QAPIXRefRole(), # reference *any* type of QAPI object.
}
--
2.44.0
- [PATCH 23/27] docs/qapi-domain: RFC patch - delete malformed field lists, (continued)
- [PATCH 23/27] docs/qapi-domain: RFC patch - delete malformed field lists, John Snow, 2024/04/19
- [PATCH 21/27] docs/qapi-domain: RFC patch - add malformed field list entries, John Snow, 2024/04/19
- [PATCH 06/27] docs/qapi-domain: add QAPI xref roles, John Snow, 2024/04/19
- [PATCH 05/27] docs/qapi-domain: add resolve_any_xref(), John Snow, 2024/04/19
- [PATCH 07/27] docs/qapi-domain: add qapi:command directive, John Snow, 2024/04/19
- [PATCH 08/27] docs/qapi-domain: add :since: directive option, John Snow, 2024/04/19
- [PATCH 09/27] docs/qapi-domain: add "Arguments:" field lists, John Snow, 2024/04/19
- [PATCH 11/27] docs/qapi-domain: add "Errors:" field lists, John Snow, 2024/04/19
- [PATCH 02/27] docs/qapi-domain: add qapi:module directive, John Snow, 2024/04/19
- [PATCH 12/27] docs/qapi-domain: add "Returns:" field lists, John Snow, 2024/04/19
- [PATCH 14/27] docs/qapi-domain: add qapi:alternate directive,
John Snow <=
- [PATCH 18/27] docs/qapi-domain: add :deprecated: directive option, John Snow, 2024/04/19
- [PATCH 19/27] docs/qapi-domain: add :unstable: directive option, John Snow, 2024/04/19
- [PATCH 20/27] docs/qapi-domain: add :ifcond: directive option, John Snow, 2024/04/19
- [PATCH 25/27] docs/qapi-domain: implement error context reporting fix, John Snow, 2024/04/19
- [PATCH 26/27] docs/qapi-domain: RFC patch - Add one last sample command, John Snow, 2024/04/19
- [PATCH 27/27] docs/qapi-domain: add CSS styling, John Snow, 2024/04/19
- [PATCH 24/27] docs/qapi-domain: add type cross-refs to field lists, John Snow, 2024/04/19
- Re: [PATCH 00/27] Add qapi-domain Sphinx extension, Markus Armbruster, 2024/04/19