diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-06-01 14:00:29 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-06-08 08:59:20 +0200 |
commit | ea0906c9ee40d475ef0fe0cc841b363287c8933c (patch) | |
tree | 96f355294f0d0fbe4ee783e78250af0f517536ed /rtemsqual/sphinxcontent.py | |
parent | spec: Fix specification type (diff) | |
download | rtems-central-ea0906c9ee40d475ef0fe0cc841b363287c8933c.tar.bz2 |
sphinxcontent: Support glossary term plurals
Diffstat (limited to '')
-rw-r--r-- | rtemsqual/sphinxcontent.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rtemsqual/sphinxcontent.py b/rtemsqual/sphinxcontent.py index c29586f3..55f5beed 100644 --- a/rtemsqual/sphinxcontent.py +++ b/rtemsqual/sphinxcontent.py @@ -202,12 +202,20 @@ def _get_ref_term(value: Any, key: str) -> str: return f":term:`{value[key]}`" +def _get_ref_term_plural(value: Any, key: str) -> str: + try: + return f":term:`{value[key]} <{value['term']}>`" + except KeyError: + return f":term:`{value['term']}s <{value['term']}>`" + + class SphinxMapper(ItemMapper): """ Sphinx mapper. """ def __init__(self, item: Item): super().__init__(item) self._get_ref = { - "glossary:/term": _get_ref_term + "glossary:/term": _get_ref_term, + "glossary:/plural": _get_ref_term_plural } # type: Dict[str, Callable[[Any, str], str]] def add_get_reference(self, type_name: str, path: str, |