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}