mirror of
https://github.com/Lissy93/awesome-privacy.git
synced 2026-03-11 08:55:33 +00:00
Updates readme generation script, to nest stat badges
This commit is contained in:
parent
6f83b8f2ff
commit
1c54abcc2e
1 changed files with 34 additions and 3 deletions
|
|
@ -33,12 +33,35 @@ def repoElement(repoUrl):
|
|||
if not repoUrl:
|
||||
return ""
|
||||
return (
|
||||
f"\t- [[1]}"
|
||||
"&labelColor=%230d1117&color=%23302982&cacheSeconds=3600)]"
|
||||
f"(https://github.com/{repoUrl})\n"
|
||||
f"(https://github.com/{repoUrl})"
|
||||
)
|
||||
|
||||
def tosElement(tosdrId):
|
||||
if not tosdrId:
|
||||
return ""
|
||||
return f"[](https://tosdr.org/en/service/{tosdrId})"
|
||||
|
||||
def awesomePrivacyReport(categoryName, sectionName, serviceName):
|
||||
if not serviceName:
|
||||
return ""
|
||||
def slugify(name):
|
||||
return (name or '').lower().replace(' ', '-')
|
||||
return (
|
||||
f"[![{serviceName} on Awesome Privacy]"
|
||||
f"(https://img.shields.io/badge/{serviceName.replace(' ', '_')}-FC60A8?style=flat&logo=awesomelists&label=Awesome%20Privacy)]"
|
||||
f"(https://awesome-privacy.xyz/{slugify(categoryName)}/{slugify(sectionName)}/{slugify(serviceName)})"
|
||||
)
|
||||
|
||||
def makeStatsCard():
|
||||
return (
|
||||
f"\t- <details><summary>Stats</summary>\n\n"
|
||||
f""
|
||||
f"\n\n</details>"
|
||||
)
|
||||
|
||||
def makeHref(text):
|
||||
if not text: return "#"
|
||||
return re.sub(r'[^\w\s-]', '', text.lower()).replace(" ", "-")
|
||||
|
|
@ -79,7 +102,15 @@ def makeAwesomePrivacy():
|
|||
markdown += (
|
||||
f"- **[{iconElement(app.get('url'), app.get('icon'))} {app.get('name')}]"
|
||||
f"({app.get('url')})** - {app.get('description')} "
|
||||
f"{repoElement(app.get('github'))}"
|
||||
|
||||
+ ((
|
||||
f"\t- <details>\n\t\t<summary>Stats</summary>\n\n\t\t"
|
||||
f"{repoElement(app.get('github'))} "
|
||||
f"{tosElement(app.get('tosdrId'))} "
|
||||
f"{awesomePrivacyReport(category.get('name'), section.get('name'), app.get('name'))} \n"
|
||||
f"\n\t\t</details>\n"
|
||||
)
|
||||
if app.get('github') or app.get('tosdrId') else '')
|
||||
)
|
||||
markdown += "\n"
|
||||
# If word of warning exists, append it
|
||||
|
|
|
|||
Loading…
Reference in a new issue