put things into functions
This commit is contained in:
parent
795005c878
commit
4395dea1fd
12
build.py
12
build.py
@ -33,9 +33,9 @@ md_extensions = ['fenced_code', 'codehilite', 'nl2br', 'toc', 'smarty', 'tables'
|
||||
def print_file(in_file, out_file):
|
||||
print('%-62s -> %s' % (in_file, out_file))
|
||||
|
||||
os.makedirs(output_directory, exist_ok=True)
|
||||
|
||||
for (dirpath, _, filenames) in os.walk(static_directory):
|
||||
def copy_static_files():
|
||||
for (dirpath, _, filenames) in os.walk(static_directory):
|
||||
for filename in filenames:
|
||||
source = os.path.join(dirpath, filename)
|
||||
out_path = dirpath.replace(static_directory, '', 1)
|
||||
@ -47,8 +47,9 @@ for (dirpath, _, filenames) in os.walk(static_directory):
|
||||
shutil.copy2(source, dest)
|
||||
|
||||
|
||||
template = open('template.html').read()
|
||||
for (dirpath, _, filenames) in os.walk(input_directory):
|
||||
def process_markdown_files():
|
||||
template = open('template.html').read()
|
||||
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'):
|
||||
@ -106,6 +107,9 @@ def make_rss(): # TODO: implement.
|
||||
|
||||
|
||||
def main():
|
||||
os.makedirs(output_directory, exist_ok=True)
|
||||
copy_static_files()
|
||||
process_markdown_files()
|
||||
make_sitemap()
|
||||
make_rss()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user