[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 13/35] docs/qapi-domain: add "Arguments:" field lists
From: |
John Snow |
Subject: |
[RFC PATCH v2 13/35] docs/qapi-domain: add "Arguments:" field lists |
Date: |
Thu, 12 Dec 2024 20:12:42 -0500 |
This adds special rendering for Sphinx's typed field lists.
This patch does not add any QAPI-aware markup, rendering, or
cross-referencing for the type names, yet. That feature requires a
subclass to TypedField which will happen in its own commit quite a bit
later in this series; after all the basic fields and objects have been
established first.
The syntax for this field is:
:arg type name: description
description cont'd
You can omit the type or the description, but you cannot omit the name
-- if you do so, it degenerates into a "normal field list" entry, and
probably isn't what you want.
Signed-off-by: John Snow <jsnow@redhat.com>
---
docs/sphinx/qapi-domain.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/docs/sphinx/qapi-domain.py b/docs/sphinx/qapi-domain.py
index f525579661b..15a615d8adb 100644
--- a/docs/sphinx/qapi-domain.py
+++ b/docs/sphinx/qapi-domain.py
@@ -34,6 +34,7 @@
from sphinx.locale import _, __
from sphinx.roles import XRefRole
from sphinx.util import logging
+from sphinx.util.docfields import TypedField
from sphinx.util.docutils import SphinxDirective
from sphinx.util.nodes import make_id, make_refnode
@@ -240,8 +241,18 @@ def _toc_entry_name(self, sig_node: desc_signature) -> str:
class QAPICommand(QAPIObject):
"""Description of a QAPI Command."""
- # Nothing unique for now! Changed in later commits O:-)
- pass
+ doc_field_types = QAPIObject.doc_field_types.copy()
+ doc_field_types.extend(
+ [
+ # :arg TypeName ArgName: descr
+ TypedField(
+ "argument",
+ label=_("Arguments"),
+ names=("arg",),
+ can_collapse=False,
+ ),
+ ]
+ )
class QAPIModule(SphinxDirective):
--
2.47.0
- [RFC PATCH v2 03/35] docs/sphinx: create QAPI domain extension stub, (continued)
- [RFC PATCH v2 03/35] docs/sphinx: create QAPI domain extension stub, John Snow, 2024/12/12
- [RFC PATCH v2 04/35] docs/sphinx: add compat.py module and nested_parse helper, John Snow, 2024/12/12
- [RFC PATCH v2 05/35] docs/qapi-domain: add qapi:module directive, John Snow, 2024/12/12
- [RFC PATCH v2 08/35] docs/qapi-domain: add resolve_any_xref(), John Snow, 2024/12/12
- [RFC PATCH v2 07/35] docs/qapi-domain: add QAPI index, John Snow, 2024/12/12
- [RFC PATCH v2 09/35] docs/qapi-domain: add QAPI xref roles, John Snow, 2024/12/12
- [RFC PATCH v2 06/35] docs/qapi-domain: add QAPI domain object registry, John Snow, 2024/12/12
- [RFC PATCH v2 10/35] docs/qapi-domain: add compatibility node classes, John Snow, 2024/12/12
- [RFC PATCH v2 11/35] docs/qapi-domain: add qapi:command directive, John Snow, 2024/12/12
- [RFC PATCH v2 12/35] docs/qapi-domain: add :since: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 13/35] docs/qapi-domain: add "Arguments:" field lists,
John Snow <=
- [RFC PATCH v2 14/35] docs/qapi-domain: add "Features:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 15/35] docs/qapi-domain: add "Errors:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 16/35] docs/qapi-domain: add "Returns:" field lists, John Snow, 2024/12/12
- [RFC PATCH v2 17/35] docs/qapi-domain: add returns-nodesc, John Snow, 2024/12/12
- [RFC PATCH v2 19/35] docs/qapi-domain: add qapi:alternate directive, John Snow, 2024/12/12
- [RFC PATCH v2 18/35] docs/qapi-domain: add qapi:enum directive, John Snow, 2024/12/12
- [RFC PATCH v2 20/35] docs/qapi-domain: add qapi:event directive, John Snow, 2024/12/12
- [RFC PATCH v2 22/35] docs/qapi-domain: add qapi:union and qapi:branch directives, John Snow, 2024/12/12
- [RFC PATCH v2 23/35] docs/qapi-domain: add :deprecated: directive option, John Snow, 2024/12/12
- [RFC PATCH v2 24/35] docs/qapi-domain: add :unstable: directive option, John Snow, 2024/12/12