summaryrefslogtreecommitdiffstats
path: root/rtemsspec/sphinxcontent.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-05-05 14:41:18 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-05-08 14:34:56 +0200
commit5ab6873e1fff704b6dcc7f183e7bd67a8b5bf8c4 (patch)
treeff1dbc676eaf8605c5ecc3bbf3f3b66706619bb4 /rtemsspec/sphinxcontent.py
parentsphinxcontent: Rework label handling (diff)
downloadrtems-central-5ab6873e1fff704b6dcc7f183e7bd67a8b5bf8c4.tar.bz2
sphinxcontent: Add section stack
Diffstat (limited to 'rtemsspec/sphinxcontent.py')
-rw-r--r--rtemsspec/sphinxcontent.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index 42cf6430..c55802ce 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -78,6 +78,11 @@ class SphinxContent(Content):
self._tab = " "
self._section_level = section_level
self._label_stack = [""]
+ self._section_stack: List[str] = []
+
+ def get_sections(self) -> List[str]:
+ """ Gets the list of sections of the current scope. """
+ return self._section_stack
@property
def label(self) -> str:
@@ -200,14 +205,14 @@ class SphinxContent(Content):
else:
self.push_label(label)
self.add_label(label)
- self.add_header(name, self._section_level)
- self._section_level += 1
+ self.add_header(name, self._section_level + len(self._section_stack))
+ self._section_stack.append(name)
return label
def close_section(self) -> None:
""" Closes a section. """
- self._section_level -= 1
self.pop_label()
+ self._section_stack.pop()
@contextmanager
def section(self,