|
@ -14,7 +14,7 @@ md_extensions = ['fenced_code', 'codehilite', 'nl2br', 'toc', 'smarty', 'tables' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def print_file(in_file, out_file): |
|
|
def print_file(in_file, out_file): |
|
|
print('%-53s -> %s' % (in_file, out_file)) |
|
|
|
|
|
|
|
|
print('%-62s -> %s' % (in_file, out_file)) |
|
|
|
|
|
|
|
|
template = open('template.html').read() |
|
|
template = open('template.html').read() |
|
|
|
|
|
|
|
@ -34,8 +34,13 @@ for (dirpath, _, filenames) in os.walk(static_directory): |
|
|
|
|
|
|
|
|
out_filenames = [] |
|
|
out_filenames = [] |
|
|
|
|
|
|
|
|
# TODO: also walk the markdown directory |
|
|
|
|
|
for markdown_filename in glob.glob(os.path.join(input_directory, '*.md')): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (dirpath, _, filenames) in os.walk(input_directory): |
|
|
|
|
|
for filename in filenames: |
|
|
|
|
|
markdown_filename = os.path.join(dirpath, filename) |
|
|
|
|
|
if not markdown_filename.endswith('.md'): |
|
|
|
|
|
continue |
|
|
|
|
|
|
|
|
markdown_file = open(markdown_filename) |
|
|
markdown_file = open(markdown_filename) |
|
|
text = markdown_file.read() |
|
|
text = markdown_file.read() |
|
|
markdown_file.close() |
|
|
markdown_file.close() |
|
@ -64,7 +69,10 @@ for markdown_filename in glob.glob(os.path.join(input_directory, '*.md')): |
|
|
output = output.replace('__PAGE_URL_GOES_HERE__', page_url) |
|
|
output = output.replace('__PAGE_URL_GOES_HERE__', page_url) |
|
|
|
|
|
|
|
|
out_filenames.append(out_filename) |
|
|
out_filenames.append(out_filename) |
|
|
out_fullpath = os.path.join(output_directory, out_filename) |
|
|
|
|
|
|
|
|
out_dirpath = os.path.join(output_directory, dirpath) |
|
|
|
|
|
out_dirpath = out_dirpath.replace('/content', '', 1) |
|
|
|
|
|
os.makedirs(out_dirpath, exist_ok=True) |
|
|
|
|
|
out_fullpath = os.path.join(out_dirpath, out_filename) |
|
|
print_file(markdown_filename, out_fullpath) |
|
|
print_file(markdown_filename, out_fullpath) |
|
|
out_file = open(out_fullpath, 'w') |
|
|
out_file = open(out_fullpath, 'w') |
|
|
out_file.write(output) |
|
|
out_file.write(output) |
|
|