diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-05-05 14:41:18 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-05-08 14:34:56 +0200 |
commit | 35a64e258226397348aa6c7060247f0e22b5cd2a (patch) | |
tree | 4f67d0a989e742009f7686cfca1f449c3ab154e3 /rtemsspec/sphinxcontent.py | |
parent | sphinxcontent: Add add_image() (diff) | |
download | rtems-central-35a64e258226397348aa6c7060247f0e22b5cd2a.tar.bz2 |
sphinxcontent: Add SphinxContent.latex_tiny()
Diffstat (limited to 'rtemsspec/sphinxcontent.py')
-rw-r--r-- | rtemsspec/sphinxcontent.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py index f9849fc1..abec5553 100644 --- a/rtemsspec/sphinxcontent.py +++ b/rtemsspec/sphinxcontent.py @@ -72,6 +72,7 @@ def _grid_row(row: Iterable[str], maxi: Iterable[int]) -> str: class SphinxContent(Content): """ This class builds Sphinx content. """ + # pylint: disable=too-many-public-methods def __init__(self, section_level: int = 2): super().__init__("CC-BY-SA-4.0", True) self._tab = " " @@ -195,6 +196,23 @@ class SphinxContent(Content): yield self.open_section(name, label_prefix, label) self.close_section() + def open_latex_tiny(self, size: str = "tiny") -> None: + """ Opens a LaTeX tiny environment. """ + with self.directive("raw", "latex"): + self.add(f"\\begin{{{size}}}") + + def close_latex_tiny(self, size: str = "tiny") -> None: + """ Closes a LaTeX tiny environment. """ + with self.directive("raw", "latex"): + self.add(f"\\end{{{size}}}") + + @contextmanager + def latex_tiny(self, size: str = "tiny") -> Iterator[None]: + """ Opens a LaTeX tiny environment. """ + self.open_latex_tiny(size) + yield + self.close_latex_tiny(size) + def add_licence_and_copyrights(self) -> None: """ Adds a licence and copyright block according to the registered licenses |