Skip to content

Commit 31278c0

Browse files
committed
Update contributors using a script
1 parent 415ed20 commit 31278c0

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,31 @@
33
This is a Jekyll site + theme for [RustPython](https://github.com/RustPython/RustPython).
44

55
There are three things on this site:
6+
67
- Homepage
78
- Blog (archive + single post)
89
- Links to Github/Gitter/Docs/other resources, etc...
910

1011
## How to edit the homepage
12+
1113
To edit the homepage, you can edit:
14+
1215
- `index.markdown` in the root directory.
1316
- `_config.yml` also in the root directory.
14-
- `_data/contributors.json`
17+
- `_data/contributors.json` or run `update_contributors.py`
1518

1619
`config.yml` has setting like section titles, where links go to etc...
1720
`index.markdown` has the longer text content.
1821
`contributors.json` has a list of the top contributors. I figured we can automate how this is generated or update through pull requests.
1922

2023
## How to edit the blog.
21-
Create regular jekyll posts under **_posts** . To feature a post on the homepage under _the learn more_ section, add the category "featured" to the post.
24+
25+
Create regular jekyll posts under **\_posts** . To feature a post on the homepage under _the learn more_ section, add the category "featured" to the post.
2226

2327
## How to edit links, menus and other details.
2428

2529
Use `_config.yml`.
2630

2731
## The theme
32+
2833
The theme doesn't rely on any css framework/ and no javascript. Just super simple modification to the minima theme. There are two stylesheets, `style.css` and `media.css`. I did not use `main.css` because it conflicts with minima's stylesheet. I haven't done a Jekyll theme in a while, so contributions are welcome.

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ github: https://github.com/RustPython/RustPython/
2828
docs: https://github.com/RustPython/docs/
2929
gitter: https://gitter.im/rustpython/Lobby
3030
show_excerpts: true
31-
contributor_excerpt: "edit me in config.yml file at the root folder."
31+
contributor_excerpt: "" # TODO: write something here, goes right under "Contributors" heading
3232

3333
navigation:
3434
- title: Blog

_data/contributors.json

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
[{
2-
"github_username": "coolreader18"
3-
},
4-
{
5-
"github_username": "palaviv"
6-
},
7-
{
8-
"github_username": "windelbouwman"
9-
},
10-
{
11-
"github_username": "cthulahoops"
12-
},
13-
{
14-
"github_username": "youknowone"
15-
}
16-
]
1+
[{"github_username": "windelbouwman"}, {"github_username": "coolreader18"}, {"github_username": "palaviv"}, {"github_username": "cthulahoops"}, {"github_username": "youknowone"}, {"github_username": "OddCoincidence"}, {"github_username": "OddBloke"}, {"github_username": "skinny121"}, {"github_username": "rmliddle"}, {"github_username": "jgirardet"}]

_layouts/home.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
<li><a rel="noopener" rel="noreferrer" href="https://github.com/{{ contributor.github_username }}" target="_blank">{{ contributor.github_username }}</a></li>
100100
{% endfor %}
101101
</ul>
102-
<div><small><a href="#">HOW TO CONTRIBUTE</a></small></div>
102+
<div><small><a href="https://github.com/RustPython/RustPython/graphs/contributors">VIEW MORE</a></small></div>
103+
<div><small><a href="https://github.com/RustPython/RustPython/#contributing">HOW TO CONTRIBUTE</a></small></div>
103104
</div>
104105
</section>

update_contributors.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import json
2+
from urllib.request import urlopen
3+
import os.path
4+
5+
CONTRIBUTORS_URL = "http://api.github.com/repos/RustPython/RustPython/contributors"
6+
CONTRIBUTORS_FILE = os.path.join(
7+
os.path.dirname(__file__), "website/_data/contributors.json"
8+
)
9+
10+
contributors = json.load(urlopen(CONTRIBUTORS_URL))
11+
12+
del contributors[10:]
13+
14+
contributors = [{"github_username": c["login"]} for c in contributors]
15+
16+
with open(CONTRIBUTORS_FILE, "w") as f:
17+
json.dump(contributors, f)

0 commit comments

Comments
 (0)