diff --git a/README.md b/README.md index 9ca4328..a7b5c96 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,21 @@ active = extract [[extract]] on_import = False +quote_prefix = "> " +note_prefix = "Note: " minimum_similarity = 0.75 ``` If `on_import` is `True` extraction is automatically run whenever a new document is added to the library, if false extraction has to be handled manually. +`quote_prefix` and `note_prefix` define what is put in front of the quoted part of an annotation and the annotator's own notes respectively, so that ultimately a note (by default) looks like this: + +```markdown +[4] > came “urban rights” caused collective outrage. Thus, through- out 2007 and 2008, protestors in towns and villages across the Nile Delta poured into the streets to rally over cuts in water flow. Deployment of massive riot police could not stop +Note: Often illegally connected to network, ‘revolution of the thirsty’ +``` + `minimum_similarity` sets the required similarity of an annotation's note and written words to be viewed as one. Any annotation that has both and is *under* the minimum similarity will be added in the following form: diff --git a/extract/extract.py b/extract/extract.py index 044b84d..221f0b5 100644 --- a/extract/extract.py +++ b/extract/extract.py @@ -41,6 +41,8 @@ class ExtractPlugin(PapersPlugin): # and so on self.on_import = conf["plugins"].get("extract", {}).get("on_import", False) self.minimum_similarity = float(conf["plugins"].get("extract", {}).get("minimum_similarity", 0.75)) + self.highlight_prefix = conf["plugins"].get("extract", {}).get("quote_prefix", "> ") + self.note_prefix = conf["plugins"].get("extract", {}).get("note_prefix", "Note: ") def update_parser(self, subparsers, conf): """Allow the usage of the pubs extract subcommand""" @@ -131,7 +133,7 @@ class ExtractPlugin(PapersPlugin): with fitz.Document(filename) as doc: for page in doc: for annot in page.annots(): - content = self._retrieve_annotation_content(page, annot) + content = self._retrieve_annotation_content(page, annot, self.highlight_prefix, self.note_prefix) if content: annotations.append(f"[{(page.number or 0) + 1}] {content}") return annotations