diff --git a/papis-marvin b/papis-marvin index 2c6149c..93c470e 100755 --- a/papis-marvin +++ b/papis-marvin @@ -20,10 +20,9 @@ def main(fpath, db): csv = csv.DictReader(f) - title_strip_pattern = re.compile(r"([^\s\w]|_)+") note_file = "" for row in csv: - title_stripped = title_strip_pattern.sub("", row["Title"]) + title_stripped = strip_book_title(row["Title"]) # switch to next book if not is_same_book(row["Title"]): @@ -96,6 +95,10 @@ def write_to_files(notes): num_added += 1 print(f"Added {num_added} entries to it.") +title_strip_pattern = re.compile(r"([^\s\w]|_)+") +def strip_book_title(title) -> str: + return title_strip_pattern.sub("", title) + if __name__ == "__main__": # use argument passed to command as file or default file here