From b730b190b26b40a94daa61b60cc28e1e37ae6d9d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 23 Jul 2020 15:38:26 +0200 Subject: specdoc: Fix item description --- rtemsspec/specdoc.py | 8 +++++--- rtemsspec/tests/spec-doc/a.yml | 2 +- rtemsspec/tests/test_specdoc.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rtemsspec/specdoc.py b/rtemsspec/specdoc.py index 7ab38fe2..94c7de3e 100644 --- a/rtemsspec/specdoc.py +++ b/rtemsspec/specdoc.py @@ -258,7 +258,6 @@ class _Documenter: config: dict): self._name = item["spec-type"] self.section = item["spec-name"] - self._description = item["spec-description"] self._info_map = item["spec-info"] self._item = item self._documenter_map = documenter_map @@ -267,6 +266,7 @@ class _Documenter: self._mapper = SphinxMapper(item) self._mapper.add_get_value("spec:/spec-name", self._get_ref_specification_type) + self._description = self._substitute(item["spec-description"]) assert self._name not in documenter_map documenter_map[self._name] = self @@ -370,9 +370,9 @@ class _Documenter: "attributes are mandatory:") for attribute in sorted(mandatory_attributes): content.add_list_item(f"``{attribute}``") - content.add_blank_line() + content.ensure_blank_line() else: - content.add_blank_line() + content.ensure_blank_line() content.paste("The explicit attributes for this type are:") self._document_attributes(content, info["attributes"]) if "generic-attributes" in info: @@ -426,6 +426,8 @@ class _Documenter: "This type refines the following types:", add_blank_line=True) content.wrap(self._description) + if self._description: + content.add_blank_line() def document(self, content: SphinxContent, diff --git a/rtemsspec/tests/spec-doc/a.yml b/rtemsspec/tests/spec-doc/a.yml index 2384ae3c..721852c0 100644 --- a/rtemsspec/tests/spec-doc/a.yml +++ b/rtemsspec/tests/spec-doc/a.yml @@ -9,7 +9,7 @@ links: spec-key: type spec-value: spec uid: root -spec-description: null +spec-description: A description. spec-example: | a: null spec-info: diff --git a/rtemsspec/tests/test_specdoc.py b/rtemsspec/tests/test_specdoc.py index 1c0ae586..77fbbbd2 100644 --- a/rtemsspec/tests/test_specdoc.py +++ b/rtemsspec/tests/test_specdoc.py @@ -216,7 +216,7 @@ A ^ This type refines the :ref:`SpecTypeRoot` though the ``type`` attribute if the -value is ``spec``. +value is ``spec``. A description. The explicit attributes for this type are: -- cgit v1.2.3