diff options
Diffstat (limited to 'generator')
-rw-r--r-- | generator/generate.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generator/generate.py b/generator/generate.py index 3c23b40..494ad0c 100644 --- a/generator/generate.py +++ b/generator/generate.py @@ -53,7 +53,8 @@ if __name__ == "__main__": headers_file = './headers.html' - compiled_dest = './generated/{}{}'.format(page_cwd, page_path) + compiled_dest = './generated/{}{}'.format(page_cwd, page_path).replace('source/', '') + dest_wd = compiled_dest[:compiled_dest.rfind('/') + 1] print("Source: {}\nPage path: {}\nDest file: {}".format(md_source, page_path, compiled_dest)) try: md_file = open(md_source) @@ -69,8 +70,8 @@ if __name__ == "__main__": pandoc_proc = subprocess.Popen(['pandoc', '--template=content_template.pandoc'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) html = pandoc_proc.communicate(markdown_blob.encode('utf-8'))[0] try: - if not os.path.isdir('./generated/' + page_cwd): - os.makedirs('./generated/' + page_cwd) + if not os.path.isdir(dest_wd): + os.makedirs(dest_wd) out_file = open(compiled_dest, 'w') out_file.write(html.decode('utf-8')) out_file.close() |