X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=blobdiff_plain;f=org-ref.el;h=cf279584d0a22b7fb1a085a03ffe6061cd2c2333;hp=6c7c4377eed69fe353c0599e6379e011c3bf3841;hb=0cc2275fc2fae335628696fd625848880d09e1d0;hpb=8221fe8e5378375494f24a25d46f95016d10c144 diff --git a/org-ref.el b/org-ref.el index 6c7c437..cf27958 100644 --- a/org-ref.el +++ b/org-ref.el @@ -510,10 +510,14 @@ Format according to the type in `org-ref-bibliography-entry-format'." (insert-file-contents file) (bibtex-search-entry key nil 0) (setq bibtex-entry (bibtex-parse-entry)) + ;; downcase field names so they work in the format-citation code + (dolist (cons-cell bibtex-entry) + (setf (car cons-cell) (downcase (car cons-cell)))) (setq entry-type (downcase (cdr (assoc "=type=" bibtex-entry)))) (setq format (cdr (assoc entry-type org-ref-bibliography-entry-format))) (if format (setq entry (org-ref-reftex-format-citation bibtex-entry format)) + ;; if no format, we use the bibtex entry itself as a fallback (save-restriction (bibtex-narrow-to-entry) (setq entry (buffer-string))))) @@ -539,8 +543,19 @@ Format according to the type in `org-ref-bibliography-entry-format'." (defun org-ref-get-bibtex-entry-html (key) "Return an html string for the bibliography entry corresponding to KEY." - (format "
  • [%s] %s
  • " - key key (org-ref-get-bibtex-entry-citation key))) + (let ((output)) + (setq output (org-ref-get-bibtex-entry-citation key)) + ;; unescape the & + (setq output (replace-regexp-in-string "\\\\&" "&" output)) + ;; hack to replace {} around text + (setq output (replace-regexp-in-string " {\\(.*\\)} " " \\1 " output)) + ;; get rid of empty parens + (setq output (replace-regexp-in-string "()" "" output)) + ;; get rid of empty link and doi + (setq output (replace-regexp-in-string " link\\." "" output)) + (setq output (replace-regexp-in-string " doi\\." "" output)) + (format "
  • [%s] %s
  • " + key key output))) (defun org-ref-get-html-bibliography () "Create an html bibliography when there are keys."