Skip to content

The definitive list of the best of (consumer facing) open source.

Updated script so 60.0k shows as 60k

Lucase66edbd2b5ea
diff --git a/source/scripts/generation/contents_generator.py b/source/scripts/generation/contents_generator.py
index 2be2a1e..26215d8 100644
--- a/source/scripts/generation/contents_generator.py
+++ b/source/scripts/generation/contents_generator.py
@@ -13,12 +13,19 @@ def extract_repo_path(link):
def format_stars(n):
if n >= 1_000_000:
- return f"{n/1_000_000:.1f}M"
+ value = n / 1_000_000
+ suffix = 'M'
elif n >= 1_000:
- return f"{n/1_000:.1f}k"
+ value = n / 1_000
+ suffix = 'k'
else:
return str(n)
+ if value.is_integer():
+ return f"{int(value)}{suffix}"
+ else:
+ return f"{value:.1f}{suffix}"
+
def generate_contents(platform="all"):
with open("source/data/categories.json", "r", encoding="utf-8") as f: