0

This question is not about org-bibtext, org-ref or something like that which are all based on underlying existing bib-files.

I have a simple text-file (e.g. *.org) open in a buffer. I wan't to insert the full reference/bibliographic information of an article into it.

But I only have the DOI in my clipboard. I wan't to do something like this

M-x insert-full-ref-by-doi 10.2147/CIA.S218367

And then this should appear in the buffer of the text-file

Buhtz, C., Paulicke, D., Schwarz, K., Jahn, P., Stoevesandt, D. & Frese, T. (2019). Receptiveness Of GPs In The South Of Saxony-Anhalt, Germany To Obtaining Training On Technical Assistance Systems For Caregiving. A Cross-Sectional Study. Clinical Interventions in Aging, 2019(14), 1649–1656. doi:10.2147/CIA.S218367

buhtz
  • 729
  • 5
  • 23

1 Answers1

2

I haven't tested this extensively, but, using the citeproc-el library, the function for fetching BibTeX entries based on DOIs at https://www.anghyflawn.net/blog/2014/emacs-give-a-doi-get-a-bibtex-entry/ can be adapted to insert a full formatted reference along the following lines (you need to replace "/path/to/dir_with_csl_locales" and "/path/to/a_csl_style.csl" with valid paths to a dir with CSL locales and to a CSL style):

(require 'citeproc)
(require 'bibtex)

(defun insert-full-ref-by-doi (doi) "Insert a formatted reference of the item with DOI." (interactive "MDOI: ") (let* ((url-mime-accept-string "text/bibliography;style=bibtex") (lg (citeproc-locale-getter-from-dir "/path/to/dir_with_csl_locales")) (csl-style (citeproc-create-style "/path/to/a_csl_style.csl" lg)) bibtex-item) (with-current-buffer (url-retrieve-synchronously (format "http://dx.doi.org/%s" (replace-regexp-in-string "http://dx.doi.org/" "" doi))) (set-buffer-multibyte t) (goto-char (point-max)) (re-search-backward "@") (beginning-of-line) (setq bibtex-item (bibtex-parse-entry)) (kill-buffer (current-buffer))) (let ((csl-item (citeproc-bt-entry-to-csl bibtex-item))) (insert (citeproc-render-item csl-item csl-style 'bib 'plain t)))))

Simka
  • 196
  • 7