diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-15 21:11:56 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-16 09:27:40 +0200 |
commit | be254b4ed43650c3f0bb902394768ee773f4cb47 (patch) | |
tree | 1651a411f4427524c4895a2360611e3fb3f6717e /rtemsspec/sphinxcontent.py | |
parent | glossary: Swap lower and higher priority items (diff) | |
download | rtems-central-be254b4ed43650c3f0bb902394768ee773f4cb47.tar.bz2 |
spec: Use external references for interfaces
Diffstat (limited to 'rtemsspec/sphinxcontent.py')
-rw-r--r-- | rtemsspec/sphinxcontent.py | 25 |
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] |