mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
style: Format code with linter
This commit is contained in:
parent
04b3ada7f7
commit
ef4c40c692
1 changed files with 17 additions and 20 deletions
|
@ -416,13 +416,12 @@ def get_testimonials_js():
|
||||||
"""
|
"""
|
||||||
# Path to README.md, relative to this script
|
# Path to README.md, relative to this script
|
||||||
readme_path = os.path.join(
|
readme_path = os.path.join(
|
||||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "README.md"
|
||||||
"README.md"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
testimonials = []
|
testimonials = []
|
||||||
in_testimonials_section = False
|
in_testimonials_section = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(readme_path, "r", encoding="utf-8") as f:
|
with open(readme_path, "r", encoding="utf-8") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
@ -430,32 +429,30 @@ def get_testimonials_js():
|
||||||
if line.strip() == "## Kind Words From Users":
|
if line.strip() == "## Kind Words From Users":
|
||||||
in_testimonials_section = True
|
in_testimonials_section = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If we've hit another section after testimonials, stop
|
# If we've hit another section after testimonials, stop
|
||||||
if in_testimonials_section and line.startswith("##"):
|
if in_testimonials_section and line.startswith("##"):
|
||||||
break
|
break
|
||||||
|
|
||||||
# Process testimonial lines
|
# Process testimonial lines
|
||||||
if in_testimonials_section and line.strip().startswith("- *\""):
|
if in_testimonials_section and line.strip().startswith('- *"'):
|
||||||
# Extract the quote text: between *" and "*
|
# Extract the quote text: between *" and "*
|
||||||
quote_match = line.split("*\"")[1].split("\"*")[0].strip()
|
quote_match = line.split('*"')[1].split('"*')[0].strip()
|
||||||
|
|
||||||
# Extract the author: between "— [" and "]"
|
# Extract the author: between "— [" and "]"
|
||||||
author_match = line.split("— [")[1].split("]")[0].strip()
|
author_match = line.split("— [")[1].split("]")[0].strip()
|
||||||
|
|
||||||
# Extract the link: between "(" and ")"
|
# Extract the link: between "(" and ")"
|
||||||
link_match = line.split("](")[1].split(")")[0].strip()
|
link_match = line.split("](")[1].split(")")[0].strip()
|
||||||
|
|
||||||
testimonials.append({
|
testimonials.append(
|
||||||
"text": quote_match,
|
{"text": quote_match, "author": author_match, "link": link_match}
|
||||||
"author": author_match,
|
)
|
||||||
"link": link_match
|
|
||||||
})
|
|
||||||
|
|
||||||
# Format as JavaScript array
|
# Format as JavaScript array
|
||||||
if not testimonials:
|
if not testimonials:
|
||||||
return "const testimonials = [];"
|
return "const testimonials = [];"
|
||||||
|
|
||||||
js_array = "const testimonials = [\n"
|
js_array = "const testimonials = [\n"
|
||||||
for i, t in enumerate(testimonials):
|
for i, t in enumerate(testimonials):
|
||||||
js_array += f" {{\n"
|
js_array += f" {{\n"
|
||||||
|
@ -467,9 +464,9 @@ def get_testimonials_js():
|
||||||
js_array += ","
|
js_array += ","
|
||||||
js_array += "\n"
|
js_array += "\n"
|
||||||
js_array += "];"
|
js_array += "];"
|
||||||
|
|
||||||
return js_array
|
return js_array
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error reading testimonials from README: {e}", file=sys.stderr)
|
print(f"Error reading testimonials from README: {e}", file=sys.stderr)
|
||||||
# Return empty array as fallback
|
# Return empty array as fallback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue