forked from kate/uniborg
fix broken indentation when lots of nested items are present
This commit is contained in:
parent
b21f5ec104
commit
573f36bf57
|
@ -37,7 +37,7 @@ def yaml_format(obj, indent=0):
|
||||||
has_multiple_items = len(items) > 2
|
has_multiple_items = len(items) > 2
|
||||||
if has_multiple_items:
|
if has_multiple_items:
|
||||||
result.append('\n')
|
result.append('\n')
|
||||||
indent += 2
|
indent += 2
|
||||||
for k, v in items:
|
for k, v in items:
|
||||||
if k == '_' or v is None:
|
if k == '_' or v is None:
|
||||||
continue
|
continue
|
||||||
|
@ -51,7 +51,8 @@ def yaml_format(obj, indent=0):
|
||||||
result.append(f'{formatted}')
|
result.append(f'{formatted}')
|
||||||
result.append('\n')
|
result.append('\n')
|
||||||
result.pop()
|
result.pop()
|
||||||
indent -= 2
|
if has_multiple_items:
|
||||||
|
indent -= 2
|
||||||
elif isinstance(obj, str):
|
elif isinstance(obj, str):
|
||||||
# truncate long strings and display elipsis
|
# truncate long strings and display elipsis
|
||||||
result = repr(obj[:STR_LEN_MAX])
|
result = repr(obj[:STR_LEN_MAX])
|
||||||
|
|
Loading…
Reference in New Issue