summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-01-22 14:34:10 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-01 06:59:01 +0100
commit2a00eeb8d37052555ae5eb0fa10afc8a343f6f24 (patch)
tree37bd7426d493a8bd971e58fe7aa34f8bbece8b08
parentinterface: Use paragraph for notes (diff)
downloadrtems-central-2a00eeb8d37052555ae5eb0fa10afc8a343f6f24.tar.bz2
content: Move list support to Content()
-rw-r--r--rtemsspec/content.py37
-rw-r--r--rtemsspec/sphinxcontent.py37
2 files changed, 37 insertions, 37 deletions
diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 616a7a18..e0717b4b 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -450,6 +450,43 @@ class Content:
yield
self.close_comment_block()
+ def add_list_item(self, content: GenericContent) -> None:
+ """ Adds a list item. """
+ self.wrap(content, initial_indent="* ", subsequent_indent=" ")
+
+ def add_list(self,
+ items: GenericContentIterable,
+ prologue: Optional[GenericContent] = None,
+ epilogue: Optional[GenericContent] = None,
+ add_blank_line: bool = False) -> None:
+ """ Adds a list with introduction. """
+ if items:
+ self.wrap(prologue)
+ for item in items:
+ self.add_list_item(item)
+ if add_blank_line:
+ self.add_blank_line()
+ self.wrap(epilogue)
+
+ def open_list_item(self, content: GenericContent) -> None:
+ """ Opens a list item. """
+ self.add(["* "])
+ self.push_indent(" ")
+ self.gap = True
+ self.paste(content)
+
+ def close_list_item(self) -> None:
+ """ Closes a list item. """
+ self.pop_indent()
+ self.gap = True
+
+ @contextmanager
+ def list_item(self, content: GenericContent) -> Iterator[None]:
+ """ Opens a list item context. """
+ self.open_list_item(content)
+ yield
+ self.close_list_item()
+
def add_automatically_generated_warning(self) -> None:
""" Adds a warning that the file is automatically generated. """
with self.comment_block():
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index 5f5493fc..e7881cf3 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -153,43 +153,6 @@ class SphinxContent(Content):
yield self.open_section(name, label_prefix)
self.close_section()
- def add_list_item(self, content: GenericContent) -> None:
- """ Adds a list item. """
- self.wrap(content, initial_indent="* ", subsequent_indent=" ")
-
- def add_list(self,
- items: GenericContentIterable,
- prologue: Optional[GenericContent] = None,
- epilogue: Optional[GenericContent] = None,
- add_blank_line: bool = False) -> None:
- """ Adds a list with introduction. """
- if items:
- self.wrap(prologue)
- for item in items:
- self.add_list_item(item)
- if add_blank_line:
- self.add_blank_line()
- self.wrap(epilogue)
-
- def open_list_item(self, content: GenericContent) -> None:
- """ Opens a list item. """
- self.add(["* "])
- self.push_indent(" ")
- self.gap = True
- self.paste(content)
-
- def close_list_item(self) -> None:
- """ Closes a list item. """
- self.pop_indent()
- self.gap = True
-
- @contextmanager
- def list_item(self, content: GenericContent) -> Iterator[None]:
- """ Opens a list item context. """
- self.open_list_item(content)
- yield
- self.close_list_item()
-
def add_licence_and_copyrights(self) -> None:
"""
Adds a licence and copyright block according to the registered licenses