diff options
author | iximeow <me@iximeow.net> | 2018-01-01 19:24:21 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2018-01-01 19:24:21 -0800 |
commit | ef04a36884d3dac175577f46d0807e3b4ff4c0f0 (patch) | |
tree | 20d93a022ea98f3240259a03c4b3cb79d8860c9b /generator | |
parent | 19d0ceb8e6f73ff98757772ad6eaefaaece3b56f (diff) |
put generated files in gitignore, adjust background color for backticked regions (code tags) and clip out source/ from generated paths
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() |