summaryrefslogtreecommitdiffstats
path: root/rtemsspec/sphinxcontent.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-15 21:11:56 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-16 09:27:40 +0200
commitbe254b4ed43650c3f0bb902394768ee773f4cb47 (patch)
tree1651a411f4427524c4895a2360611e3fb3f6717e /rtemsspec/sphinxcontent.py
parentglossary: Swap lower and higher priority items (diff)
downloadrtems-central-be254b4ed43650c3f0bb902394768ee773f4cb47.tar.bz2
spec: Use external references for interfaces
Diffstat (limited to 'rtemsspec/sphinxcontent.py')
-rw-r--r--rtemsspec/sphinxcontent.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index 1d72ae7c..e0084af8 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -229,12 +229,13 @@ def _get_value_sphinx_type(ctx: ItemGetValueContext) -> Any:
def _get_value_sphinx_ref(ctx: ItemGetValueContext, get_value: ItemGetValue,
postfix: str) -> Any:
- if "c-user" in ctx.item["references"]:
- sphinx_ref = ctx.item["references"]["c-user"]
- return f":ref:`{ctx.value[ctx.key]}{postfix} <{sphinx_ref}>`"
- if "url" in ctx.item["references"]:
- url = ctx.item["references"]["url"]
- return f"`{ctx.value[ctx.key]}{postfix} <{url}>`_"
+ for ref in ctx.item["references"]:
+ ref_type = ref["type"]
+ identifier = ref["identifier"]
+ if ref_type == "document" and ref["name"] == "c-user":
+ return f":ref:`{ctx.value[ctx.key]}{postfix} <{identifier}>`"
+ if ref_type == "url":
+ return f"`{ctx.value[ctx.key]}{postfix} <{identifier}>`_"
return get_value(ctx)
@@ -247,11 +248,13 @@ def _get_value_sphinx_unspecified_function(ctx: ItemGetValueContext) -> Any:
def _get_value_sphinx_unspecified_group(ctx: ItemGetValueContext) -> Any:
- if "c-user" in ctx.item["references"]:
- return f":ref:`{ctx.item['references']['c-user']}`"
- if "url" in ctx.item["references"]:
- url = ctx.item["references"]["url"]
- return f"`{ctx.value[ctx.key]} <{url}>`_"
+ for ref in ctx.item["references"]:
+ ref_type = ref["type"]
+ identifier = ref["identifier"]
+ if ref_type == "document" and ref["name"] == "c-user":
+ return f":ref:`{identifier}`"
+ if ref_type == "url":
+ return f"`{ctx.value[ctx.key]} <{identifier}>`_"
return ctx.value[ctx.key]