-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_update_site_member_list.py
More file actions
executable file
·36 lines (33 loc) · 1.09 KB
/
_update_site_member_list.py
File metadata and controls
executable file
·36 lines (33 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# To update team list:
# 1) Run jeckyll locally: bundle exec jekyll serve --livereload --trace
# 2) Run this script
# 3) Deploy / run locally
import os
import shutil
PATH = "_site/team-members"
PATH2 = "_site/collaborator-members"
FINAL_PATH = "members"
FINAL_PATH2 = "collaborators"
shutil.rmtree(FINAL_PATH)
shutil.rmtree(FINAL_PATH2)
os.makedirs(FINAL_PATH)
os.makedirs(FINAL_PATH2)
for f in os.listdir(PATH):
with open(f"{PATH}/{f}", "r") as file:
content = file.read()
# remove <pre> html tags
content = content.replace("<pre>", "").replace("</pre>", "")
# remove initial empty lines
content = content[2:]
with open(f"{FINAL_PATH}/{f.replace('html','md')}", "w") as file:
file.write(content)
for f in os.listdir(PATH2):
with open(f"{PATH2}/{f}", "r") as file:
content = file.read()
# remove <pre> html tags
content = content.replace("<pre>", "").replace("</pre>", "")
# remove initial empty lines
content = content[2:]
with open(f"{FINAL_PATH2}/{f.replace('html','md')}", "w") as file:
file.write(content)