mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
docs/qapi-domain: add XREF compatibility goop for Sphinx < 4.1
Sphinx < 4.1 handles cross-references ... differently. Factor out and isolate the compatibility goop we need to make cross references work properly in old versions of Sphinx. Yes, it's ugly. Yes, it works. No, I don't want to talk about it. Understand that this patch exists because of the overflowing love in my heart. Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20250311034303.75779-30-jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
282c8d256e
commit
a1fe2cd443
2 changed files with 144 additions and 15 deletions
|
@ -24,7 +24,13 @@ from typing import (
|
|||
from docutils import nodes
|
||||
from docutils.parsers.rst import directives
|
||||
|
||||
from compat import KeywordNode, SpaceNode
|
||||
from compat import (
|
||||
CompatField,
|
||||
CompatGroupedField,
|
||||
CompatTypedField,
|
||||
KeywordNode,
|
||||
SpaceNode,
|
||||
)
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import desc_signature, pending_xref
|
||||
from sphinx.directives import ObjectDescription
|
||||
|
@ -37,7 +43,6 @@ from sphinx.domains import (
|
|||
from sphinx.locale import _, __
|
||||
from sphinx.roles import XRefRole
|
||||
from sphinx.util import logging
|
||||
from sphinx.util.docfields import Field, GroupedField, TypedField
|
||||
from sphinx.util.nodes import make_id, make_refnode
|
||||
|
||||
|
||||
|
@ -264,7 +269,7 @@ class QAPIObject(QAPIDescription):
|
|||
|
||||
doc_field_types = [
|
||||
# :feat name: descr
|
||||
GroupedField(
|
||||
CompatGroupedField(
|
||||
"feature",
|
||||
label=_("Features"),
|
||||
names=("feat",),
|
||||
|
@ -434,7 +439,7 @@ class QAPICommand(QAPIObject):
|
|||
doc_field_types.extend(
|
||||
[
|
||||
# :arg TypeName ArgName: descr
|
||||
TypedField(
|
||||
CompatTypedField(
|
||||
"argument",
|
||||
label=_("Arguments"),
|
||||
names=("arg",),
|
||||
|
@ -442,14 +447,14 @@ class QAPICommand(QAPIObject):
|
|||
can_collapse=False,
|
||||
),
|
||||
# :error: descr
|
||||
Field(
|
||||
CompatField(
|
||||
"error",
|
||||
label=_("Errors"),
|
||||
names=("error", "errors"),
|
||||
has_arg=False,
|
||||
),
|
||||
# :return TypeName: descr
|
||||
GroupedField(
|
||||
CompatGroupedField(
|
||||
"returnvalue",
|
||||
label=_("Return"),
|
||||
rolename="type",
|
||||
|
@ -467,7 +472,7 @@ class QAPIEnum(QAPIObject):
|
|||
doc_field_types.extend(
|
||||
[
|
||||
# :value name: descr
|
||||
GroupedField(
|
||||
CompatGroupedField(
|
||||
"value",
|
||||
label=_("Values"),
|
||||
names=("value",),
|
||||
|
@ -484,7 +489,7 @@ class QAPIAlternate(QAPIObject):
|
|||
doc_field_types.extend(
|
||||
[
|
||||
# :alt type name: descr
|
||||
TypedField(
|
||||
CompatTypedField(
|
||||
"alternative",
|
||||
label=_("Alternatives"),
|
||||
names=("alt",),
|
||||
|
@ -502,7 +507,7 @@ class QAPIObjectWithMembers(QAPIObject):
|
|||
doc_field_types.extend(
|
||||
[
|
||||
# :member type name: descr
|
||||
TypedField(
|
||||
CompatTypedField(
|
||||
"member",
|
||||
label=_("Members"),
|
||||
names=("memb",),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue