summaryrefslogtreecommitdiffstats
path: root/rtemsspec/sphinxcontent.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-21 11:13:15 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-21 11:15:24 +0100
commit07aaa327e54123c2c9852a650fd9db598c3dc11a (patch)
treed28544cc8d957878548aed371029a5661358a337 /rtemsspec/sphinxcontent.py
parentitems: Add ItemMapper.copyrights_by_license (diff)
downloadrtems-central-07aaa327e54123c2c9852a650fd9db598c3dc11a.tar.bz2
sphinxcontent: Add SphinxContent.label_scope()
Diffstat (limited to 'rtemsspec/sphinxcontent.py')
-rw-r--r--rtemsspec/sphinxcontent.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index c47ea68e..12497ccc 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -113,6 +113,13 @@ class SphinxContent(Content):
""" Pops the top from the label stack. """
self._label_stack.pop()
+ @contextmanager
+ def label_scope(self, label: str) -> Iterator[None]:
+ """ Opens a label scope context. """
+ self.push_label(label)
+ yield
+ self.pop_label()
+
def add_label(self, label: str) -> None:
""" Adds a label. """
self.add(".. _" + label.strip() + ":")