From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anders Johansson Subject: Bug: ob-ditaa fails in generating pdf correctly Date: Thu, 22 May 2014 17:27:58 +0200 Message-ID: <537E177E.9010906@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010400050907020009060803" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnUuv-0008Gg-BQ for emacs-orgmode@gnu.org; Thu, 22 May 2014 11:28:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnUuh-0007LV-Tz for emacs-orgmode@gnu.org; Thu, 22 May 2014 11:28:25 -0400 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]:56162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnUuh-0007Ky-ML for emacs-orgmode@gnu.org; Thu, 22 May 2014 11:28:11 -0400 Received: by mail-la0-f45.google.com with SMTP id gl10so2778116lab.32 for ; Thu, 22 May 2014 08:28:10 -0700 (PDT) Received: from [130.238.77.92] (pc92.kvk.uu.se. [130.238.77.92]) by mx.google.com with ESMTPSA id s10sm93098lal.22.2014.05.22.08.28.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 08:28:08 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------010400050907020009060803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Example input: #+header: :eps t #+header: :file hello.pdf #+BEGIN_SRC ditaa +--------------+ | | | Hello | | | +--------------+ #+END_SRC When using the above code (which I guessed should be the correct way) with ob-ditaa to produce a pdf (through DitaaEps -> epstopdf) it fails in producing the pdf correctly and instead writes an eps to "hello.pdf". This isn't surprising, looking at the code where "cmd" should be constructed to produce the eps as an intermediary file in /tmp (which is expected in the construction of pdf-cmd) but doesn't. An ugly patch to fix it is attached (this is ugly because it repeats the line: (org-babel-process-file-name (concat in-file ".eps")) ) Cheers, Anders Johansson --------------010400050907020009060803 Content-Type: text/plain; charset=UTF-8; name="ob-ditaa-patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ob-ditaa-patch" --- "/home/aj/H\303\244mtningar/ob-ditaa.el" 2014-05-22 17:15:35.489071991 +0200 +++ ob-ditaa.el 2014-05-22 17:08:46.617089186 +0200 @@ -90,6 +90,12 @@ (java (cdr (assoc :java params))) (in-file (org-babel-temp-file "ditaa-")) (eps (cdr (assoc :eps params))) + (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf") + (cdr (assoc :pdf params)))) + (concat + "epstopdf" + " " (org-babel-process-file-name (concat in-file ".eps")) + " -o=" (org-babel-process-file-name out-file)))) (cmd (concat org-babel-ditaa-java-cmd " " java " " org-ditaa-jar-option " " (shell-quote-argument @@ -97,13 +103,10 @@ (if eps org-ditaa-eps-jar-path org-ditaa-jar-path))) " " cmdline " " (org-babel-process-file-name in-file) - " " (org-babel-process-file-name out-file))) - (pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf") - (cdr (assoc :pdf params)))) - (concat - "epstopdf" - " " (org-babel-process-file-name (concat in-file ".eps")) - " -o=" (org-babel-process-file-name out-file))))) + " " (if pdf-cmd + (org-babel-process-file-name (concat in-file ".eps")) + (org-babel-process-file-name out-file)))) + ) (unless (file-exists-p org-ditaa-jar-path) (error "Could not find ditaa.jar at %s" org-ditaa-jar-path)) (with-temp-file in-file (insert body)) --------------010400050907020009060803--