[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/27] docs/sphinx: create QAPI domain extension stub
From: |
John Snow |
Subject: |
[PATCH 01/27] docs/sphinx: create QAPI domain extension stub |
Date: |
Fri, 19 Apr 2024 00:37:49 -0400 |
It doesn't really do anything yet, we'll get to it brick-by-brick in the
forthcoming commits to keep the series breezy and the git history
informative.
Signed-off-by: John Snow <jsnow@redhat.com>
---
docs/conf.py | 3 ++-
docs/sphinx/qapi-domain.py | 50 ++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 docs/sphinx/qapi-domain.py
diff --git a/docs/conf.py b/docs/conf.py
index aae0304ac6e..b15665d956d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -61,7 +61,8 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
-extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc']
+extensions = ['kerneldoc', 'hxtool', 'depfile',
+ 'qapidoc', 'qapi-domain', 'qmp_lexer']
if sphinx.version_info[:3] > (4, 0, 0):
tags.add('sphinx4')
diff --git a/docs/sphinx/qapi-domain.py b/docs/sphinx/qapi-domain.py
new file mode 100644
index 00000000000..163b9ff21c3
--- /dev/null
+++ b/docs/sphinx/qapi-domain.py
@@ -0,0 +1,50 @@
+"""
+QAPI domain extension.
+"""
+
+from __future__ import annotations
+
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ Dict,
+ List,
+ Tuple,
+)
+
+from sphinx.domains import Domain, ObjType
+from sphinx.util import logging
+
+
+if TYPE_CHECKING:
+ from sphinx.application import Sphinx
+
+logger = logging.getLogger(__name__)
+
+
+class QAPIDomain(Domain):
+ """QAPI language domain."""
+
+ name = "qapi"
+ label = "QAPI"
+
+ object_types: Dict[str, ObjType] = {}
+ directives = {}
+ roles = {}
+ initial_data: Dict[str, Dict[str, Tuple[Any]]] = {}
+ indices = []
+
+ def merge_domaindata(self, docnames: List[str], otherdata: Dict[str, Any])
-> None:
+ pass
+
+
+def setup(app: Sphinx) -> Dict[str, Any]:
+ app.setup_extension("sphinx.directives")
+ app.add_domain(QAPIDomain)
+
+ return {
+ "version": "1.0",
+ "env_version": 1,
+ "parallel_read_safe": True,
+ "parallel_write_safe": True,
+ }
--
2.44.0
- [PATCH 00/27] Add qapi-domain Sphinx extension, John Snow, 2024/04/19
- [PATCH 03/27] docs/qapi-module: add QAPI domain object registry, John Snow, 2024/04/19
- [PATCH 04/27] docs/qapi-domain: add QAPI index, John Snow, 2024/04/19
- [PATCH 01/27] docs/sphinx: create QAPI domain extension stub,
John Snow <=
- [PATCH 10/27] docs/qapi-domain: add "Features:" field lists, John Snow, 2024/04/19
- [PATCH 13/27] docs/qapi-domain: add qapi:enum directive, John Snow, 2024/04/19
- [PATCH 16/27] docs/qapi-domain: add qapi:struct directive, John Snow, 2024/04/19
- [PATCH 15/27] docs/qapi-domain: add qapi:event directive, John Snow, 2024/04/19
- [PATCH 22/27] docs/qapi-domain: add warnings for malformed field lists, John Snow, 2024/04/19
- [PATCH 17/27] docs/qapi-domain: add qapi:union and qapi:branch directives, John Snow, 2024/04/19
- [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