-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplace_eggdriver.py
48 lines (34 loc) · 1.3 KB
/
replace_eggdriver.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
47
48
replace_eggdriver_standard_library_here = ""
f = open("features.txt")
lines = f.readlines()
f.close()
features = []
last_feature_name = ""
last_feature_description = ""
first_feature = True
for i in range(len(lines)):
line = lines[i]
EOF = (i == len(lines) - 1)
if first_feature:
first_feature = False
last_feature_name = line.strip("#").strip()
elif len(line) > 0:
if line[0:2] == "# " or EOF:
features.append((last_feature_name, last_feature_description.strip()))
if line[0:2] == "# ":
last_feature_name = line.strip("#").strip()
last_feature_description = ""
elif line[0:2] == "##":
last_feature_description += "#" + line
elif line[0] != "~":
last_feature_description += line
else:
last_feature_description += line
features.sort(key = lambda x: x[0].lower()) # sort features by name
for i in range(len(features)):
replace_eggdriver_standard_library_here += f"## {i + 1}. " + features[i][0] + "\n\n"
replace_eggdriver_standard_library_here += features[i][1]
if i != len(features) - 1:
replace_eggdriver_standard_library_here += "\n\n"
print("We will add the following lines in 'index.md':\n")
print(replace_eggdriver_standard_library_here)