Update generate_readme.py

This commit is contained in:
Mohamed Elashri 2024-11-15 22:08:26 -05:00 committed by GitHub
parent b55c8df426
commit 158e9072e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,8 +60,10 @@ def remove_extra_parentheses(lines):
def add_awesome_badge(lines):
"""Ensure the Awesome badge is correctly added."""
badge = '[![Awesome](https://awesome.re/badge-flat.svg)](https://awesome.re)'
# Check if the badge already exists
if any(badge in line for line in lines):
return lines
# Add the badge at the top if not present
lines.insert(0, badge)
return lines