update packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; org-ref-pubmed.el --- Links and functions for Pubmed and NIH databases -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2015 John Kitchin
|
||||
;; Copyright (C) 2015-2021 John Kitchin
|
||||
|
||||
;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
|
||||
;; Keywords: convenience
|
||||
@@ -53,15 +53,15 @@
|
||||
(require 'org)
|
||||
(require 'org-ref-utils)
|
||||
|
||||
(org-ref-link-set-parameters "pmid"
|
||||
:follow (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pubmed/%s" link-string)))
|
||||
:export (lambda (keyword desc format)
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s\">pmid:%s</a>" keyword (or desc keyword))) ; no output for html
|
||||
((eq format 'latex)
|
||||
;; write out the latex command
|
||||
(format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}{%s}" keyword (or desc keyword))))))
|
||||
(org-link-set-parameters "pmid"
|
||||
:follow (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pubmed/%s" link-string)))
|
||||
:export (lambda (keyword desc format)
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s\">pmid:%s</a>" keyword (or desc keyword))) ; no output for html
|
||||
((eq format 'latex)
|
||||
;; write out the latex command
|
||||
(format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}{%s}" keyword (or desc keyword))))))
|
||||
|
||||
;;** Get MEDLINE metadata
|
||||
|
||||
@@ -72,16 +72,15 @@
|
||||
"Get MEDLINE text for PMID as a string."
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
(format "http://www.ncbi.nlm.nih.gov/pubmed/%s/?report=medline&format=text" pmid))
|
||||
(format "https://pubmed.ncbi.nlm.nih.gov/%s/?format=pubmed" pmid))
|
||||
(goto-char (point-min))
|
||||
(let ((p1 (search-forward "<pre>"))
|
||||
(let ((p1 (search-forward "<pre class=\"article-details\" id=\"article-details\">"))
|
||||
(p2 (search-forward "</pre>")))
|
||||
(buffer-substring (+ 1 p1) (- p2 6)))))
|
||||
(replace-regexp-in-string "
|
||||
" "" (buffer-substring (+ 1 p1) (- p2 6))))))
|
||||
|
||||
;;** Parse the PMID MEDLINE data
|
||||
|
||||
|
||||
;; We can parse this into a data structure.
|
||||
(defun pubmed-parse-medline (pmid)
|
||||
"Parse the medline text for PMID and return a list of cons cells."
|
||||
@@ -153,31 +152,6 @@ You must clean the entry after insertion."
|
||||
You must clean the entry after insertion."
|
||||
(interactive "sPMID: ")
|
||||
(insert (pubmed-pmid-to-bibtex pmid)))
|
||||
;;** PMID to xml
|
||||
|
||||
;; We can also get xml of the MEDLINE data. The web page here also wraps the xml
|
||||
;; in a <pre> block and escapes the <> with < and >, which we have to
|
||||
;; undo. I have not used this code for anything, so I am not sure how good the
|
||||
;; xml code is.
|
||||
|
||||
;;;###autoload
|
||||
(defun pubmed-get-medline-xml (pmid)
|
||||
"Get MEDLINE xml for PMID as a string."
|
||||
(interactive)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
(format "http://www.ncbi.nlm.nih.gov/pubmed/%s/?report=xml&format=text" pmid))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "<" nil t)
|
||||
(replace-match "<"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward ">" nil t)
|
||||
(replace-match ">"))
|
||||
(goto-char (point-min))
|
||||
|
||||
(let ((p1 (search-forward "<pre>"))
|
||||
(p2 (search-forward "</pre>")))
|
||||
(buffer-substring (+ 1 p1) (- p2 6)))))
|
||||
|
||||
|
||||
;;* Pubmed Central (PMC) link
|
||||
@@ -190,14 +164,14 @@ You must clean the entry after insertion."
|
||||
|
||||
;; Here we define a new link. Clicking on it simply opens a webpage to the
|
||||
;; article.
|
||||
(org-ref-link-set-parameters "pmcid"
|
||||
:follow (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/%s" link-string)))
|
||||
:export (lambda (keyword desc format)
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/%s\">pmcid:%s</a>" keyword (or desc keyword)))
|
||||
((eq format 'latex)
|
||||
(format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/%s}{%s}" keyword (or desc keyword))))))
|
||||
|
||||
(org-link-set-parameters "pmcid"
|
||||
:follow (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/%s" link-string)))
|
||||
:export (lambda (keyword desc format)
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/%s\">pmcid:%s</a>" keyword (or desc keyword)))
|
||||
((eq format 'latex)
|
||||
(format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/%s}{%s}" keyword (or desc keyword))))))
|
||||
|
||||
;;* NIHMSID
|
||||
@@ -208,15 +182,15 @@ You must clean the entry after insertion."
|
||||
;; article. Once the Web version of the NIHMS submission is approved for
|
||||
;; inclusion in PMC and the corresponding citation is in PubMed, the article
|
||||
;; will also be assigned a PMCID.
|
||||
(org-ref-link-set-parameters "nihmsid"
|
||||
:follow (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s" link-string)))
|
||||
:export (lambda (keyword desc format)
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s\">nihmsid:%s</a>" keyword (or desc keyword)))
|
||||
((eq format 'latex)
|
||||
;; write out the latex command
|
||||
(format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}{%s}" keyword (or desc keyword))))))
|
||||
|
||||
(org-link-set-parameters "nihmsid"
|
||||
:follow (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s" link-string)))
|
||||
:export (lambda (keyword desc format)
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s\">nihmsid:%s</a>" keyword (or desc keyword)))
|
||||
((eq format 'latex)
|
||||
;; write out the latex command
|
||||
(format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}{%s}" keyword (or desc keyword))))))
|
||||
|
||||
|
||||
@@ -243,17 +217,17 @@ You must clean the entry after insertion."
|
||||
(browse-url
|
||||
(format "http://www.ncbi.nlm.nih.gov/pubmed/?term=%s" (url-hexify-string query))))
|
||||
|
||||
(org-ref-link-set-parameters "pubmed-search"
|
||||
:follow (lambda (query)
|
||||
"Open QUERY in a `pubmed-simple-search'."
|
||||
(pubmed-simple-search query))
|
||||
:export (lambda (query desc format)
|
||||
(let ((url (format "http://www.ncbi.nlm.nih.gov/pubmed/?term=%s" (url-hexify-string query))))
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"%s\">%s</a>" url (or desc (concat "pubmed-search:" query))))
|
||||
((eq format 'latex)
|
||||
(format "\\href{%s}{%s}" url (or desc (concat "pubmed-search:" query))))))))
|
||||
|
||||
(org-link-set-parameters "pubmed-search"
|
||||
:follow (lambda (query)
|
||||
"Open QUERY in a `pubmed-simple-search'."
|
||||
(pubmed-simple-search query))
|
||||
:export (lambda (query desc format)
|
||||
(let ((url (format "http://www.ncbi.nlm.nih.gov/pubmed/?term=%s" (url-hexify-string query))))
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"%s\">%s</a>" url (or desc (concat "pubmed-search:" query))))
|
||||
((eq format 'latex)
|
||||
(format "\\href{%s}{%s}" url (or desc (concat "pubmed-search:" query))))))))
|
||||
|
||||
;; ** Pubmed clinical
|
||||
@@ -272,20 +246,20 @@ You must clean the entry after insertion."
|
||||
(browse-url
|
||||
(format "https://www.ncbi.nlm.nih.gov/pubmed/clinical?term=%s" (url-hexify-string query))))
|
||||
|
||||
(org-ref-link-set-parameters "pubmed-clinical"
|
||||
:follow (lambda (query)
|
||||
"Open QUERY in a `pubmed-clinical-search'."
|
||||
(pubmed-clinical-search query))
|
||||
:export (lambda (query desc format)
|
||||
(let ((url (format "http://www.ncbi.nlm.nih.gov/pubmed/clinical?term=%s"
|
||||
(url-hexify-string query))))
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"%s\">%s</a>" url
|
||||
(or desc (concat "pubmed-clinical-search:" query))))
|
||||
((eq format 'latex)
|
||||
(format "\\href{%s}{%s}" url
|
||||
(or desc (concat "pubmed-clinical-search:" query))))))))
|
||||
|
||||
(org-link-set-parameters "pubmed-clinical"
|
||||
:follow (lambda (query)
|
||||
"Open QUERY in a `pubmed-clinical-search'."
|
||||
(pubmed-clinical-search query))
|
||||
:export (lambda (query desc format)
|
||||
(let ((url (format "http://www.ncbi.nlm.nih.gov/pubmed/clinical?term=%s"
|
||||
(url-hexify-string query))))
|
||||
(cond
|
||||
((eq format 'html)
|
||||
(format "<a href=\"%s\">%s</a>" url
|
||||
(or desc (concat "pubmed-clinical-search:" query))))
|
||||
((eq format 'latex)
|
||||
(format "\\href{%s}{%s}" url
|
||||
(or desc (concat "pubmed-clinical-search:" query))))))))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user