Skip to content

Commit

Permalink
contributors: Show users' GitHub avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Nov 28, 2024
1 parent 38d5612 commit 47c29c4
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions scripts/contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@
你也可以前往 <https://github.com/ustclug/mirrorhelp/graphs/contributors> 获取全部贡献者列表。
以字典序排序:
<style>
.md-typeset div.grid.cards > ul > li {
padding: 0;
padding-right: .8em;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.md-typeset div.grid.cards > ul > li > img {
margin: 0;
border-top-left-radius: .1rem;
border-bottom-left-radius: .1rem;
}
.md-typeset div.grid.cards > ul > li > img + a {
margin: 0 .8em;
}
</style>
"""


Expand All @@ -30,13 +51,16 @@ def get_api():


def main():
data = get_api()
data.sort(key=lambda x: x["login"].casefold())

filename = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir, "docs", "contributor.md"))
with open(filename, "w") as f:
print(HEADER, file=f)
data = get_api()
data.sort(key=lambda x: x["login"].casefold())
print('<div class="grid cards" markdown>', file=f)
for item in data:
print(f"- [{item['login']}]({item['html_url']})", file=f)
print(f"- ![Avatar]({item['avatar_url']}){{: width=64 height=64 }} [{item['login']}]({item['html_url']})", file=f)
print('</div>', file=f)


if __name__ == "__main__":
Expand Down

0 comments on commit 47c29c4

Please sign in to comment.