diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | content_template.pandoc | 3 | ||||
-rw-r--r-- | generator/generate.py | 7 |
3 files changed, 8 insertions, 3 deletions
@@ -1 +1,2 @@ /pruned +/generated diff --git a/content_template.pandoc b/content_template.pandoc index dc733b4..589eb25 100644 --- a/content_template.pandoc +++ b/content_template.pandoc @@ -7,6 +7,9 @@ <style> body { background-color: #d7d7dd; } + code { + background-color: #ccc4c4; + } .content { margin: auto; width: 80% 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() |