From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: babel for ditaa-eps Date: Sun, 16 Sep 2012 08:13:40 -0600 Message-ID: <874nmycay3.fsf@gmx.com> References: <877grynexk.fsf@gmx.com> <87r4q5tq7u.fsf@gmx.com> <87mx0ttiyu.fsf@gmx.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDFbW-0002Zq-Jz for emacs-orgmode@gnu.org; Sun, 16 Sep 2012 10:13:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDFbV-00063j-75 for emacs-orgmode@gnu.org; Sun, 16 Sep 2012 10:13:46 -0400 Received: from mailout-eu.gmx.com ([213.165.64.42]:36329) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TDFbU-00063a-Sv for emacs-orgmode@gnu.org; Sun, 16 Sep 2012 10:13:45 -0400 In-Reply-To: (Luis Anaya's message of "Sat, 15 Sep 2012 22:13:57 -0400") 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: Luis Anaya Cc: emacs-orgmode@gnu.org, "Arne Babenhauserheide (IMK)" --=-=-= Content-Type: text/plain Luis Anaya writes: > Eric Schulte writes: > > Hi: > >> with the attachment :) > > I tried your patch and it seems that the defcustom needs to be changed > (at least from the way it is written in the patch. Oh yes, I used file-name-nondirectory instead of file-name-directory, and forgot the customization documentation. Here's updated version. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-adding-eps-header-argument-to-ditaa-code-blocks.patch >From ef4c42ff1fba005077276458d9be70534d48a0fa Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 13 Sep 2012 08:58:31 -0600 Subject: [PATCH] adding :eps header argument to ditaa code blocks Use of this header argument will change the back-end engine from ditaa.jar to a combination of DitaaEps.jar and epstopdf. This patch is based off of ob-ditaa-eps.el sent to the mailing list by Arne Babenhauserheide (IMK). --- lisp/ob-ditaa.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el index 1c6c712..609bac4 100644 --- a/lisp/ob-ditaa.el +++ b/lisp/ob-ditaa.el @@ -57,6 +57,12 @@ :group 'org-babel :type 'string) +(defcustom org-ditaa-eps-jar-path + (expand-file-name "DitaaEps.jar" (file-name-directory org-ditaa-jar-path)) + "Path to the DitaaEps.jar executable." + :group 'org-babel + :type 'string) + (defcustom org-ditaa-jar-option "-jar" "Option for the ditaa jar file. Do not leave leading or trailing spaces in this string." @@ -76,16 +82,25 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file "ditaa-")) + (eps (cdr (assoc :eps params))) (cmd (concat "java " java " " org-ditaa-jar-option " " (shell-quote-argument - (expand-file-name org-ditaa-jar-path)) + (expand-file-name + (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)))) + " " (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))))) (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)) (message cmd) (shell-command cmd) + (when pdf-cmd (message pdf-cmd) (shell-command pdf-cmd)) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:ditaa (session params) -- 1.7.12 --=-=-= Content-Type: text/plain -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--