Fix script bug

This commit is contained in:
Stavros Korokithakis 2020-11-20 23:49:31 +02:00
parent c855801ef6
commit 3fc9971efd
No known key found for this signature in database
GPG Key ID: 26EA345ECD4C2A63
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
+++ +++
title = "Drone stuff" title = "Drone stuff"
weight = 4 weight = 2
sort_by = "weight" sort_by = "weight"
insert_anchor_links = "right" insert_anchor_links = "right"
+++ +++

View File

@ -1,6 +1,6 @@
+++ +++
title = "Welcome" title = "Welcome"
weight = 0 weight = 1
sort_by = "weight" sort_by = "weight"
insert_anchor_links = "right" insert_anchor_links = "right"
+++ +++

View File

@ -111,12 +111,12 @@ class JoplinExporter:
self.clean_content_dir() self.clean_content_dir()
self.copy_resources() self.copy_resources()
for counter, folder in enumerate(folder_list, start=1): for folder_counter, folder in enumerate(folder_list, start=1):
folder_id, folder_title = folder folder_id, folder_title = folder
dir = self.content_dir / slugify(folder_title) dir = self.content_dir / slugify(folder_title)
dir.mkdir(parents=True) dir.mkdir(parents=True)
contents = [] contents = []
for counter, note in enumerate( for note_counter, note in enumerate(
sorted(self.notes[folder_id], key=lambda n: n.title) sorted(self.notes[folder_id], key=lambda n: n.title)
): ):
print(f"Exporting {folder_title} - {note.title}...") print(f"Exporting {folder_title} - {note.title}...")
@ -127,7 +127,7 @@ class JoplinExporter:
outfile.write( outfile.write(
f"""+++ f"""+++
title = "{note.title}" title = "{note.title}"
weight = {counter} weight = {note_counter}
sort_by = "weight" sort_by = "weight"
insert_anchor_links = "right" insert_anchor_links = "right"
+++ +++
@ -141,7 +141,7 @@ insert_anchor_links = "right"
outfile.write( outfile.write(
f"""+++ f"""+++
title = "{folder_title}" title = "{folder_title}"
weight = {counter} weight = {folder_counter}
sort_by = "weight" sort_by = "weight"
insert_anchor_links = "right" insert_anchor_links = "right"
+++ +++