"""
def scan_pages(base_path):
files = [file for file in os.listdir(base_path) if os.path.isfile(os.path.join(base_path, file)) and file[:1] != "."]
directories = [file for file in os.listdir(base_path) if os.path.isdir(os.path.join(base_path, file)) and file[:1] != "."]
page_sources = []
for file in files:
if file.endswith(".md"):
page_sources.append(base_path+"/"+file)
for directory in directories:
page_sources.append(scan_pages(base_path+"/"+directory))
return page_sources
source_files = scan_pages(SOURCES_PATH)
for mdf in source_files:
with open(mdf, "rb") as f:
md = f.read().decode(INPUT_ENCODING)
html = markdown.markdown(menu_md + md, extensions=["markdown.extensions.fenced_code"])
html = document_start + html + document_end
of = BUILD_PATH+mdf.replace(SOURCES_PATH, "").replace(".md", ".html")
with open(of, "wb") as wf:
wf.write(html.encode(OUTPUT_ENCODING))