Enhance README generation with improved user display and stats summary; format languages used section

This commit is contained in:
2026-02-28 13:48:27 +00:00
parent 9ef07b5069
commit 1c68c76437

View File

@@ -66,17 +66,21 @@ def do_readme_parse():
data = collect_gitea_data() # does all the API calls and collects the data into a structured format, collected once to avoid multiple API calls during the README build process, this data will be used to populate the README template with the relevant information about the Gitea instance and the user's repositories. data = collect_gitea_data() # does all the API calls and collects the data into a structured format, collected once to avoid multiple API calls during the README build process, this data will be used to populate the README template with the relevant information about the Gitea instance and the user's repositories.
storage_used = sum(repo["size"] for repo in data["repos"]) storage_used = sum(repo["size"] for repo in data["repos"])
languages_used = set(repo["language"] for repo in data["repos"] if repo["language"] != "N/A") languages_used = set(repo["language"] for repo in data["repos"] if repo["language"] != "N/A")
username = data["username"].capitalize() if data["username"] else "Unknown User"
md = f"# {data['username']}' Developer Hub\n\n" md = f"# {username}'s Developer Hub\n\n"
md += f"## Welcome to {data['username']}'s Gitea Developer Hub! This is a collection of repositories and projects that I have created and maintained on my Gitea instance. Here you can find various projects that I have worked on, ranging from personal projects to open-source contributions.\n\n" md += f"## Welcome to {username}'s Gitea Developer Hub! This is a collection of repositories and projects that I have created and maintained on my Gitea instance. Here you can find various projects that I have worked on, ranging from personal projects to open-source contributions.\n\n"
if data["repos"]: if data["repos"]:
md += f"### 📂 Repository Breakdown\n\n" md += f"### 📂 Repository Breakdown\n\n"
for repo in data["repos"]: for repo in data["repos"]:
md += f"- [{repo['name']}]({GITEA_URL}/{USERNAME}/{repo['name']}) - {repo['language']}\n" md += f"- [{repo['name']}]({GITEA_URL}/{USERNAME}/{repo['name']}) - {repo['language']}\n"
md += "## 📊 Stats Summary\n"
md += f"\n**Total Repositories:** {len(data['repos'])}\n\n" md += f"\n**Total Repositories:** {len(data['repos'])}\n\n"
md += f"**Total Storage Used:** {format_bytes(storage_used)}\n\n" md += f"**Total Storage Used:** {format_bytes(storage_used)}\n\n"
if languages_used: if languages_used:
md += f"**Languages Used:** {', '.join(languages_used)}\n\n" md += f"### **Languages Used:**"
for lang in languages_used:
md += f"- **{lang}**\n"
md += "\n" md += "\n"