take out css hack; just inline css

master
nathaniel smith 2017-09-23 15:05:05 -07:00
parent f5e7c75a8a
commit a27859fda1
2 changed files with 13 additions and 15 deletions

View File

@ -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 += '<li><a href="{}">{}</a></li>\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 += '<li><a href="{}">{}</a></li>\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</ul>'
with open(path_join(dest_path, 'toc.html'), 'w') as f:

View File

@ -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)