diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-16 13:07:38 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-18 13:17:54 +0200 |
commit | 83fe0c2ccf062619b0b2419f874537d98d7d44b0 (patch) | |
tree | 69ace1080ff5daf97064faedd687b5b6fa9dc34f /rtemsspec | |
parent | specdoc: Make label prefix configurable (diff) | |
download | rtems-central-83fe0c2ccf062619b0b2419f874537d98d7d44b0.tar.bz2 |
specdoc: Make section texts configurable
Diffstat (limited to 'rtemsspec')
-rw-r--r-- | rtemsspec/specdoc.py | 13 | ||||
-rw-r--r-- | rtemsspec/tests/test_specdoc.py | 21 |
2 files changed, 24 insertions, 10 deletions
diff --git a/rtemsspec/specdoc.py b/rtemsspec/specdoc.py index 823a7d55..7ab38fe2 100644 --- a/rtemsspec/specdoc.py +++ b/rtemsspec/specdoc.py @@ -558,15 +558,14 @@ def document(config: dict, item_cache: ItemCache) -> None: for documenter in documenter_map.values(): documenter.resolve_used_by() documenter_names = set(documenter_map) - content.section_label_prefix = "ReqEng" - with content.section("Specification Items"): - with content.section("Specification Item Hierarchy"): - content.add( - "The specification item types have the following hierarchy:") + content.section_label_prefix = config["section-label-prefix"] + with content.section(config["section-name"]): + with content.section(config["hierarchy-subsection-name"]): + content.add(config["hierarchy-text"]) root_documenter.hierarchy(content) - with content.section("Specification Item Types"): + with content.section(config["item-types-subsection-name"]): root_documenter.document(content, documenter_names) - with content.section("Specification Attribute Sets and Value Types"): + with content.section(config["value-types-subsection-name"]): documenters = [documenter_map[name] for name in documenter_names] for documenter in sorted(documenters, key=lambda x: x.section): documenter.document(content) diff --git a/rtemsspec/tests/test_specdoc.py b/rtemsspec/tests/test_specdoc.py index 0a3d2941..1c0ae586 100644 --- a/rtemsspec/tests/test_specdoc.py +++ b/rtemsspec/tests/test_specdoc.py @@ -39,9 +39,24 @@ def test_document(tmpdir): assert item_cache["/root"].type == "spec" doc_target = os.path.join(tmpdir, "items.rst") config = { - "root-type": "/root", - "doc-target": doc_target, - "label-prefix": "SpecType", + "doc-target": + doc_target, + "hierarchy-subsection-name": + "Specification Item Hierarchy", + "hierarchy-text": + "The specification item types have the following hierarchy:", + "item-types-subsection-name": + "Specification Item Types", + "label-prefix": + "SpecType", + "root-type": + "/root", + "section-label-prefix": + "ReqEng", + "section-name": + "Specification Items", + "value-types-subsection-name": + "Specification Attribute Sets and Value Types", } document(config, item_cache) with open(doc_target, "r") as src: |