From 882cf676b974a5f7d38b338837a269912ae4ee02 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 22 Aug 2024 09:01:04 -0700 Subject: [PATCH] fix: Handle errors in processing Markdown sections --- testsr.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testsr.py b/testsr.py index f983ef9c1..90003d521 100755 --- a/testsr.py +++ b/testsr.py @@ -33,7 +33,6 @@ def process_markdown(filename): # Split the content into sections based on '####' headers sections = re.split(r"(?=####\s)", content) - results = [] for section in sections: if "editblock_coder.py" in section or "test_editblock.py" in section: continue @@ -53,10 +52,13 @@ def process_markdown(filename): try: blocks = list(find_original_update_blocks(content, fence)) except ValueError as e: - # If an error occurs, add it to the results for this section - results.append({"header": header, "error": str(e)}) + print("***", header, "*" * 20) + print(str(e)) continue + if blocks: + print("***", header, "*" * 20) + for block in blocks: if block[0] is None: # This is a shell command block print("*** SHELL", "*" * 20) @@ -65,7 +67,6 @@ def process_markdown(filename): else: # This is a SEARCH/REPLACE block print("*** SEARCH:", block[0], "*" * 20) - print("***", header, "*" * 20) print(block[1], end="") print("*" * 20) print(block[2], end="")