Skip to content

Commit fc491c5

Browse files
committed
Commit insert_ids script
1 parent 6223715 commit fc491c5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

irrelevant/insert_ids.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import uuid
2+
3+
new_file = []
4+
original_file = []
5+
6+
fname = "../README.md"
7+
8+
9+
def generate_random_id_comment():
10+
random_id = uuid.uuid4()
11+
return f"<!-- Example ID: {random_id} --!>"
12+
13+
14+
with open(fname, "r") as f:
15+
original_file = f.readlines()
16+
17+
18+
for line in original_file:
19+
new_file.append(line)
20+
if line.strip().startswith("### "):
21+
new_file.append(generate_random_id_comment())
22+
23+
with open(fname, "w") as f:
24+
f.write("".join(new_file))

0 commit comments

Comments
 (0)