From ef04a36884d3dac175577f46d0807e3b4ff4c0f0 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 1 Jan 2018 19:24:21 -0800 Subject: put generated files in gitignore, adjust background color for backticked regions (code tags) and clip out source/ from generated paths --- generator/generate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'generator') 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() -- cgit v1.1