[rtems-central commit] sphinxcontent: Improve formatting of structures

Sebastian Huber sebh at rtems.org
Thu Dec 16 06:41:38 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    869075be652b31fde3bc87d731fa1f8cdc7150cb
Changeset: http://git.rtems.org/rtems-central/commit/?id=869075be652b31fde3bc87d731fa1f8cdc7150cb

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 16 07:46:06 2021 +0100

sphinxcontent: Improve formatting of structures

---

 rtemsspec/sphinxcontent.py           | 2 ++
 rtemsspec/tests/test_interfacedoc.py | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index e0084af..1fc3d3c 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -224,6 +224,8 @@ def _get_value_sphinx_function(ctx: ItemGetValueContext) -> Any:
 
 
 def _get_value_sphinx_type(ctx: ItemGetValueContext) -> Any:
+    if ctx.item.get("definition-kind", "") == "struct-only":
+        return f"``struct {ctx.value[ctx.key]}``"
     return f":c:type:`{ctx.value[ctx.key]}`"
 
 
diff --git a/rtemsspec/tests/test_interfacedoc.py b/rtemsspec/tests/test_interfacedoc.py
index 07e96bc..b57cf31 100644
--- a/rtemsspec/tests/test_interfacedoc.py
+++ b/rtemsspec/tests/test_interfacedoc.py
@@ -460,7 +460,7 @@ Function brief description.
 Function description.  References to :term:`xs <x>`,
 :ref:`InterfaceVeryLongFunction`, :c:type:`Integer`, :c:type:`Enum`,
 :c:macro:`DEFINE`, :ref:`InterfaceVERYLONGMACRO`, Variable,
-:c:macro:`ENUMERATOR_0`, :c:type:`Struct`, :ref:`a`, interface, :ref:`GroupA`,
+:c:macro:`ENUMERATOR_0`, ``struct Struct``, :ref:`a`, interface, :ref:`GroupA`,
 and Group F.  Second parameter is ``Param1``.
 
 .. code-block:



More information about the vc mailing list