diary entries are template files; entries are in diary/entries and links are fixed
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
import glob
|
||||
|
||||
def file_to_string(f):
|
||||
text = ""
|
||||
with open(f, 'r') as n:
|
||||
text = n.read()
|
||||
n.close()
|
||||
return text
|
||||
|
||||
def fill_text(f):
|
||||
return file_to_string('res/head.txt') + file_to_string(f) + file_to_string('res/tail.txt')
|
||||
|
||||
def create_files(files, directory):
|
||||
for f in files:
|
||||
print(f)
|
||||
n = open(directory + '/' + os.path.basename(f), "w")
|
||||
n.write(fill_text(f))
|
||||
n.close()
|
||||
|
||||
def collect_raw(d):
|
||||
return glob.glob(d)
|
||||
|
||||
def clear_articles():
|
||||
files = glob.glob('../*.tpl')
|
||||
for f in files:
|
||||
os.remove(f)
|
||||
|
||||
def main():
|
||||
clear_articles()
|
||||
create_files(collect_raw('entries/*.tpl'), '..')
|
||||
|
||||
## Start Program ##
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user