forked from kate/uniborg
hide empty objects
This commit is contained in:
parent
774c0bebdb
commit
192e1d890a
|
@ -44,8 +44,11 @@ def yaml_format(obj, indent=0):
|
||||||
for k, v in items:
|
for k, v in items:
|
||||||
if k == '_' or v is None:
|
if k == '_' or v is None:
|
||||||
continue
|
continue
|
||||||
|
formatted = yaml_format(v, indent)
|
||||||
|
if not formatted.strip():
|
||||||
|
continue
|
||||||
result.append(' ' * (indent if has_multiple_items else 1))
|
result.append(' ' * (indent if has_multiple_items else 1))
|
||||||
result.append(f'{k}: {yaml_format(v, indent)}')
|
result.append(f'{k}: {formatted}')
|
||||||
result.append('\n')
|
result.append('\n')
|
||||||
result.pop()
|
result.pop()
|
||||||
indent -= 2
|
indent -= 2
|
||||||
|
|
Loading…
Reference in New Issue