From b93290d89f3a08d6352fe025956faaeccf4f6a81 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 16 Jun 2020 17:17:09 +0200 Subject: sphinxcontent: Optional wrap in add_definition_item() --- rtemsqual/sphinxcontent.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rtemsqual/sphinxcontent.py') diff --git a/rtemsqual/sphinxcontent.py b/rtemsqual/sphinxcontent.py index 3bec4e04..95f8438c 100644 --- a/rtemsqual/sphinxcontent.py +++ b/rtemsqual/sphinxcontent.py @@ -92,7 +92,10 @@ class SphinxContent(Content): """ Adds a list of index entries the content. """ self.add([".. index:: " + entry for entry in make_lines(entries)]) - def add_definition_item(self, name, lines) -> None: + def add_definition_item(self, + name: GenericContent, + definition: GenericContent, + wrap: bool = False) -> None: """ Adds a definition item the content. """ @contextmanager def _definition_item_context(content: Content) -> Iterator[None]: @@ -101,7 +104,10 @@ class SphinxContent(Content): yield content.pop_indent() - self.add(lines, _definition_item_context) + if wrap: + self.wrap(definition, context=_definition_item_context) + else: + self.add(definition, context=_definition_item_context) @contextmanager def definition_item(self, name: GenericContent) -> Iterator[None]: -- cgit v1.2.3