forked from uniborg/uniborg
Merge branch 'master' into kate
This commit is contained in:
commit
e810a977c5
|
@ -45,11 +45,14 @@ def yaml_format(obj, indent=0):
|
||||||
if not formatted.strip():
|
if not formatted.strip():
|
||||||
continue
|
continue
|
||||||
result.append(' ' * (indent if has_multiple_items else 1))
|
result.append(' ' * (indent if has_multiple_items else 1))
|
||||||
result.append(f'{k}: {formatted}')
|
result.append(f'{k}:')
|
||||||
|
if not formatted[0].isspace():
|
||||||
|
result.append(' ')
|
||||||
|
result.append(f'{formatted}')
|
||||||
result.append('\n')
|
result.append('\n')
|
||||||
result.pop()
|
result.pop()
|
||||||
|
if has_multiple_items:
|
||||||
indent -= 2
|
indent -= 2
|
||||||
result.append(' ' * indent)
|
|
||||||
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])
|
||||||
|
@ -76,7 +79,6 @@ def yaml_format(obj, indent=0):
|
||||||
result.append('\n')
|
result.append('\n')
|
||||||
result.pop()
|
result.pop()
|
||||||
indent -= 2
|
indent -= 2
|
||||||
result.append(' ' * indent)
|
|
||||||
else:
|
else:
|
||||||
return repr(obj)
|
return repr(obj)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue