INNER CODE UNIT · Python
leading_spaces
magicsword-io/LOLRMM · bin/fix_yaml_formatting.py:89
and leading_spaces == list_stack[-1][0]
and not stripped.startswith("- ")
):
# This line is at the dash indent level but isn't a new list item
# It should be a continuation - indent it to expected_continuation_indent
expected_indent = list_stack[-1][1]
fixed_lines.append(" " * expected_indent + stripped)
# If this line is a key (ends with :), track it for potential nested list
if ":" in stripped and not stripped.startswith("#"):
last_key_indent = expected_indent
else:
# Regular line, no adjustment needed
fixed_lines.append(line)
# Track if this is a key for potential nested list
if ":" in stripped and not stripped.startswith("#"):
last_key_indent = leading_spaces
else:
last_key_indent = None