Additional logging on loaded and reloaded posts.

This commit is contained in:
Sergio Martínez Portela 2023-09-19 23:42:03 +02:00
parent 21a857ea41
commit fc1a94cfcf

View File

@ -172,6 +172,7 @@ def load_all(top_dir_relative):
docs = {}
count = 0
for root, dirs, files in os.walk(top):
for name in files:
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)
out_path = get_out_path(front_matter)
docs[path] = (doc, front_matter, out_path)
print('\rLoading posts... {}'.format(count), end='', flush=True)
count += 1
else:
raise NotImplementedError('Unknown filetype: {}'.format(name))
print(" [DONE]")
return docs
@ -506,6 +510,7 @@ def main(source_top, dest_top):
else:
try:
print("Reloading: {}".format(filepath))
(doc, front_matter, out_path) = load_doc(filepath)
except:
logging.error(traceback.format_exc())
@ -515,6 +520,7 @@ def main(source_top, dest_top):
t0 = time.time()
docs[filepath] = (doc, front_matter, 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)
# print("==", doc_full_path)
with open(doc_full_path + '/index.html', 'wt') as f: