summaryrefslogtreecommitdiffstats
path: root/rtemsspec
diff options
context:
space:
mode:
Diffstat (limited to 'rtemsspec')
-rw-r--r--rtemsspec/glossary.py9
-rw-r--r--rtemsspec/tests/spec-glossary/doc.rst1
2 files changed, 9 insertions, 1 deletions
diff --git a/rtemsspec/glossary.py b/rtemsspec/glossary.py
index bb0bf495..0ac150e2 100644
--- a/rtemsspec/glossary.py
+++ b/rtemsspec/glossary.py
@@ -64,13 +64,20 @@ def _generate_glossary_content(terms: ItemMap) -> SphinxContent:
return content
+_TERM = re.compile(r":term:`([^`]+)`")
+_TERM_2 = re.compile(r"^[^<]+<([^>]+)>")
+
+
def _find_glossary_terms(path: str, document_terms: ItemMap,
glossary: _Glossary) -> None:
for src in glob.glob(path + "/**/*.rst", recursive=True):
if src.endswith("glossary.rst"):
continue
with open(src, "r") as out:
- for term in re.findall(":term:`([^`]+)`", out.read()):
+ for term in _TERM.findall(out.read()):
+ match = _TERM_2.search(term)
+ if match:
+ term = match.group(1)
item = glossary.term_to_item[term]
document_terms[item.uid] = item
diff --git a/rtemsspec/tests/spec-glossary/doc.rst b/rtemsspec/tests/spec-glossary/doc.rst
index e07b9a35..b86ed6c0 100644
--- a/rtemsspec/tests/spec-glossary/doc.rst
+++ b/rtemsspec/tests/spec-glossary/doc.rst
@@ -1 +1,2 @@
:term:`T`
+:term:`Ts <T>`