From a854ef00d65ba6493faf5edb183a3e0e6ec8508a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 11 Sep 2025 10:53:50 +0200 Subject: [PATCH] fix: Write annotations if duplicate detection is off Previously we would never add annotations if the detection is off, because we only added an empty list instead of the actual annotations and would thus break out of writing early. JJ: Enter a description for the selected changes. --- papis_extract/exporters/notes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/papis_extract/exporters/notes.py b/papis_extract/exporters/notes.py index e27bc78..29a2ed2 100644 --- a/papis_extract/exporters/notes.py +++ b/papis_extract/exporters/notes.py @@ -64,14 +64,14 @@ class NotesExporter: even if they already exist, defaults to False. :type duplicates: bool, optional """ - logger.debug("Adding annotations to note.") + logger.debug("Adding annotations to note...") notes_path = papis.notes.notes_path_ensured(document) existing: list[str] = [] with open(notes_path, "r") as file_read: existing = file_read.readlines() - new_annotations: list[str] = [] + new_annotations: list[str] = formatted_annotations if not duplicates: new_annotations = self._drop_existing_annotations( formatted_annotations, existing @@ -85,8 +85,7 @@ class NotesExporter: f.write("\n") # FIXME this either joins them too close or moves them too far apart # We need a better algorithm which knows what a full 'annotation' is. - f.write("\n".join(new_annotations)) - f.write("\n") + f.write("\n\n".join(new_annotations)) logger.info( f"Wrote {len(new_annotations)} " f"{'line' if len(new_annotations) == 1 else 'lines'} "