mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
fix: Handle errors in processing Markdown sections
This commit is contained in:
parent
8ec67d339d
commit
882cf676b9
1 changed files with 5 additions and 4 deletions
|
@ -33,7 +33,6 @@ def process_markdown(filename):
|
||||||
# Split the content into sections based on '####' headers
|
# Split the content into sections based on '####' headers
|
||||||
sections = re.split(r"(?=####\s)", content)
|
sections = re.split(r"(?=####\s)", content)
|
||||||
|
|
||||||
results = []
|
|
||||||
for section in sections:
|
for section in sections:
|
||||||
if "editblock_coder.py" in section or "test_editblock.py" in section:
|
if "editblock_coder.py" in section or "test_editblock.py" in section:
|
||||||
continue
|
continue
|
||||||
|
@ -53,10 +52,13 @@ def process_markdown(filename):
|
||||||
try:
|
try:
|
||||||
blocks = list(find_original_update_blocks(content, fence))
|
blocks = list(find_original_update_blocks(content, fence))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
# If an error occurs, add it to the results for this section
|
print("***", header, "*" * 20)
|
||||||
results.append({"header": header, "error": str(e)})
|
print(str(e))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if blocks:
|
||||||
|
print("***", header, "*" * 20)
|
||||||
|
|
||||||
for block in blocks:
|
for block in blocks:
|
||||||
if block[0] is None: # This is a shell command block
|
if block[0] is None: # This is a shell command block
|
||||||
print("*** SHELL", "*" * 20)
|
print("*** SHELL", "*" * 20)
|
||||||
|
@ -65,7 +67,6 @@ def process_markdown(filename):
|
||||||
|
|
||||||
else: # This is a SEARCH/REPLACE block
|
else: # This is a SEARCH/REPLACE block
|
||||||
print("*** SEARCH:", block[0], "*" * 20)
|
print("*** SEARCH:", block[0], "*" * 20)
|
||||||
print("***", header, "*" * 20)
|
|
||||||
print(block[1], end="")
|
print(block[1], end="")
|
||||||
print("*" * 20)
|
print("*" * 20)
|
||||||
print(block[2], end="")
|
print(block[2], end="")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue