diff options
-rwxr-xr-x | strike.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/strike.py b/strike.py index e3e5e52..fb7378d 100755 --- a/strike.py +++ b/strike.py @@ -7,20 +7,21 @@ def get_output(content, template="{content}"): def main(): src = 'blog' - dest = 'output' - template = 'template' + dest = 'output' try: mkdir(dest) except FileExistsError: pass + template = 'template' with open(template) as t: template_contents = t.read() - for file in listdir(src): - with open(src + '/' + file, 'r') as fin: - file_contents = fin.read() - output = get_output(file_contents, template=template_contents) - with open(dest + '/' + file, 'w') as fout: - fout.write(output) + + for file in listdir(src): + with open(src + '/' + file, 'r') as fin: + file_contents = fin.read() + output = get_output(file_contents, template=template_contents) + with open(dest + '/' + file, 'w') as fout: + fout.write(output) if __name__ == '__main__': exit(main()) |