update packages
This commit is contained in:
@@ -44,15 +44,15 @@
|
||||
(defvar org-ref-cite-types)
|
||||
(defvar org-cliplink-escape-alist)
|
||||
|
||||
(declare-function 'org-ref-get-bibtex-key-and-file "org-ref-core.el")
|
||||
(declare-function 'org-ref-find-bibliography "org-ref-core.el")
|
||||
(declare-function org-ref-get-bibtex-key-and-file "org-ref-core")
|
||||
(declare-function org-ref-find-bibliography "org-ref-core")
|
||||
(declare-function org-ref-clean-bibtex-entry "org-ref-bibtex")
|
||||
|
||||
(declare-function dnd-handle-one-url "dnd")
|
||||
(declare-function dnd--unescape-uri "dnd")
|
||||
|
||||
(require 'doi-utils)
|
||||
(require 'f)
|
||||
(require 's)
|
||||
(require 'org-ref-utils)
|
||||
(eval-when-compile
|
||||
(require 'cl-lib))
|
||||
|
||||
@@ -82,7 +82,7 @@ the DOI."
|
||||
|
||||
|
||||
(defvar org-ref-url-title-re
|
||||
"<title.?+?>\\([[:ascii:][:nonascii:]]*?\\|.+\\)</title>"
|
||||
"<title[^>]*>\\(.*?\\)</title>"
|
||||
"Regular expression for matching title.")
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ the DOI."
|
||||
|
||||
|
||||
(defvar org-ref-url-date-re
|
||||
"<[a-z].+ class=\\(.?+date.[^>]*\\)>\\([[:ascii:][:nonascii:]]*?\\)</[a-z].+>"
|
||||
"<[a-z][^>]+ class=\\([^>]*date[^>]*\\)>\\(.*?\\)</[a-z][^>]+>"
|
||||
"Regular expression for matching date.")
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ there is more than one, we offer a completion buffer of selections. If
|
||||
no DOI is found, we create a misc entry, with a prompt for a key."
|
||||
;; make sure we are on a bib-file
|
||||
(if (and (buffer-file-name)
|
||||
(f-ext? (buffer-file-name) "bib"))
|
||||
(org-ref--file-ext-p (buffer-file-name) "bib"))
|
||||
(let ((dois (org-ref-url-scrape-dois url)))
|
||||
(cond
|
||||
;; One doi found. Assume it is what we want.
|
||||
@@ -172,7 +172,7 @@ no DOI is found, we create a misc entry, with a prompt for a key."
|
||||
"Protocol for when a doi is dragged onto a bibtex file.
|
||||
A doi will be either doi:10.xxx or 10.xxx."
|
||||
(if (and (buffer-file-name)
|
||||
(f-ext? (buffer-file-name) "bib"))
|
||||
(org-ref--file-ext-p (buffer-file-name) "bib"))
|
||||
(let ((doi (dnd--unescape-uri doi)))
|
||||
;; Get the actual doi now
|
||||
(string-match "\\(?:DOI\\|doi\\)?:? *\\(10.*\\)" doi)
|
||||
@@ -260,7 +260,7 @@ Fields include author, title, url, urldate, and year."
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward org-ref-url-title-re nil t)
|
||||
(push (cons :title
|
||||
(s-trim (decode-coding-string (match-string 1) 'utf-8)))
|
||||
(string-trim (decode-coding-string (match-string 1) 'utf-8)))
|
||||
fields)))
|
||||
|
||||
;; Finally add nil value to missing fields
|
||||
@@ -272,11 +272,11 @@ Fields include author, title, url, urldate, and year."
|
||||
"Convert URL to a bibtex or biblatex entry in BIBFILE.
|
||||
If URL is the first in the kill ring, use it. Otherwise, prompt for
|
||||
one in the minibuffer."
|
||||
(interactive (if (-contains? (org-ref-find-bibliography) (buffer-file-name))
|
||||
(interactive (if (member (buffer-file-name) (org-ref-find-bibliography))
|
||||
(list (buffer-file-name))
|
||||
(list (completing-read "Bibtex file: " (org-ref-find-bibliography)))))
|
||||
(let ((url (if url url
|
||||
(if (s-match "^http" (current-kill 0 'do-not-move))
|
||||
(if (org-ref--string-match "^http" (current-kill 0 'do-not-move))
|
||||
(format "%s" (current-kill 0 'do-not-move))
|
||||
(read-from-minibuffer "URL: ")))))
|
||||
(with-current-buffer
|
||||
@@ -284,12 +284,12 @@ one in the minibuffer."
|
||||
;; Maybe check dialect if set as local variable
|
||||
(let* ((dialect bibtex-dialect)
|
||||
(alist (org-ref-url-html-read url))
|
||||
(entry (s-format
|
||||
(entry (org-ref--format-template
|
||||
;; Check dialect and format entry accordingly
|
||||
(if (eq dialect 'biblatex)
|
||||
org-ref-url-biblatex-template
|
||||
org-ref-url-bibtex-template)
|
||||
'aget alist)))
|
||||
alist)))
|
||||
(goto-char (point-max))
|
||||
;; Place new entry one line after the last entry. Sometimes we are in a
|
||||
;; new file though, in which case we don't want to do this.
|
||||
|
||||
Reference in New Issue
Block a user