From a27859fda1125118939a34891c75fb48758c6f89 Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Sat, 23 Sep 2017 15:05:05 -0700 Subject: [PATCH] take out css hack; just inline css --- tildewiki/compilation.py | 25 ++++++++++--------------- tildewiki/main.py | 3 +++ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tildewiki/compilation.py b/tildewiki/compilation.py index 7b143ed..40a8547 100644 --- a/tildewiki/compilation.py +++ b/tildewiki/compilation.py @@ -2,7 +2,6 @@ import os import re from datetime import datetime from os.path import join as path_join -from shutil import copyfile from markdown import markdown @@ -42,20 +41,16 @@ def compile_wiki(source_path: str, dest_path: str) -> None: for source_filename in files: source_file_path = path_join(root, source_filename) - # TODO this is really ugly; consider just copying anything not in approved extensions - if source_file_path.endswith('.css'): - copyfile(source_file_path, path_join(preview_root, source_filename)) - else: - output = compile_source_file( - source_file_path, - header_content, - footer_content) - dest_filename = source_filename.split('.')[0] + '.html' - toc_content += '
  • {}
  • \n'.format( - path_join(current_suffix, dest_filename), - path_join(current_suffix,dest_filename.split('.')[0])) - with open(path_join(preview_root, dest_filename), 'w') as f: - f.write(output) + output = compile_source_file( + source_file_path, + header_content, + footer_content) + dest_filename = source_filename.split('.')[0] + '.html' + toc_content += '
  • {}
  • \n'.format( + path_join(current_suffix, dest_filename), + path_join(current_suffix,dest_filename.split('.')[0])) + with open(path_join(preview_root, dest_filename), 'w') as f: + f.write(output) toc_content += '\n' with open(path_join(dest_path, 'toc.html'), 'w') as f: diff --git a/tildewiki/main.py b/tildewiki/main.py index f603cfe..1e7422a 100644 --- a/tildewiki/main.py +++ b/tildewiki/main.py @@ -149,6 +149,9 @@ def publish(config, local_repo_path): click.echo('Compiling wiki to {}'.format(config.publish_path)) click.confirm(WIPE_PROMPT.format(config.publish_path), abort=True) + # TODO there is a showstopping bug here: remaking the publish path + # strips all permissions. actually delete the stuff in there, not the + # dir itself. rmtree(config.publish_path, onerror=onerror) if len(rm_error_paths) == 0: os.makedirs(config.publish_path)