forked from mmistakes/minimal-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_text.py
More file actions
35 lines (30 loc) · 784 Bytes
/
fix_text.py
File metadata and controls
35 lines (30 loc) · 784 Bytes
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
import os
location = os.getcwd()+"/_posts"
os.chdir(location)
print(location)
file = "2020-12-21-cmft-2-1.md"
texts = []
with open(file,'r+') as f:
for line in open(file):
print(line)
line = line.replace("rarr", "rightarrow")
line = line.replace("bold","mathbf")
line = line.replace("dag","dagger")
line = line.replace("infin","infty")
line = line.replace("isin","in")
line = line.replace("|","\vert")
print("->",line)
texts.append(line)
for i in range(len(texts)):
print(texts[i])
newfile = open('modified.md','w')
for i in range(len(texts)):
newfile.write(str(texts[i]))
print(texts[i])
newfile.close()
'''
new = open(,'w')
for i in range(len(texts)):
f.write(texts[i])
new.close()
'''