diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-26 13:52:43 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-26 14:03:41 +0100 |
commit | 7ceb7cac4ea3fae87fc514e9bc7e18aa88bacb49 (patch) | |
tree | b5d9450f5f7ed67fe2565005bfa3a068dfcbc1ce /rtemsspec | |
parent | sphinxcontent: Support recursive mappings (diff) | |
download | rtems-central-7ceb7cac4ea3fae87fc514e9bc7e18aa88bacb49.tar.bz2 |
glossary: Find term plurals
Diffstat (limited to 'rtemsspec')
-rw-r--r-- | rtemsspec/glossary.py | 9 | ||||
-rw-r--r-- | rtemsspec/tests/spec-glossary/doc.rst | 1 |
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>` |