diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-05-05 14:41:19 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-05-08 21:58:56 +0200 |
commit | 9c133f8089a66bbdfd4dbb464b399ad9dd741ff4 (patch) | |
tree | b8abf680051c99396056f4f9a37570288ca65060 /rtemsspec/interfacedoc.py | |
parent | glossary: Canonicalize terms (diff) | |
download | rtems-central-9c133f8089a66bbdfd4dbb464b399ad9dd741ff4.tar.bz2 |
interfacedoc: Add document_directive()
Diffstat (limited to 'rtemsspec/interfacedoc.py')
-rw-r--r-- | rtemsspec/interfacedoc.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py index f7da0adf..880e4e63 100644 --- a/rtemsspec/interfacedoc.py +++ b/rtemsspec/interfacedoc.py @@ -127,7 +127,7 @@ def _add_definition(content: CContent, mapper: ItemMapper, item: Item, add_definition(content, mapper, item, definition) -def _generate_directive(content: SphinxContent, mapper: SphinxInterfaceMapper, +def _document_directive(content: SphinxContent, mapper: ItemMapper, code_mapper: _CodeMapper, item: Item, enabled: List[str]) -> None: content.wrap(mapper.substitute(item["brief"])) @@ -175,6 +175,17 @@ def _generate_directive(content: SphinxContent, mapper: SphinxInterfaceMapper, "The following constraints apply to this directive:") +def document_directive(item: Item, enabled: List[str], + mapper: ItemMapper) -> SphinxContent: + """ + Documents the directive specified by the item using the item mapper and + enabled set. + """ + content = SphinxContent() + _document_directive(content, mapper, _CodeMapper(item), item, enabled) + return content + + def _generate_directives(target: str, group: Item, group_uids: List[str], items: List[Item], enabled: List[str]) -> None: content = SphinxContent() @@ -201,7 +212,7 @@ def _generate_directives(target: str, group: Item, group_uids: List[str], content.add_index_entries([directive] + item["index-entries"]) with content.section(directive, label=make_label(f"Interface {directive}")): - _generate_directive(content, mapper, code_mapper, item, + _document_directive(content, mapper, code_mapper, item, enabled) content.add_licence_and_copyrights() content.write(target) |