INNER CODE UNIT · Python
resolve_description
introlab/rtabmap · doxygen/generate_parameters_page.py:205
def resolve_description(param, by_accessor):
"""Render the description, resolving uFormat() placeholders to key links."""
text = param.description.strip()
if text.startswith('uFormat('):
args = split_args(text[len('uFormat('):text.rindex(')')])
text = unescape(args[0])
for arg in args[1:]:
match = re.search(r'\bk([A-Za-z0-9]+)\(\)', arg)
replacement = arg.strip()
if match:
other = by_accessor.get('k' + match.group(1))
replacement = page_link(other) if other else match.group(1)
if '"%s"' in text:
text = text.replace('"%s"', replacement, 1)
else:
text = text.replace('%s', replacement, 1)
else:
text = unescape(text)