copy css files during compilation

master
nathaniel smith 2017-09-23 14:43:59 -07:00
parent 8037e76dbe
commit 62898ce86b
1 changed files with 18 additions and 10 deletions

View File

@ -2,6 +2,7 @@ import os
import re
from datetime import datetime
from os.path import join as path_join
from shutil import copyfile
from markdown import markdown
@ -23,6 +24,8 @@ def compile_wiki(source_path: str, dest_path: str) -> None:
header_content = compile_markdown(path_join(source_path, 'src/header.md'))
footer_content = last_compiled + compile_markdown(path_join(source_path, 'src/footer.md'))
# TODO fix any links in header/footer to work with preview path
articles_root = path_join(source_path, 'src/articles')
toc_content = '{}\n<ul>'.format(update_title(header_content, 'table of contents'))
@ -31,6 +34,7 @@ def compile_wiki(source_path: str, dest_path: str) -> None:
current_suffix = root.replace(articles_root, '')
if current_suffix and current_suffix[0] == '/':
current_suffix = current_suffix[1:]
# TODO this is a bad var name since it might be publish path
preview_root = path_join(dest_path, current_suffix)
for directory in dirs:
@ -38,6 +42,10 @@ 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,