From d301a61e92837162d6c572327c901a8c21d2c16e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 22 Feb 2023 11:08:48 +0100 Subject: [PATCH] Move format and same book condition functions --- papis-marvin | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/papis-marvin b/papis-marvin index f873a3c..2c6149c 100755 --- a/papis-marvin +++ b/papis-marvin @@ -13,28 +13,6 @@ import re import subprocess -def format_entry(row) -> str: - text = f"> {row['HighlightText']}" - if row["EntryText"]: - if text: - text += "\n" - else: - text = "> " - text += f"{row['EntryText']}" - return text - - -_old_title = "" -def is_same_book(title): - global _old_title - - same = _old_title == title - _old_title = title - if same: - return True - return False - - def main(fpath, db): notes = {} with open(fpath) as f: @@ -82,6 +60,27 @@ def main(fpath, db): write_to_files(notes) +def format_entry(row) -> str: + text = f"> {row['HighlightText']}" + if row["EntryText"]: + if text: + text += "\n" + else: + text = "> " + text += f"{row['EntryText']}" + return text + + +_old_title = "" +def is_same_book(title): + global _old_title + + same = _old_title == title + _old_title = title + if same: + return True + return False + def write_to_files(notes): # write to notes