mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
fix: Update the all_fences
import and usage in the process_markdown
function
This commit is contained in:
parent
9982863042
commit
35c6d5b569
1 changed files with 6 additions and 4 deletions
10
testsr.py
10
testsr.py
|
@ -6,9 +6,9 @@ import sys
|
||||||
|
|
||||||
from aider.coders.editblock_coder import (
|
from aider.coders.editblock_coder import (
|
||||||
DEFAULT_FENCE,
|
DEFAULT_FENCE,
|
||||||
all_fences,
|
|
||||||
find_original_update_blocks,
|
find_original_update_blocks,
|
||||||
)
|
)
|
||||||
|
from aider.coders.base_coder import all_fences
|
||||||
|
|
||||||
|
|
||||||
def process_markdown(filename):
|
def process_markdown(filename):
|
||||||
|
@ -28,9 +28,13 @@ def process_markdown(filename):
|
||||||
# Get the content (everything after the header)
|
# Get the content (everything after the header)
|
||||||
content = "\n".join(section.split("\n")[1:]).strip()
|
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
|
# Process the content with find_original_update_blocks
|
||||||
try:
|
try:
|
||||||
blocks = list(find_original_update_blocks(content, DEFAULT_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
|
# If an error occurs, add it to the results for this section
|
||||||
results.append({"header": header, "error": str(e)})
|
results.append({"header": header, "error": str(e)})
|
||||||
|
@ -59,8 +63,6 @@ def process_markdown(filename):
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(json.dumps({"error": f"File '{filename}' not found."}, indent=4))
|
print(json.dumps({"error": f"File '{filename}' not found."}, indent=4))
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue