update packages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
;;; ox-bibtex.el --- Export bibtex fragments
|
||||
;;; ox-bibtex.el --- Export bibtex fragments -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2014, 2021 Taru Karttunen
|
||||
|
||||
@@ -93,6 +93,9 @@
|
||||
;; Initialization
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'org)
|
||||
(require 'ox)
|
||||
(require 'org-element)
|
||||
|
||||
;;; Internal Functions
|
||||
|
||||
@@ -160,6 +163,8 @@ to `org-bibtex-citation-p' predicate."
|
||||
(defun org-bibtex-goto-citation (&optional citation)
|
||||
"Visit a citation given its ID."
|
||||
(interactive)
|
||||
(declare-function obe-citations "org-bibtex-extras" ())
|
||||
(require 'org-bibtex-extras)
|
||||
(let ((citation (or citation (completing-read "Citation: " (obe-citations)))))
|
||||
(find-file (or org-bibtex-file
|
||||
(error "`org-bibtex-file' has not been configured")))
|
||||
@@ -167,12 +172,15 @@ to `org-bibtex-citation-p' predicate."
|
||||
(and position (progn (goto-char position) t)))))
|
||||
|
||||
(let ((jump-fn (car (cl-remove-if-not #'fboundp '(ebib org-bibtex-goto-citation)))))
|
||||
(org-add-link-type "cite" jump-fn))
|
||||
(org-link-set-parameters "cite" :follow jump-fn))
|
||||
|
||||
|
||||
|
||||
;;; Filters
|
||||
|
||||
(defvar org-bibtex-html-entries-alist nil) ; Dynamically scoped.
|
||||
(defvar org-bibtex-html-keywords-alist nil) ; Dynamically scoped.
|
||||
|
||||
(defun org-bibtex-process-bib-files (tree backend info)
|
||||
"Send each bibliography in parse tree to \"bibtex2html\" process.
|
||||
Return new parse tree."
|
||||
@@ -344,86 +352,65 @@ the HTML and ASCII backends."
|
||||
|
||||
;;; LaTeX Part
|
||||
|
||||
(defadvice org-latex-keyword (around bibtex-keyword)
|
||||
(define-advice org-latex-keyword (:around (fun keyword contents info) bibtex-keyword)
|
||||
"Translate \"BIBLIOGRAPHY\" keywords into LaTeX syntax.
|
||||
Fallback to `latex' back-end for other keywords."
|
||||
(let ((keyword (ad-get-arg 0)))
|
||||
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
|
||||
ad-do-it
|
||||
(let ((file (org-bibtex-get-file keyword))
|
||||
(style (org-not-nil (org-bibtex-get-style keyword))))
|
||||
(setq ad-return-value
|
||||
(when file
|
||||
(concat (and style (format "\\bibliographystyle{%s}\n" style))
|
||||
(format "\\bibliography{%s}" file))))))))
|
||||
|
||||
(ad-activate 'org-latex-keyword)
|
||||
|
||||
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
|
||||
(funcall fun keyword contents info)
|
||||
(let ((file (org-bibtex-get-file keyword))
|
||||
(style (org-not-nil (org-bibtex-get-style keyword))))
|
||||
(when file
|
||||
(concat (and style (format "\\bibliographystyle{%s}\n" style))
|
||||
(format "\\bibliography{%s}" file))))))
|
||||
|
||||
|
||||
;;; HTML Part
|
||||
|
||||
(defvar org-bibtex-html-entries-alist nil) ; Dynamically scoped.
|
||||
(defvar org-bibtex-html-keywords-alist nil) ; Dynamically scoped.
|
||||
|
||||
|
||||
;;;; Advices
|
||||
|
||||
(defadvice org-html-keyword (around bibtex-keyword)
|
||||
(define-advice org-html-keyword (:around (fun keyword contents info) bibtex-keyword)
|
||||
"Translate \"BIBLIOGRAPHY\" keywords into HTML syntax.
|
||||
Fallback to `html' back-end for other keywords."
|
||||
(let ((keyword (ad-get-arg 0)))
|
||||
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
|
||||
ad-do-it
|
||||
(setq ad-return-value
|
||||
(cdr (assq keyword org-bibtex-html-keywords-alist))))))
|
||||
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
|
||||
(funcall fun keyword contents info)
|
||||
(cdr (assq keyword org-bibtex-html-keywords-alist))))
|
||||
|
||||
(defadvice org-html-latex-fragment (around bibtex-citation)
|
||||
(define-advice org-html-latex-fragment (:around (fun fragment contents info) bibtex-citation)
|
||||
"Translate \"\\cite\" LaTeX fragments into HTML syntax.
|
||||
Fallback to `html' back-end for other keywords."
|
||||
(let ((fragment (ad-get-arg 0)))
|
||||
(if (not (org-bibtex-citation-p fragment)) ad-do-it
|
||||
(setq ad-return-value
|
||||
(format "[%s]"
|
||||
(mapconcat
|
||||
(lambda (key)
|
||||
(format "<a href=\"#%s\">%s</a>"
|
||||
key
|
||||
(or (cdr (assoc key org-bibtex-html-entries-alist))
|
||||
key)))
|
||||
(org-split-string
|
||||
(org-bibtex-get-citation-key fragment) ",") ","))))))
|
||||
|
||||
(ad-activate 'org-html-keyword)
|
||||
(ad-activate 'org-html-latex-fragment)
|
||||
(if (not (org-bibtex-citation-p fragment))
|
||||
(funcall fun fragment contents info)
|
||||
(format "[%s]"
|
||||
(mapconcat
|
||||
(lambda (key)
|
||||
(format "<a href=\"#%s\">%s</a>"
|
||||
key
|
||||
(or (cdr (assoc key org-bibtex-html-entries-alist))
|
||||
key)))
|
||||
(org-split-string
|
||||
(org-bibtex-get-citation-key fragment) ",") ","))))
|
||||
|
||||
|
||||
;;; Ascii Part
|
||||
(defadvice org-ascii-keyword (around bibtex-keyword)
|
||||
(define-advice org-ascii-keyword (:around (fun keyword contents info) bibtex-keyword)
|
||||
"Translate \"BIBLIOGRAPHY\" keywords into ascii syntax.
|
||||
Fallback to `ascii' back-end for other keywords."
|
||||
(let ((keyword (ad-get-arg 0)))
|
||||
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
|
||||
ad-do-it
|
||||
(setq ad-return-value
|
||||
(cdr (assq keyword org-bibtex-html-keywords-alist))))))
|
||||
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
|
||||
(funcall fun keyword contents info)
|
||||
(cdr (assq keyword org-bibtex-html-keywords-alist))))
|
||||
|
||||
(defadvice org-ascii-latex-fragment (around bibtex-citation)
|
||||
(define-advice org-ascii-latex-fragment (:around (fun fragment contents info) bibtex-citation)
|
||||
"Translate \"\\cite\" LaTeX fragments into ascii syntax.
|
||||
Fallback to `ascii' back-end for other keywords."
|
||||
(let ((fragment (ad-get-arg 0)))
|
||||
(if (not (org-bibtex-citation-p fragment)) ad-do-it
|
||||
(setq ad-return-value
|
||||
(format "[%s]"
|
||||
(mapconcat
|
||||
(lambda (key)
|
||||
(or (cdr (assoc key org-bibtex-html-entries-alist))
|
||||
key))
|
||||
(org-split-string
|
||||
(org-bibtex-get-citation-key fragment) ",") ","))))))
|
||||
|
||||
(ad-activate 'org-ascii-keyword)
|
||||
(ad-activate 'org-ascii-latex-fragment)
|
||||
(if (not (org-bibtex-citation-p fragment))
|
||||
(funcall fun fragment contents info)
|
||||
(format "[%s]"
|
||||
(mapconcat
|
||||
(lambda (key)
|
||||
(or (cdr (assoc key org-bibtex-html-entries-alist))
|
||||
key))
|
||||
(org-split-string
|
||||
(org-bibtex-get-citation-key fragment) ",") ","))))
|
||||
|
||||
(provide 'ox-bibtex)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user