Browse Source

org-exp-bibtex.el: Use `org-export-bibtex-preprocess'.

* org-exp-bibtex.el (org-export-bibtex-preprocess): Use
`org-export-current-backend'.
Bastien Guerry 14 years ago
parent
commit
e7409b5cd1
1 changed files with 6 additions and 4 deletions
  1. 6 4
      contrib/lisp/org-exp-bibtex.el

+ 6 - 4
contrib/lisp/org-exp-bibtex.el

@@ -58,6 +58,8 @@
 
 (require 'org)
 (require 'org-exp)
+
+(defvar org-export-current-backend) ; dynamically bound in org-exp.el
 (defun org-export-bibtex-preprocess ()
   "Export all BibTeX."
   (interactive)
@@ -72,7 +74,7 @@
 	    (opt   (org-exp-bibtex-options-to-plist (match-string 3))))
 	(replace-match
 	(cond
-	 ((eq backend 'html) ;; We are exporting to HTML
+	 ((eq org-export-current-backend 'html) ;; We are exporting to HTML
 	  (let (extra-args cite-list end-hook tmp-files)
 	    (dolist (elt opt)
 	      (when (equal "option" (car elt))
@@ -106,12 +108,12 @@
 	      (while (re-search-forward "<hr>" nil t)
 		(replace-match "<hr/>" t t))
 	      (concat "\n#+BEGIN_HTML\n<div id=\"bibliography\">\n" (buffer-string) "\n</div>\n#+END_HTML\n"))))
-	 ((eq backend 'latex) ;; Latex export
+	 ((eq org-export-current-backend 'latex) ;; Latex export
 	  (concat "\n#+LATEX: \\bibliographystyle{" style "}"
 		  "\n#+LATEX: \\bibliography{" file "}\n"))) t t)))
 
     ;; Convert cites to links in html
-    (when (eq backend 'html)
+    (when (eq org-export-current-backend 'html)
       ;; Split citation commands with multiple keys
       (org-exp-bibtex-docites
        (lambda ()
@@ -130,7 +132,7 @@
   (save-excursion
     (save-match-data
       (goto-char (point-min))
-      (when (eq backend 'html)
+      (when (eq org-export-current-backend 'html)
 	(while (re-search-forward "\\\\cite{\\([^}\n]+\\)}" nil t)
 	  (apply fun nil))))))