diff mbox series

[PULL,52/61] docs/qapidoc: process @foo into ``foo``

Message ID 20250311113137.1277125-53-armbru@redhat.com (mailing list archive)
State New
Headers show
Series [PULL,01/61] docs/sphinx: create QAPI domain extension stub | expand

Commit Message

Markus Armbruster March 11, 2025, 11:31 a.m. UTC
From: John Snow <jsnow@redhat.com>

Add support for the special QAPI doc syntax to process @references as
``preformatted text``. At the moment, there are no actual
cross-references for individual members, so there is nothing to link
against. For now, process it identically to how we did in the old
qapidoc system.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250311034303.75779-56-jsnow@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 docs/sphinx/qapidoc.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index a0016f8853..ebdf709594 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -303,6 +303,9 @@  def visit_sections(self, ent: QAPISchemaDefinition) -> None:
 
         # Add sections in source order:
         for section in sections:
+            # @var is translated to ``var``:
+            section.text = re.sub(r"@([\w-]+)", r"``\1``", section.text)
+
             if section.kind == QAPIDoc.Kind.PLAIN:
                 self.visit_paragraph(section)
             elif section.kind == QAPIDoc.Kind.MEMBER: