diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-01-20 13:52:27 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-02-01 06:59:01 +0100 |
commit | 233413d9f20556a221ab3f82b5309e5b142d7da5 (patch) | |
tree | f9665f6b27d094075f4f858c7c48707da42fcad4 | |
parent | content: Add interface group references (diff) | |
download | rtems-central-233413d9f20556a221ab3f82b5309e5b142d7da5.tar.bz2 |
interfacedoc: Add directive constraints
-rw-r--r-- | rtemsspec/interfacedoc.py | 8 | ||||
-rw-r--r-- | rtemsspec/tests/spec-interface/constraint-a.yml | 10 | ||||
-rw-r--r-- | rtemsspec/tests/spec-interface/func.yml | 2 | ||||
-rw-r--r-- | rtemsspec/tests/test_interfacedoc.py | 6 |
4 files changed, 26 insertions, 0 deletions
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py index 59a51993..05f24b77 100644 --- a/rtemsspec/interfacedoc.py +++ b/rtemsspec/interfacedoc.py @@ -199,6 +199,14 @@ def _generate_directive(content: SphinxContent, mapper: _Mapper, if item["notes"]: content.add(".. rubric:: NOTES:") content.wrap(mapper.substitute(item["notes"])) + constraints = [ + mapper.substitute(parent["text"], parent) + for parent in item.parents("constraint") + ] + if constraints: + content.add(".. rubric:: CONSTRAINTS:") + content.add_list(constraints, + "The following constraints apply to this directive:") def _generate_directives(target: str, group: Item, group_uids: List[str], diff --git a/rtemsspec/tests/spec-interface/constraint-a.yml b/rtemsspec/tests/spec-interface/constraint-a.yml new file mode 100644 index 00000000..48544846 --- /dev/null +++ b/rtemsspec/tests/spec-interface/constraint-a.yml @@ -0,0 +1,10 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: [] +rationale: null +scope: user +text: | + Constraint A for ${func:/name}. +type: constraint diff --git a/rtemsspec/tests/spec-interface/func.yml b/rtemsspec/tests/spec-interface/func.yml index 422a3a7c..75d9a5c1 100644 --- a/rtemsspec/tests/spec-interface/func.yml +++ b/rtemsspec/tests/spec-interface/func.yml @@ -31,6 +31,8 @@ links: uid: h - role: interface-ingroup uid: ga +- role: constraint + uid: constraint-a name: Function notes: null params: diff --git a/rtemsspec/tests/test_interfacedoc.py b/rtemsspec/tests/test_interfacedoc.py index 0ead530b..54f9e1ed 100644 --- a/rtemsspec/tests/test_interfacedoc.py +++ b/rtemsspec/tests/test_interfacedoc.py @@ -461,5 +461,11 @@ parameter is ``Param1``. these two lines are not wrapped + +.. rubric:: CONSTRAINTS: + +The following constraints apply to this directive: + +* Constraint A for :ref:`InterfaceFunction`. """ assert content == src.read() |