Unverified Commit b4c53206 authored by Noé Lopez's avatar Noé Lopez
Browse files

Support subdirectories in document writer

parent 6fa89a1e
......@@ -10,10 +10,12 @@ class DocumentWriter():
def write_document(self, document: Document) -> None:
main_file_name = os.path.join(self.target, document.get_name())
os.makedirs(os.path.dirname(main_file_name), exist_ok=True)
with open(main_file_name, "w") as f:
f.write(document.get_main_content())
meta_file_name = os.path.join(self.target, ".meta", document.get_name() + ".json")
os.makedirs(os.path.dirname(meta_file_name), exist_ok=True)
with open(meta_file_name, "w") as f:
f.write(json.dumps({
"title": document.get_title(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment