forked from varia/varia.website
manetta
5 years ago
2 changed files with 37 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||
import os |
|||
|
|||
folder = 'announcement/' |
|||
filenames = os.listdir(folder) |
|||
for filename in filenames: |
|||
print('---'+filename+'---') |
|||
out = [] |
|||
f = open(folder+filename, 'r') |
|||
lines = f.readlines() |
|||
for line in lines: |
|||
tmpline = line.lower() |
|||
if 'category:' in tmpline: |
|||
category = tmpline.replace('category:', '').strip() |
|||
continue |
|||
elif 'tags' in tmpline: |
|||
line = line + ', {}'.format(category) |
|||
out.append(line) |
|||
|
|||
outstring = '\n'.join(out) |
|||
print(outstring) |
|||
outfile = open(folder+filename, 'w') |
|||
#outfile.write(outstring) |
|||
outfile.close() |
@ -0,0 +1,14 @@ |
|||
import os |
|||
|
|||
folder = 'content/' |
|||
filenames = os.listdir(folder) |
|||
for filename in filenames: |
|||
if '.md' in filename: |
|||
print('---'+filename+'---') |
|||
text = open(folder+filename, 'r').read() |
|||
text = text.replace('/images/', 'images/') |
|||
print(text) |
|||
|
|||
outfile = open(folder+filename, 'w') |
|||
outfile.write(text) |
|||
outfile.close() |
Loading…
Reference in new issue