From 58420a7ed87898c10eadec27c5e184b2553a04c0 Mon Sep 17 00:00:00 2001 From: Stavros Korokithakis Date: Mon, 13 Dec 2021 03:02:33 +0200 Subject: [PATCH] Incorporate feedback --- joplinexport | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/joplinexport b/joplinexport index a7c5118..795f9db 100755 --- a/joplinexport +++ b/joplinexport @@ -304,7 +304,8 @@ class JoplinExporter: with (self.content_dir / "SUMMARY.md").open("w") as outfile: outfile.write("# Summary\n\n") # Special-case the introduction. - outfile.write(introduction.get_summary_line(0) + "\n") + if introduction: + outfile.write(introduction.get_summary_line(0) + "\n") outfile.write("\n".join(items)) def export(self): @@ -318,12 +319,12 @@ class JoplinExporter: for folder in folder_list: contents = [] dir = self.content_dir / folder.get_url() - dir.mkdir(parents=True) + dir.mkdir(parents=True, exist_ok=True) for note in sorted(self.notes[folder.id], key=lambda n: n.title): print(f"Exporting {folder.title} - {note.title}...") contents.append((note.title, f"{note.get_url()}.html")) with (self.content_dir / (note.get_url() + ".md")).open( - mode="w" + mode="w", encoding="utf-8" ) as outfile: outfile.write( f"""# {note.title}