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