From cf72a499f35b9bfa77b7ee3a9b0dd4a0ad7d9326 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 9 Mar 2021 08:45:52 +0100 Subject: sphinxcontent: Add SphinxInterfaceMapper --- rtemsspec/sphinxcontent.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'rtemsspec/sphinxcontent.py') diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py index 2d214021..1a00b79c 100644 --- a/rtemsspec/sphinxcontent.py +++ b/rtemsspec/sphinxcontent.py @@ -209,6 +209,10 @@ def _get_appl_config_option(ctx: ItemGetValueContext) -> Any: return f":ref:`{ctx.value[ctx.key]}`" +def _get_value_sphinx_data(ctx: ItemGetValueContext) -> Any: + return f":c:data:`{ctx.value[ctx.key]}`" + + def _get_value_sphinx_macro(ctx: ItemGetValueContext) -> Any: return f":c:macro:`{ctx.value[ctx.key]}`" @@ -244,13 +248,13 @@ class SphinxMapper(ItemMapper): self.add_get_value("glossary/term:/term", _get_ref_term) self.add_get_value("glossary/term:/plural", _get_ref_term_plural) self.add_get_value("interface/appl-config-option/feature-enable:/name", - _get_appl_config_option) + _get_value_sphinx_data) self.add_get_value("interface/appl-config-option/feature:/name", - _get_appl_config_option) + _get_value_sphinx_data) self.add_get_value("interface/appl-config-option/initializer:/name", - _get_appl_config_option) + _get_value_sphinx_data) self.add_get_value("interface/appl-config-option/integer:/name", - _get_appl_config_option) + _get_value_sphinx_data) self.add_get_value("interface/define:/name", _get_value_sphinx_macro) self.add_get_value("interface/enum:/name", _get_value_sphinx_type) self.add_get_value("interface/enumerator:/name", @@ -267,3 +271,17 @@ class SphinxMapper(ItemMapper): _get_value_sphinx_function) self.add_get_value("interface/unspecified-type:/name", _get_value_sphinx_unspecified_type) + + +class SphinxInterfaceMapper(SphinxMapper): + """ Sphinx item mapper for the interface documentation. """ + def __init__(self, item: Item, recursive: bool = False): + super().__init__(item, recursive) + self.add_get_value("interface/appl-config-option/feature-enable:/name", + _get_appl_config_option) + self.add_get_value("interface/appl-config-option/feature:/name", + _get_appl_config_option) + self.add_get_value("interface/appl-config-option/initializer:/name", + _get_appl_config_option) + self.add_get_value("interface/appl-config-option/integer:/name", + _get_appl_config_option) -- cgit v1.2.3