Move format and same book condition functions

This commit is contained in:
Marty Oehme 2023-02-22 11:08:48 +01:00
parent bc520497f8
commit d301a61e92
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -13,28 +13,6 @@ import re
import subprocess 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): def main(fpath, db):
notes = {} notes = {}
with open(fpath) as f: with open(fpath) as f:
@ -82,6 +60,27 @@ def main(fpath, db):
write_to_files(notes) 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): def write_to_files(notes):
# write to notes # write to notes