INNER CODE UNIT · Python
code
introlab/rtabmap · doxygen/generate_parameters_page.py:232
def code(value):
value = value.strip()
return '`%s`' % value if value else '`""`'
# Consecutive branches giving the same value are merged, so that a value
# that only changes in the last #else does not repeat three times.
merged = []
for value, branch in param.defaults:
if merged and merged[-1][0] == value:
merged[-1][1].append(branch)
else:
merged.append([value, [branch]])
if len(merged) == 1:
value, branches = merged[0]
if not any(branches) or None in branches:
return code(value)
return '%s with `%s`' % (code(value), escape_cell(' or '.join(branches)))