]> git.donarmstrong.com Git - org-ref.git/blob - wos.el
ff72a67ed34cd52303b7d0282f05b8781ca0b6f4
[org-ref.git] / wos.el
1 ;;; wos.el --- WEb of Science functions              -*- lexical-binding: t; -*-
2
3 ;; Copyright (C) 2015  John Kitchin
4
5 ;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
6 ;; Keywords:
7
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
12
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ;; GNU General Public License for more details.
17
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 ;;; Commentary:
22
23 ;; Adds a new org-mode link for a search in Web of Science.
24
25
26 ;;; Code:
27 (org-add-link-type
28  "wos-search"
29  (lambda (path)
30    (browse-url
31     (format  "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary"
32              (s-join "+"
33               (split-string path)))))
34  ;; formatting function. Assume html
35  (lambda (link desc format)
36    (format "<a href=\"%s\">%s</a>"
37            (format  "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary"
38              (s-join "+"
39               (split-string path)))
40            (format "wos:%s" link)
41            )))
42
43
44 (defun wos-search ()
45   "Open the word at point or selection in Web of Science."
46   ;; the url was derived from this page: http://wokinfo.com/webtools/searchbox/
47   (interactive)
48   (browse-url
49    (format "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary"
50     (if (region-active-p)
51         (mapconcat 'identity (split-string
52                               (buffer-substring (region-beginning)
53                                                 (region-end))) "+")
54       (thing-at-point 'word)))))
55
56
57 (defun wos ()
58   "Open Web of Science search page in a browser."
59   (interactive)
60   (browse-url "http://apps.webofknowledge.com"))
61
62 (provide 'wos)
63 ;;; wos.el ends here