emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-exp-bibtex.el changes
@ 2009-03-05 15:44 Chris Gray
  2009-03-07 23:13 ` Taru Karttunen
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Gray @ 2009-03-05 15:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-exp-bibtex-patch.patch --]
[-- Type: text/x-diff, Size: 1721 bytes --]

---
 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


[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] org-exp-bibtex.el changes
  2009-03-05 15:44 [PATCH] org-exp-bibtex.el changes Chris Gray
@ 2009-03-07 23:13 ` Taru Karttunen
  0 siblings, 0 replies; 2+ messages in thread
From: Taru Karttunen @ 2009-03-07 23:13 UTC (permalink / raw)
  To: emacs-orgmode

On 05.03 16:44, Chris Gray wrote:
> 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.

That looks nice. +1 to get it committed.

- Taru Karttunen

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-07 23:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-05 15:44 [PATCH] org-exp-bibtex.el changes Chris Gray
2009-03-07 23:13 ` Taru Karttunen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).