Skip to content

Commit

Permalink
STY Adjusts layout for Authors (#15095)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmarmo authored and thomasjpfan committed Oct 2, 2019
1 parent 76d5f06 commit 6127b4e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 85 deletions.
48 changes: 16 additions & 32 deletions build_tools/generate_authors_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
import requests
import getpass
import time
from pathlib import Path

print("user:", file=sys.stderr)
user = input()
passwd = getpass.getpass("Password or access token:\n")
auth = (user, passwd)

ROW_SIZE = 7
LOGO_URL = 'https://avatars2.githubusercontent.com/u/365630?v=4'
REPO_FOLDER = Path(__file__).parent.parent


def get(url):
Expand All @@ -34,18 +35,6 @@ def get(url):
return reply


def group_iterable(iterable, size):
"""Group iterable into lines"""
group = []
for element in iterable:
group.append(element)
if len(group) == size:
yield group
group = []
if len(group) != 0:
yield group


def get_contributors():
"""Get the list of contributor profiles. Require admin rights."""
# get members of scikit-learn core-dev on GitHub
Expand Down Expand Up @@ -120,33 +109,28 @@ def get_profile(login):


def key(profile):
"""Get the last name in lower case"""
return profile["name"].split(' ')[-1].lower()
"""Get a sorting key based on the lower case last name, then firstname"""
components = profile["name"].lower().split(' ')
return " ".join([components[-1]] + components[:-1])


def generate_table(contributors):
lines = [
(".. raw :: html\n"),
(" <!-- Generated by generate_authors_table.py -->"),
(" <table>"),
(" <col style='width:%d%%' span='%d'>" %
(int(100 / ROW_SIZE), ROW_SIZE)),
(" <div class=\"sk-authors-container\">"),
(" <style>"),
(" img.avatar {border-radius: 10px;}"),
(" td {vertical-align: top;}"),
(" </style>"),
]
for row in group_iterable(contributors, size=ROW_SIZE):
lines.append(" <tr>")
for contributor in row:
lines.append(" <td>")
lines.append(
" <a href='%s'><img src='%s' class='avatar' /></a> <br />" %
(contributor["html_url"], contributor["avatar_url"]))
lines.append(" <p>%s</p>" % (contributor["name"], ))
lines.append(" </td>")
lines.append(" </tr>")
lines.append(" </table>")
for contributor in contributors:
lines.append(" <div>")
lines.append(
" <a href='%s'><img src='%s' class='avatar' /></a> <br />" %
(contributor["html_url"], contributor["avatar_url"]))
lines.append(" <p>%s</p>" % (contributor["name"], ))
lines.append(" </div>")
lines.append(" </div>")
return '\n'.join(lines)


Expand All @@ -161,8 +145,8 @@ def generate_list(contributors):

core_devs, emeritus = get_contributors()

with open("../doc/authors.rst", "w+") as rst_file:
with open(REPO_FOLDER / "doc" / "authors.rst", "w+") as rst_file:
rst_file.write(generate_table(core_devs))

with open("../doc/authors_emeritus.rst", "w+") as rst_file:
with open(REPO_FOLDER / "doc" / "authors_emeritus.rst", "w+") as rst_file:
rst_file.write(generate_list(emeritus))
96 changes: 44 additions & 52 deletions doc/authors.rst
Original file line number Diff line number Diff line change
@@ -1,96 +1,88 @@
.. raw :: html
<!-- Generated by generate_authors_table.py -->
<table>
<col style='width:14%' span='7'>
<div class="sk-authors-container">
<style>
img.avatar {border-radius: 10px;}
td {vertical-align: top;}
</style>
<tr>
<td>
<div>
<a href='https://github.com/jeremiedbb'><img src='https://avatars2.githubusercontent.com/u/34657725?v=4' class='avatar' /></a> <br />
<p>Jérémie Du Boisberranger</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/jorisvandenbossche'><img src='https://avatars2.githubusercontent.com/u/1020496?v=4' class='avatar' /></a> <br />
<p>Joris Van den Bossche</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/lesteve'><img src='https://avatars1.githubusercontent.com/u/1680079?v=4' class='avatar' /></a> <br />
<p>Loïc Estève</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/thomasjpfan'><img src='https://avatars2.githubusercontent.com/u/5402633?v=4' class='avatar' /></a> <br />
<p>Thomas J Fan</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/agramfort'><img src='https://avatars2.githubusercontent.com/u/161052?v=4' class='avatar' /></a> <br />
<p>Alexandre Gramfort</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/ogrisel'><img src='https://avatars0.githubusercontent.com/u/89061?v=4' class='avatar' /></a> <br />
<p>Olivier Grisel</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/yarikoptic'><img src='https://avatars3.githubusercontent.com/u/39889?v=4' class='avatar' /></a> <br />
<p>Yaroslav Halchenko</p>
</td>
</tr>
<tr>
<td>
</div>
<div>
<a href='https://github.com/NicolasHug'><img src='https://avatars2.githubusercontent.com/u/1190450?v=4' class='avatar' /></a> <br />
<p>Nicolas Hug</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/adrinjalali'><img src='https://avatars3.githubusercontent.com/u/1663864?v=4' class='avatar' /></a> <br />
<p>Adrin Jalali</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/glemaitre'><img src='https://avatars2.githubusercontent.com/u/7454015?v=4' class='avatar' /></a> <br />
<p>Guillaume Lemaitre</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/jmetzen'><img src='https://avatars1.githubusercontent.com/u/1116263?v=4' class='avatar' /></a> <br />
<p>Jan Hendrik Metzen</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/amueller'><img src='https://avatars3.githubusercontent.com/u/449558?v=4' class='avatar' /></a> <br />
<p>Andreas Mueller</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/vene'><img src='https://avatars0.githubusercontent.com/u/241745?v=4' class='avatar' /></a> <br />
<p>Vlad Niculae</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/jnothman'><img src='https://avatars2.githubusercontent.com/u/78827?v=4' class='avatar' /></a> <br />
<p>Joel Nothman</p>
</td>
</tr>
<tr>
<td>
</div>
<div>
<a href='https://github.com/qinhanmin2014'><img src='https://avatars2.githubusercontent.com/u/12003569?v=4' class='avatar' /></a> <br />
<p>Hanmin Qin</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/bthirion'><img src='https://avatars1.githubusercontent.com/u/234454?v=4' class='avatar' /></a> <br />
<p>Bertrand Thirion</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/TomDLT'><img src='https://avatars2.githubusercontent.com/u/11065596?v=4' class='avatar' /></a> <br />
<p>Tom Dupré la Tour</p>
</td>
<td>
<a href='https://github.com/NelleV'><img src='https://avatars0.githubusercontent.com/u/184798?v=4' class='avatar' /></a> <br />
<p>Nelle Varoquaux</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/GaelVaroquaux'><img src='https://avatars3.githubusercontent.com/u/208217?v=4' class='avatar' /></a> <br />
<p>Gael Varoquaux</p>
</td>
<td>
</div>
<div>
<a href='https://github.com/NelleV'><img src='https://avatars0.githubusercontent.com/u/184798?v=4' class='avatar' /></a> <br />
<p>Nelle Varoquaux</p>
</div>
<div>
<a href='https://github.com/rth'><img src='https://avatars0.githubusercontent.com/u/630936?v=4' class='avatar' /></a> <br />
<p>Roman Yurchak</p>
</td>
</tr>
</table>
</div>
</div>
2 changes: 1 addition & 1 deletion doc/authors_emeritus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- Arnaud Joly
- Thouis (Ray) Jones
- Kyle Kastner
- Manoj Kumar
- manoj kumar
- Robert Layton
- Wei Li
- Paolo Losi
Expand Down
14 changes: 14 additions & 0 deletions doc/themes/scikit-learn-modern/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,20 @@ div.sphx-glr-thumbcontainer {
word-wrap: break-word;
}

/* authors */
.sk-authors-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
}

.sk-authors-container > div {
width: 100px;
margin: 5px;
font-size: 0.9rem;
}


/* testimonial */

div.testimonial h2 {
Expand Down

0 comments on commit 6127b4e

Please sign in to comment.