diff options
author | fpi | 2022-06-02 14:45:10 +0200 |
---|---|---|
committer | fpi | 2022-06-02 14:45:10 +0200 |
commit | a045b2fc3c430389da6f0c363edb702a5aa29097 (patch) | |
tree | e6785b7ef22fc5ddc25f9827f3b3d77bf5f21109 | |
parent | Initial version (diff) |
-rw-r--r-- | pdf-tools-annotation-list.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pdf-tools-annotation-list.el b/pdf-tools-annotation-list.el index b3ec4d8..08c8199 100644 --- a/pdf-tools-annotation-list.el +++ b/pdf-tools-annotation-list.el @@ -90,6 +90,25 @@ need region." ))) extracted-annots)) +(defun pdf-tools-annotation-list-entry-to-org (annotation) + "Converts ANNOTATION to org formatted text" + (format + "%s:\n%s%s\n" + (plist-get annotation :link) + (let ((text (plist-get annotation :text))) + (if text + (format "#+BEGIN_QUOTE\n%s\n#+END_QUOTE\n" text) + "")) + (plist-get annotation :contents))) + +(defun pdf-tools-annotation-list-insert-in-org (pdf) + (let* ((pdfbuffer (find-file-noselect pdf)) + (annotations (with-current-buffer pdfbuffer + (pdf-tools-annotation-list-create-list)))) + (mapc (lambda (annot) + (insert (pdf-tools-annotation-list-entry-to-org annot))) + annotations) + nil)) (provide 'pdf-tools-annotation-list) ;;; pdf-tools-annotation-list.el ends here |