adding a toolbox

This commit is contained in:
manetta 2020-03-11 17:02:20 +01:00
parent 3246d01f69
commit 6f7dc06d13
2 changed files with 37 additions and 0 deletions

View File

@ -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()

View File

@ -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()