Skip to content

Commit

Permalink
beta 2.09
Browse files Browse the repository at this point in the history
  • Loading branch information
lborgman committed Jul 23, 2011
2 parents 543bcb2 + ea12e8f commit 241d68e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 33 deletions.
72 changes: 42 additions & 30 deletions util/bibhlp.el
Expand Up @@ -89,7 +89,7 @@

(defun bibhlp-browse-url-for-pdf (url)
"Show URL in a web browser, capable of downloading PDF."
(if nil
(if t
(browse-url url)
(if (eq system-type 'windows-nt)
(w32-shell-execute nil
Expand Down Expand Up @@ -256,11 +256,18 @@ APA reference."
(let (last first inits auth)
(if (not (string-match "\\(.+\\), +\\(.+\\)" val))
;; Medline format perhaps:
(if (not (string-match "\\(.+\\) +\\(.+\\)" val))
(if (not (string-match "\\(.+?\\) +\\(.+\\)" val))
(setq auth (list val))
(setq last (match-string-no-properties 1 val))
(setq inits (match-string-no-properties 2 val))
(setq auth (list last nil inits)))
(let ((val2 (match-string-no-properties 2 val)))
(if (string= (upcase val2) val2)
(progn
(setq inits val2)
(setq auth (list last nil inits)))
;; Fix-me: initials, split
(setq first val2)
(setq auth (list last first))
)))
(setq last (match-string-no-properties 1 val))
(setq first (match-string-no-properties 2 val))
(setq auth (list last first)))
Expand All @@ -269,6 +276,7 @@ APA reference."
(when (and journal
(null type))
(setq type 'journal-article))
(setq url (replace-regexp-in-string " " "+" url t t))
(or ;;return-value
(list
:type type
Expand Down Expand Up @@ -1777,32 +1785,36 @@ In case :et-al is set then return -1."
If INCLUDE-DOI-ETC then include those \(they are supposed to be at the end).
Return a list \(BEG MID END)."
(let* ((here (point))
(end (progn
(forward-paragraph)
(skip-chars-backward " \t\n\f")
(point)))
(beg (progn
(backward-paragraph)
(skip-chars-forward " \t\n\f")
(point)))
mid)
(goto-char end)
(skip-chars-forward " \t\n\f")
(while (looking-at "^[A-Z0-9]\\{2\\} +-")
(forward-paragraph)
(skip-chars-backward " \t\n\f")
(setq end (point)))
(goto-char beg)
(when (re-search-forward (rx whitespace
(or "[["
"http://" "https://" "ftp:" "mailto:"
"doi:" "pmid:" "pmcid:"))
end t)
(goto-char (match-beginning 0))
(setq mid (point)))
(goto-char here)
(list beg mid end)))
(if (and buffer-file-name
(member (file-name-extension buffer-file-name)
'("env" "ris")))
(list (point-min) nil (point-max))
(let* ((here (point))
(end (progn
(forward-paragraph)
(skip-chars-backward " \t\n\f")
(point)))
(beg (progn
(backward-paragraph)
(skip-chars-forward " \t\n\f")
(point)))
mid)
(goto-char end)
(skip-chars-forward " \t\n\f")
(while (looking-at "^[A-Z0-9]\\{2\\} +-")
(forward-paragraph)
(skip-chars-backward " \t\n\f")
(setq end (point)))
(goto-char beg)
(when (re-search-forward (rx whitespace
(or "[["
"http://" "https://" "ftp:" "mailto:"
"doi:" "pmid:" "pmcid:"))
end t)
(goto-char (match-beginning 0))
(setq mid (point)))
(goto-char here)
(list beg mid end))))



Expand Down
8 changes: 5 additions & 3 deletions util/ourcomments-util.el
Expand Up @@ -2645,9 +2645,11 @@ variant of such blocks then leave the link as it is."
)
;; Check if the URL is to a local file and absolute. And we
;; have a buffer.
(when (and (buffer-file-name)
(> (length url) 5)
(string= (substring url 0 6) "file:/"))
(if (not (and (buffer-file-name)
(> (length url) 5)
(string= (substring url 0 6) "file:/")))
(save-match-data
(setq url (browse-url-url-encode-chars url "[\]\[]")))
(let ((abs-file-url
(if (not (memq system-type '(windows-nt ms-dos)))
(substring url 8)
Expand Down

0 comments on commit 241d68e

Please sign in to comment.