From 8c4eebba085d65f6bc9c8813ec85bb7815fc1caf Mon Sep 17 00:00:00 2001 From: gregorni Date: Tue, 8 Aug 2023 18:05:41 +0200 Subject: [PATCH] Formatter: Distinguish child types and lists --- blueprintcompiler/formatter.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/blueprintcompiler/formatter.py b/blueprintcompiler/formatter.py index f6f4937..eb2a485 100644 --- a/blueprintcompiler/formatter.py +++ b/blueprintcompiler/formatter.py @@ -45,11 +45,9 @@ class Format: if item_as_string in OPENING_TOKENS: split_string = tokenized_str.splitlines() - index = -1 - if "[" in split_string[-2] and "]" in split_string[-2]: - index = -2 - - split_string.insert(index, "") + split_string.insert( + -2 if split_string[-2].strip().startswith("[") else -1, "" + ) tokenized_str = "\n".join(split_string) indent_levels += 1