[rtems-central commit] interfacedoc: Add directive constraints
Sebastian Huber
sebh at rtems.org
Wed Feb 3 05:28:01 UTC 2021
Module: rtems-central
Branch: master
Commit: 233413d9f20556a221ab3f82b5309e5b142d7da5
Changeset: http://git.rtems.org/rtems-central/commit/?id=233413d9f20556a221ab3f82b5309e5b142d7da5
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jan 20 13:52:27 2021 +0100
interfacedoc: Add directive constraints
---
rtemsspec/interfacedoc.py | 8 ++++++++
rtemsspec/tests/spec-interface/constraint-a.yml | 10 ++++++++++
rtemsspec/tests/spec-interface/func.yml | 2 ++
rtemsspec/tests/test_interfacedoc.py | 6 ++++++
4 files changed, 26 insertions(+)
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py
index 59a5199..05f24b7 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 0000000..4854484
--- /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 422a3a7..75d9a5c 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 0ead530..54f9e1e 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()
More information about the vc
mailing list