-
Notifications
You must be signed in to change notification settings - Fork 7
/
add_consortium.py
46 lines (36 loc) · 1.83 KB
/
add_consortium.py
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
37
38
39
40
41
42
43
44
45
46
# Define the replacement text
section = 1
contributors = {1: [], 2: [], 3: []}
all_contributors = []
with open('rgi_consortium.txt', 'r') as file:
for line in file:
line = line.strip()
if '#' in line:
if 'Implementation' in line:
section += 1
if 'Outlines, GLIMS' in line:
section += 1
continue
li = contributors[section]
if line in all_contributors or 'Bruce H.' in line:
continue
li.append(line)
all_contributors.append(line)
consortium_list = contributors[1] + sorted(contributors[2]) + sorted(contributors[3])
consortium_list = '; '.join(consortium_list).rstrip()
n_contributors = len(contributors[1]) + len(contributors[2]) + len(contributors[3])
consortium_text = f"""*The {n_contributors} members of the RGI 7.0 Consortium:*
{consortium_list}
*The first {len(contributors[1])} authors were members of the RGI Working Group steering committee and responsible for the design, development, implementation and assembly of RGI 7.0. The following {len(contributors[2])} authors (listed in alphabetical order) assisted with the implementation. The remaining {len(contributors[3])} authors (listed in alphabetical order) contributed with outline review and/or outlines used in RGI 7.0.*
*For a more detailed listing of contributions, visit [](appendix/contributors).*
"""
# Open the file in read mode
with open('docs/01_introduction.md', 'r') as file:
# Read the content of the file
file_content = file.read()
# Find and replace the tag in the file content
updated_content = file_content.replace("<ADD RGI CONSORTIUM>", consortium_text)
# Open the file in write mode to overwrite its contents
with open('docs/01_introduction.md', 'w') as file:
# Write the updated content to the file
file.write(updated_content)