Add independent note saving
This commit is contained in:
parent
82b99e8420
commit
b65c2a3be6
1 changed files with 6 additions and 0 deletions
|
@ -148,10 +148,16 @@ class ExtractPlugin(PapersPlugin):
|
||||||
content = annotation.info["content"].replace("\n", " ")
|
content = annotation.info["content"].replace("\n", " ")
|
||||||
written = page.get_textbox(annotation.rect).replace("\n", " ")
|
written = page.get_textbox(annotation.rect).replace("\n", " ")
|
||||||
|
|
||||||
|
# highlight with selection in note
|
||||||
if Levenshtein.ratio(content,written) > self.minimum_similarity:
|
if Levenshtein.ratio(content,written) > self.minimum_similarity:
|
||||||
return content
|
return content
|
||||||
|
# an independent note, not a highlight
|
||||||
|
elif content and not written:
|
||||||
|
return content
|
||||||
|
# both a highlight and a note
|
||||||
elif content:
|
elif content:
|
||||||
return f"{written}{connector}{content}"
|
return f"{written}{connector}{content}"
|
||||||
|
# highlight with selection not in note
|
||||||
return written
|
return written
|
||||||
|
|
||||||
def _to_stdout(self, annotated_papers):
|
def _to_stdout(self, annotated_papers):
|
||||||
|
|
Loading…
Reference in a new issue