Add writing annotations to notes
This commit is contained in:
parent
6569d0b05d
commit
a5910f50f3
1 changed files with 13 additions and 6 deletions
|
@ -109,12 +109,19 @@ class ExtractPlugin(PapersPlugin):
|
||||||
print(f'> "{annot}"')
|
print(f'> "{annot}"')
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
def to_notes(self, conf, annotated_papers, edit=False):
|
||||||
def to_notes(self, filename, annotations):
|
for contents in annotated_papers:
|
||||||
with open(f"{os.path.splitext(filename)[0]}.md", "w") as out:
|
paper = contents[0]
|
||||||
out.write(f"# Annotations:\n\n")
|
annotations = contents[1]
|
||||||
out.writelines(annotations)
|
if annotations:
|
||||||
out.write(f"\n---")
|
notepath = self.broker.real_notepath(
|
||||||
|
paper.citekey, conf["main"]["note_extension"]
|
||||||
|
)
|
||||||
|
output = "# Annotations\n\n"
|
||||||
|
for annotation in annotations:
|
||||||
|
output+=f"> {annotation}\n\n"
|
||||||
|
write_file(notepath, output, 'w')
|
||||||
|
# TODO implement NoteEvent(citekey).send()
|
||||||
|
|
||||||
|
|
||||||
@PaperChangeEvent.listen()
|
@PaperChangeEvent.listen()
|
||||||
|
|
Loading…
Reference in a new issue