Add independent note saving

This commit is contained in:
Marty Oehme 2022-12-22 22:56:07 +01:00
parent 82b99e8420
commit b65c2a3be6
Signed by: Marty
GPG Key ID: 73BA40D5AFAF49C9
1 changed files with 6 additions and 0 deletions

View File

@ -148,10 +148,16 @@ class ExtractPlugin(PapersPlugin):
content = annotation.info["content"].replace("\n", " ")
written = page.get_textbox(annotation.rect).replace("\n", " ")
# highlight with selection in note
if Levenshtein.ratio(content,written) > self.minimum_similarity:
return content
# an independent note, not a highlight
elif content and not written:
return content
# both a highlight and a note
elif content:
return f"{written}{connector}{content}"
# highlight with selection not in note
return written
def _to_stdout(self, annotated_papers):