forked from tildetown/tilde-wiki
take out css hack; just inline css
parent
f5e7c75a8a
commit
a27859fda1
|
@ -2,7 +2,6 @@ import os
|
||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os.path import join as path_join
|
from os.path import join as path_join
|
||||||
from shutil import copyfile
|
|
||||||
|
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
|
|
||||||
|
@ -42,20 +41,16 @@ def compile_wiki(source_path: str, dest_path: str) -> None:
|
||||||
|
|
||||||
for source_filename in files:
|
for source_filename in files:
|
||||||
source_file_path = path_join(root, source_filename)
|
source_file_path = path_join(root, source_filename)
|
||||||
# TODO this is really ugly; consider just copying anything not in approved extensions
|
output = compile_source_file(
|
||||||
if source_file_path.endswith('.css'):
|
source_file_path,
|
||||||
copyfile(source_file_path, path_join(preview_root, source_filename))
|
header_content,
|
||||||
else:
|
footer_content)
|
||||||
output = compile_source_file(
|
dest_filename = source_filename.split('.')[0] + '.html'
|
||||||
source_file_path,
|
toc_content += '<li><a href="{}">{}</a></li>\n'.format(
|
||||||
header_content,
|
path_join(current_suffix, dest_filename),
|
||||||
footer_content)
|
path_join(current_suffix,dest_filename.split('.')[0]))
|
||||||
dest_filename = source_filename.split('.')[0] + '.html'
|
with open(path_join(preview_root, dest_filename), 'w') as f:
|
||||||
toc_content += '<li><a href="{}">{}</a></li>\n'.format(
|
f.write(output)
|
||||||
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>'
|
toc_content += '\n</ul>'
|
||||||
with open(path_join(dest_path, 'toc.html'), 'w') as f:
|
with open(path_join(dest_path, 'toc.html'), 'w') as f:
|
||||||
|
|
|
@ -149,6 +149,9 @@ def publish(config, local_repo_path):
|
||||||
click.echo('Compiling wiki to {}'.format(config.publish_path))
|
click.echo('Compiling wiki to {}'.format(config.publish_path))
|
||||||
click.confirm(WIPE_PROMPT.format(config.publish_path), abort=True)
|
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)
|
rmtree(config.publish_path, onerror=onerror)
|
||||||
if len(rm_error_paths) == 0:
|
if len(rm_error_paths) == 0:
|
||||||
os.makedirs(config.publish_path)
|
os.makedirs(config.publish_path)
|
||||||
|
|
Loading…
Reference in New Issue