Refactor plugin to remove carrying config around
This commit is contained in:
parent
7b27f3291d
commit
f0caf35925
1 changed files with 3 additions and 3 deletions
|
@ -29,7 +29,7 @@ class ExtractPlugin(PapersPlugin):
|
||||||
|
|
||||||
def __init__(self, conf, ui):
|
def __init__(self, conf, ui):
|
||||||
self.ui = ui
|
self.ui = ui
|
||||||
self.conf = conf
|
self.note_extension = conf["main"]["note_extension"]
|
||||||
self.repository = repo.Repository(conf)
|
self.repository = repo.Repository(conf)
|
||||||
self.pubsdir = os.path.expanduser(conf["main"]["pubsdir"])
|
self.pubsdir = os.path.expanduser(conf["main"]["pubsdir"])
|
||||||
self.broker = self.repository.databroker
|
self.broker = self.repository.databroker
|
||||||
|
@ -74,7 +74,7 @@ class ExtractPlugin(PapersPlugin):
|
||||||
return
|
return
|
||||||
all_annotations = self.extract(citekeys)
|
all_annotations = self.extract(citekeys)
|
||||||
if args.write:
|
if args.write:
|
||||||
self._to_notes(all_annotations, conf["main"]["note_extension"], args.edit)
|
self._to_notes(all_annotations, self.note_extension, args.edit)
|
||||||
else:
|
else:
|
||||||
self._to_stdout(all_annotations)
|
self._to_stdout(all_annotations)
|
||||||
self.repository.close()
|
self.repository.close()
|
||||||
|
@ -210,5 +210,5 @@ def modify_event(event):
|
||||||
if plg.onimport:
|
if plg.onimport:
|
||||||
all_annotations = plg.extract([event.citekey])
|
all_annotations = plg.extract([event.citekey])
|
||||||
if all_annotations[0][1]:
|
if all_annotations[0][1]:
|
||||||
plg._to_notes(all_annotations, plg.conf["main"]["note_extension"])
|
plg._to_notes(all_annotations, plg.note_extension)
|
||||||
plg.ui.info(f"Imported {event.citekey} annotations.")
|
plg.ui.info(f"Imported {event.citekey} annotations.")
|
||||||
|
|
Loading…
Reference in a new issue