update readme.py
This commit is contained in:
@ -1,10 +1,25 @@
|
||||
import os
|
||||
def tagger():
|
||||
tag_data = open('tag_database').read()
|
||||
tag_dict = {}
|
||||
tag_list = tag_data.split('\n')
|
||||
for tag in tag_list:
|
||||
category = tag.split(':')[1]
|
||||
snippet = tag.split(':')[0]
|
||||
if category in tag_dict:
|
||||
tag_dict[category].append(snippet)
|
||||
else:
|
||||
tag_dict[category] = [snippet]
|
||||
return tag_dict
|
||||
files = os.listdir('snippets')
|
||||
start = open("static-parts/readme-start.md").read() + '\n\n'
|
||||
end = open("static-parts/readme-end.md").read()
|
||||
toAppend = ''
|
||||
for file in files:
|
||||
someFile = open("snippets/" + file)
|
||||
fileData = someFile.read()
|
||||
toAppend += fileData + '\n'
|
||||
tag_dict = tagger()
|
||||
for category in tag_dict:
|
||||
toAppend = toAppend + '# ' + category +'\n\n'
|
||||
for snippet in tag_dict[category]:
|
||||
someFile = open("snippets/" + snippet + '.md')
|
||||
fileData = someFile.read()
|
||||
toAppend += fileData + '\n'
|
||||
open("README.md",'w').write(start+toAppend+'\n'+end)
|
||||
|
||||
Reference in New Issue
Block a user