Additional logging on loaded and reloaded posts.
This commit is contained in:
parent
21a857ea41
commit
fc1a94cfcf
@ -172,6 +172,7 @@ def load_all(top_dir_relative):
|
|||||||
|
|
||||||
docs = {}
|
docs = {}
|
||||||
|
|
||||||
|
count = 0
|
||||||
for root, dirs, files in os.walk(top):
|
for root, dirs, files in os.walk(top):
|
||||||
for name in files:
|
for name in files:
|
||||||
if all([not name.endswith(ext) for ext in EXTENSIONS]):
|
if all([not name.endswith(ext) for ext in EXTENSIONS]):
|
||||||
@ -183,9 +184,12 @@ def load_all(top_dir_relative):
|
|||||||
doc, front_matter = read_markdown(path)
|
doc, front_matter = read_markdown(path)
|
||||||
out_path = get_out_path(front_matter)
|
out_path = get_out_path(front_matter)
|
||||||
docs[path] = (doc, front_matter, out_path)
|
docs[path] = (doc, front_matter, out_path)
|
||||||
|
print('\rLoading posts... {}'.format(count), end='', flush=True)
|
||||||
|
count += 1
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Unknown filetype: {}'.format(name))
|
raise NotImplementedError('Unknown filetype: {}'.format(name))
|
||||||
|
|
||||||
|
print(" [DONE]")
|
||||||
return docs
|
return docs
|
||||||
|
|
||||||
|
|
||||||
@ -506,6 +510,7 @@ def main(source_top, dest_top):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
print("Reloading: {}".format(filepath))
|
||||||
(doc, front_matter, out_path) = load_doc(filepath)
|
(doc, front_matter, out_path) = load_doc(filepath)
|
||||||
except:
|
except:
|
||||||
logging.error(traceback.format_exc())
|
logging.error(traceback.format_exc())
|
||||||
@ -515,6 +520,7 @@ def main(source_top, dest_top):
|
|||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
docs[filepath] = (doc, front_matter, out_path)
|
docs[filepath] = (doc, front_matter, out_path)
|
||||||
doc_full_path = os.path.join(dest_top, out_path)
|
doc_full_path = os.path.join(dest_top, out_path)
|
||||||
|
print("Updated: {}.html".format(doc_full_path))
|
||||||
os.makedirs(os.path.dirname(doc_full_path), exist_ok=True)
|
os.makedirs(os.path.dirname(doc_full_path), exist_ok=True)
|
||||||
# print("==", doc_full_path)
|
# print("==", doc_full_path)
|
||||||
with open(doc_full_path + '/index.html', 'wt') as f:
|
with open(doc_full_path + '/index.html', 'wt') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user