From 35c6d5b56940b7466f9b94a66ff29fd755b266a8 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 22 Aug 2024 08:22:04 -0700 Subject: [PATCH] fix: Update the `all_fences` import and usage in the `process_markdown` function --- testsr.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/testsr.py b/testsr.py index 72601ab31..0b998fdce 100755 --- a/testsr.py +++ b/testsr.py @@ -6,9 +6,9 @@ import sys from aider.coders.editblock_coder import ( DEFAULT_FENCE, - all_fences, find_original_update_blocks, ) +from aider.coders.base_coder import all_fences def process_markdown(filename): @@ -28,9 +28,13 @@ def process_markdown(filename): # Get the content (everything after the header) content = "\n".join(section.split("\n")[1:]).strip() + for fence in all_fences: + if '\n' + fence[0] in content: + break + # Process the content with find_original_update_blocks try: - blocks = list(find_original_update_blocks(content, DEFAULT_FENCE)) + 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)}) @@ -59,8 +63,6 @@ def process_markdown(filename): except FileNotFoundError: print(json.dumps({"error": f"File '{filename}' not found."}, indent=4)) - except Exception as e: - print(e) if __name__ == "__main__":