[rtems-central commit] interfacedoc: Strip leading "_" from parameters
Sebastian Huber
sebh at rtems.org
Tue Nov 24 09:56:38 UTC 2020
Module: rtems-central
Branch: master
Commit: d459b58772183bb987f350c4b463ff05c012520e
Changeset: http://git.rtems.org/rtems-central/commit/?id=d459b58772183bb987f350c4b463ff05c012520e
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Nov 24 10:51:25 2020 +0100
interfacedoc: Strip leading "_" from parameters
---
rtemsspec/interfacedoc.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py
index 6109a71..b6e17ef 100644
--- a/rtemsspec/interfacedoc.py
+++ b/rtemsspec/interfacedoc.py
@@ -105,6 +105,10 @@ def _generate_introduction(target: str, group: Item,
content.write(target)
+def _sanitize_name(name: str) -> str:
+ return name.lstrip("_")
+
+
def _add_function_definition(content: CContent, mapper: ItemMapper, item: Item,
value: Dict[str, Any]) -> None:
ret = mapper.substitute(value["return"])
@@ -117,7 +121,7 @@ def _add_macro_definition(content: CContent, _mapper: ItemMapper, item: Item,
_value: Dict[str, Any]) -> None:
ret = "#define"
name = item["name"]
- params = [param["name"] for param in item["params"]]
+ params = [_sanitize_name(param["name"]) for param in item["params"]]
content.call_function(ret, name, params, semicolon="")
@@ -167,9 +171,8 @@ def _generate_directive(content: SphinxContent, mapper: _Mapper,
if item["params"]:
content.add(".. rubric:: PARAMETERS:")
for param in item["params"]:
- param_name = mapper.substitute(param["name"])
content.add_definition_item(
- f"``{param_name}``",
+ f"``{_sanitize_name(param['name'])}``",
mapper.substitute(f"This parameter {param['description']}"),
wrap=True)
if item["description"]:
More information about the vc
mailing list