mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
fix: Improve testimonial parsing for different dash formats
This commit is contained in:
parent
2d3162a90b
commit
fc6a05ced6
1 changed files with 19 additions and 1 deletions
|
@ -459,20 +459,38 @@ def get_testimonials_js():
|
|||
link = ""
|
||||
|
||||
# Try to extract author and link if they exist
|
||||
# Check for the em dash format first: "— [author](link)"
|
||||
if "— [" in full_line and "](" in full_line:
|
||||
author_parts = full_line.split("— [")
|
||||
if len(author_parts) > 1:
|
||||
author = author_parts[1].split("]")[0].strip()
|
||||
|
||||
|
||||
# Extract the link if it exists
|
||||
link_parts = full_line.split("](")
|
||||
if len(link_parts) > 1:
|
||||
link = link_parts[1].split(")")[0].strip()
|
||||
# Check for regular dash format: "- [author](link)"
|
||||
elif " - [" in full_line and "](" in full_line:
|
||||
author_parts = full_line.split(" - [")
|
||||
if len(author_parts) > 1:
|
||||
author = author_parts[1].split("]")[0].strip()
|
||||
|
||||
# Extract the link if it exists
|
||||
link_parts = full_line.split("](")
|
||||
if len(link_parts) > 1:
|
||||
link = link_parts[1].split(")")[0].strip()
|
||||
# Check for em dash without link: "— author"
|
||||
elif "— " in full_line:
|
||||
# Format without a link, just plain text author
|
||||
author_parts = full_line.split("— ")
|
||||
if len(author_parts) > 1:
|
||||
author = author_parts[1].strip()
|
||||
# Check for regular dash without link: "- author"
|
||||
elif " - " in full_line:
|
||||
# Format without a link, just plain text author
|
||||
author_parts = full_line.split(" - ")
|
||||
if len(author_parts) > 1:
|
||||
author = author_parts[1].strip()
|
||||
|
||||
testimonials.append(
|
||||
{"text": quote_text, "author": author, "link": link}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue