style: Remove trailing whitespace

This commit is contained in:
Paul Gauthier (aider) 2025-03-31 11:41:51 +13:00
parent 83c599e741
commit 2d3162a90b

View file

@ -425,7 +425,7 @@ def get_testimonials_js():
try: try:
with open(readme_path, "r", encoding="utf-8") as f: with open(readme_path, "r", encoding="utf-8") as f:
lines = f.readlines() lines = f.readlines()
# Find the testimonials section # Find the testimonials section
for i, line in enumerate(lines): for i, line in enumerate(lines):
if line.strip() == "## Kind Words From Users": if line.strip() == "## Kind Words From Users":
@ -433,7 +433,7 @@ def get_testimonials_js():
# Start processing from the next line # Start processing from the next line
start_idx = i + 1 start_idx = i + 1
break break
# If we found the section # If we found the section
if in_testimonials_section: if in_testimonials_section:
for i in range(start_idx, len(lines)): for i in range(start_idx, len(lines)):
@ -441,29 +441,29 @@ def get_testimonials_js():
# If we've hit another section, stop # If we've hit another section, stop
if line.startswith("##"): if line.startswith("##"):
break break
# Process testimonial lines # Process testimonial lines
if line.strip().startswith('- *"'): if line.strip().startswith('- *"'):
try: try:
# Get the full line # Get the full line
full_line = line.strip() full_line = line.strip()
# Extract the quote text between *" and "* # Extract the quote text between *" and "*
if '*"' in full_line and '"*' in full_line: if '*"' in full_line and '"*' in full_line:
quote_parts = full_line.split('*"') quote_parts = full_line.split('*"')
if len(quote_parts) > 1: if len(quote_parts) > 1:
quote_text = quote_parts[1].split('"*')[0].strip() quote_text = quote_parts[1].split('"*')[0].strip()
# Default values # Default values
author = "Anonymous" author = "Anonymous"
link = "" link = ""
# Try to extract author and link if they exist # Try to extract author and link if they exist
if "— [" in full_line and "](" in full_line: if "— [" in full_line and "](" in full_line:
author_parts = full_line.split("— [") author_parts = full_line.split("— [")
if len(author_parts) > 1: if len(author_parts) > 1:
author = author_parts[1].split("]")[0].strip() author = author_parts[1].split("]")[0].strip()
# Extract the link if it exists # Extract the link if it exists
link_parts = full_line.split("](") link_parts = full_line.split("](")
if len(link_parts) > 1: if len(link_parts) > 1:
@ -473,14 +473,15 @@ def get_testimonials_js():
author_parts = full_line.split("") author_parts = full_line.split("")
if len(author_parts) > 1: if len(author_parts) > 1:
author = author_parts[1].strip() author = author_parts[1].strip()
testimonials.append({ testimonials.append(
"text": quote_text, {"text": quote_text, "author": author, "link": link}
"author": author, )
"link": link
})
except Exception as e: except Exception as e:
print(f"Error parsing testimonial line: {line}. Error: {e}", file=sys.stderr) print(
f"Error parsing testimonial line: {line}. Error: {e}",
file=sys.stderr,
)
continue continue
# Format as JavaScript array with script tags # Format as JavaScript array with script tags