emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thibault Marin <thibault.marin@gmx.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Multiple bibliography files with ox-bibtex and html export
Date: Tue, 06 Sep 2016 22:46:57 -0500	[thread overview]
Message-ID: <871t0wl6by.fsf@dell-desktop.WORKGROUP> (raw)
In-Reply-To: <87vay9v1h1.fsf@saiph.selenimh>

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


Nicolas Goaziou writes:

> Hello,
>
> Thibault Marin <thibault.marin@gmx.com> writes:
>
>> I would like to use ox-bibtex to export a bibliography to html with
>> multiple bibliography files, as follows:
>>
>> #+BIBLIOGRAPHY: bibtex_1.bib,bibtex_2.bib plain option:-d option:-noabstract limit:t
>>
>> This works with latex export but not with html (I get a "Executing
>> bibtex2html failed").  It appears that bibtex2html can only process a
>> single file.
>>
>> I am attaching a patch which allows me to use multiple files with html
>> export.  It creates a combined bibliography file and call bibtex2html on
>> it.  I am not sure this is the best way to address this, so any
>> suggestion would be welcome.
>>
>> Does this look like something that could be merged?
>
> Apparently no objection was raised, so I think this can be merged. Some
> minor comments below.
>
>> +	    (let ((files (org-split-string file ",")))
>
> I think `split-string' is sufficient here.
>
>> +	      (when (< 1 (length files))
>> +		(let ((combined-bib-file
>> +		       (concat
>> +			(file-name-sans-extension
>> +			 (file-name-nondirectory
>> +			  (buffer-file-name))) "-combined.bib")))
>> +		  (with-temp-file combined-bib-file
>> +		    (dolist (bib files)
>> +		      (insert-file-contents
>> +		       (if (equal (file-name-extension bib) "bib")
>> +			   bib
>> +			 (concat bib ".bib")
>> +			 )
>> +		       )
>> +		      )
>> +		    )
>> +		  (setq file combined-bib-file)
>> +		  )
>> +		)
>> +	      )
>
> There should be no dangling parenthesis in Lisp.
>
> Could you send an updated patch?
>
> Thank you.
>
>
> Regards,

Thanks for the review, here is an updated patch.

Best,

thibault

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-contrib-lisp-ox-bibtex.el-org-bibtex-process-bib-fil.patch --]
[-- Type: text/x-diff, Size: 1987 bytes --]

From cb07ff936587a456f1e6599d216efe9463431d3f Mon Sep 17 00:00:00 2001
From: thibault <thibault.marin@gmx.com>
Date: Tue, 6 Sep 2016 22:42:39 -0500
Subject: [PATCH] * contrib/lisp/ox-bibtex.el (org-bibtex-process-bib-files):
 Add support for multiple bibliography files with html export.

Combine comma-separated bibliography files into a single one and process
it using bibtex2html.  This matches the behavior already present for
latex export.
---
 contrib/lisp/ox-bibtex.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ox-bibtex.el b/contrib/lisp/ox-bibtex.el
index 56dec38..b46cb76 100644
--- a/contrib/lisp/ox-bibtex.el
+++ b/contrib/lisp/ox-bibtex.el
@@ -191,13 +191,27 @@ Return new parse tree."
 		(file (org-bibtex-get-file keyword))
 		temp-file
 		out-file)
+	    (let ((files (split-string file ",")))
+	      (when (< 1 (length files))
+		(let ((combined-bib-file
+		       (concat
+			(file-name-sans-extension
+			 (file-name-nondirectory
+			  (buffer-file-name))) "-combined.bib")))
+		  (with-temp-file combined-bib-file
+		    (dolist (bib files)
+		      (insert-file-contents
+		       (if (equal (file-name-extension bib) "bib")
+			   bib
+			 (concat bib ".bib")))))
+		  (setq file combined-bib-file))))
 	    ;; Test if filename is given with .bib-extension and strip
     	    ;; it off. Filenames with another extensions will be
 	    ;; untouched and will finally rise an error in bibtex2html.
 	    (setq file (if (equal (file-name-extension file) "bib")
 			   (file-name-sans-extension file) file))
-	    ;; Outpufiles of bibtex2html will be put into current working directory
-	    ;; so define a variable for this.
+	    ;; Output files of bibtex2html will be put into current
+	    ;; working directory so define a variable for this.
 	    (setq out-file (file-name-sans-extension
 			    (file-name-nondirectory file)))
 	    ;; limit is set: collect citations throughout the document
-- 
2.8.1


  reply	other threads:[~2016-09-07  3:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24  4:14 Multiple bibliography files with ox-bibtex and html export Thibault Marin
2016-09-06  9:09 ` Nicolas Goaziou
2016-09-07  3:46   ` Thibault Marin [this message]
2016-09-07  4:11     ` Clément Pit--Claudel
2016-09-09  3:55       ` Thibault Marin
2016-09-10  6:07       ` Thibault Marin
2016-09-10 16:31         ` Clément Pit--Claudel
2016-09-28  3:50           ` Thibault Marin
2016-11-16  5:31             ` Thibault Marin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871t0wl6by.fsf@dell-desktop.WORKGROUP \
    --to=thibault.marin@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).