Hi,

Here is a patch that uses the -a switch of bibtex2html to sort the
citations as bibtex would.  It also changes the invocations of
replace-match to set fixedcase and literal to t.  This is so that emacs
does not try to interpret backslash characters in the bibtex file as it
is inserting them.

Cheers,
Chris

---
 contrib/lisp/org-exp-bibtex.el |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/lisp/org-exp-bibtex.el b/contrib/lisp/org-exp-bibtex.el
index d27fd59..a2051ff 100644
--- a/contrib/lisp/org-exp-bibtex.el
+++ b/contrib/lisp/org-exp-bibtex.el
@@ -56,7 +56,7 @@
 	(replace-match
 	(cond
 	 (htmlp ;; We are exporting to HTML
-	  (call-process "bibtex2html" nil nil nil "--nodoc"  "--style" style "--no-header" (concat file ".bib"))
+	  (call-process "bibtex2html" nil nil nil "-a" "--nodoc"  "--style" style "--no-header" (concat file ".bib"))
 	  (with-temp-buffer
 	    (save-match-data
 	      (insert-file-contents (concat file ".html"))
@@ -65,19 +65,19 @@
 		(setq oebp-cite-plist (cons (cons (match-string 1) (match-string 2)) oebp-cite-plist)))
 	      (goto-char (point-min))
 	      (while (re-search-forward "<hr>" nil t)
-		(replace-match "<hr/>"))
+		(replace-match "<hr/>" t t))
 	      (concat "\n#+BEGIN_HTML\n<div class=\"bibliography\">\n" (buffer-string) "\n</div>\n#+END_HTML\n"))))
 	 (latexp ;; Latex export
 	  (concat "\n#+LATEX: \\\\bibliographystyle{" style "}"
-		  "\n#+LATEX: \\\\bibliography{" file "}\n"))))))
+		  "\n#+LATEX: \\\\bibliography{" file "}\n"))) t t)))
     ;; Convert cites to links in html
     (goto-char (point-min))
     (when htmlp
       (while (re-search-forward "\\\\cite{\\(\\w+\\)}" nil t)
 	(let* ((cn (match-string 1))
 	       (cv (assoc cn oebp-cite-plist)))
-	  (replace-match 
-	   (concat "\[_{}[[" cn "][" (if cv (cdr cv) cn) "]]\]")))))))
+	  (replace-match
+	   (concat "\[_{}[[" cn "][" (if cv (cdr cv) cn) "]]\]") t t))))))
 
 
 (add-hook 'org-export-preprocess-hook 'org-export-bibtex-preprocess)
-- 
1.5.6.3

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to