Re: [O] babel for ditaa-eps
Hi Thomas, t...@tsdye.com (Thomas S. Dye) writes: Is it possible to distribute DitaaEps.jar with Org? Or, does it need to be installed separately? I just wrote to the ditaa author. Arne told me ditaaeps works with ditaa 0.6b but not with latest ditaa 0.9, the one we are distributing. I don't want to distribute several versions of ditaa in Org mode, so I ask the ditaa author to see if he can make ditaaeps work with latest ditaa. I'll let you know, best, -- Bastien
Re: [O] babel for ditaa-eps
Hi Thomas, t...@tsdye.com (Thomas S. Dye) writes: Is it possible to distribute DitaaEps.jar with Org? Or, does it need to be installed separately? We can install it along with ditaa.jar in contrib/scripts/ One question: DitaaEPS is bundled with ditaa_0.6b where we have latest ditaa 0.9 in contrib/. Can someone check that using ditaaeps with ditaa 0.9 is okay ? Thanks, -- Bastien
Re: [O] babel for ditaa-eps
Eric Schulte eric.schu...@gmx.com writes: Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Hi Eric, It’s much easier to answer, what this does not share with ob-ditaa.el :) If I cut out the obvious renaming (to be able to use a ditaa-exp source type), it’s just this diff (and the first half of that only defines variables…): Hi Arne, I re-worked your diff into a patch against ob-ditaa.el which adds an :eps header argument to ditaa code blocks. Please try this out and let me know if it works and if it loses any functionality from your original ob-ditaa-eps.el. Should we distribute the DitaaEps.jar with Org-mode in the same manner as we now distribute ditaa.jar? Is it possible to distribute DitaaEps.jar with Org? Or, does it need to be installed separately? All the best, Tom From 643d59bfebc2a917bdd4b5da002df4b663f65be2 Mon Sep 17 00:00:00 2001 From: Eric Schulte eric.schu...@gmx.com 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 | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el index 1c6c712..3fbf50b 100644 --- a/lisp/ob-ditaa.el +++ b/lisp/ob-ditaa.el @@ -57,6 +57,9 @@ :group 'org-babel :type 'string) +(defcustom org-ditaa-eps-jar-path + (expand-file-name DitaaEps.jar (file-name-nondirectory org-ditaa-jar-path))) + (defcustom org-ditaa-jar-option -jar Option for the ditaa jar file. Do not leave leading or trailing spaces in this string. @@ -76,16 +79,24 @@ 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))) + (eps-cmd (when eps + (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 eps (message eps-cmd) (shell-command eps-cmd)) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:ditaa (session params) -- 1.7.12 -- Thomas S. Dye http://www.tsdye.com
Re: [O] babel for ditaa-eps
Hi Eric, Eric Schulte eric.schu...@gmx.com writes: Oh yes, I used file-name-nondirectory instead of file-name-directory, and forgot the customization documentation. Here's updated version. Feel free to apply this in master -- thanks to Arne Luis and you! -- Bastien
Re: [O] babel for ditaa-eps
Hi Eric, Eric Schulte eric.schu...@gmx.com writes: Should we distribute the DitaaEps.jar with Org-mode in the same manner as we now distribute ditaa.jar? If we have permission to do this then lets do it. -- Bastien
Re: [O] babel for ditaa-eps
Luis Anaya papoan...@hotmail.com writes: Eric Schulte eric.schu...@gmx.com 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. From ef4c42ff1fba005077276458d9be70534d48a0fa Mon Sep 17 00:00:00 2001 From: Eric Schulte eric.schu...@gmx.com 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 -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] babel for ditaa-eps
Eric Schulte eric.schu...@gmx.com 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. I'm attaching a diff against the original ditaa (I hope that is close enough) with the one I fixed. The only thing that is of importance is the defcustom definition for the DitaaEPS.jar. I did not change any of the logic (yet... :) ). Luis ob-ditaa-luis-patch.el Description: Luis Patch for ob-ditaa.el -- Luis Anaya papo anaya aroba hot mail punto com Do not use 100 words if you can say it in 10 - Yamamoto Tsunetomo
Re: [O] babel for ditaa-eps
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Eric, It’s much easier to answer, what this does not share with ob-ditaa.el :) If I cut out the obvious renaming (to be able to use a ditaa-exp source type), it’s just this diff (and the first half of that only defines variables…): - --- /usr/share/emacs/site-lisp/org-mode/ob-ditaa.el 2012-05-25 23:12:51.0 +0200 +++ ob-ditaa-eps.el 2012-09-12 15:37:50.942191587 +0200 @@ -44,6 +47,20 @@ - -(defvar org-ditaa-jar-path) - -(defun org-babel-execute:ditaa (body params) +(defcustom org-ditaa-eps-jar-path (expand-file-name + DitaaEps.jar + (file-name-as-directory +(expand-file-name + scripts + (file-name-as-directory + (expand-file-name + ../contrib + (file-name-directory (find-library-name org))) + Path to the ditaa-eps jar executable. + :group 'org-babel + :type 'string) + + +(defvar org-ditaa-eps-jar-path) +(defun org-babel-execute:ditaa-eps (body params) Execute a block of Ditaa code with org-babel. This function is called by `org-babel-execute-src-block'. (let* ((result-params (split-string (or (cdr (assoc :results params)) ))) @@ -55,14 +72,18 @@ (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file ditaa-)) - - (cmd (concat java java -jar +(cmd0 (concat java java -jar (shell-quote-argument - -(expand-file-name org-ditaa-jar-path)) + (expand-file-name org-ditaa-eps-jar-path)) cmdline (org-babel-process-file-name in-file) - - (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)) + (org-babel-process-file-name (concat in-file .eps +(cmd1 (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-eps-jar-path) + (error Could not find ditaa.jar at %s org-ditaa-eps-jar-path)) (with-temp-file in-file (insert body)) - -(message cmd) (shell-command cmd) +(message cmd0) (shell-command cmd0) +(message cmd1) (shell-command cmd1) nil)) ;; signal that output has already been written to file Best wishes, Arne Am 13.09.2012 07:16, schrieb Eric Schulte: It sounds like there is a good deal of desire for this functionality. How much code does this file share with ob-ditaa? If it is a large percentage perhaps it would be possible to instead add a new header argument to ditaa code blocks to run ditaa-eps. Some code blocks (e.g., sql) already have an :engine header argument which may be used to change the back-end tool which executes the block. Thanks for sharing! Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Dear org hackers, I don’t know if there’s already a babel-ditaa-option for using ditaa-eps, so I modified ob-ditaa.el to use ditaa-eps and convert the result using epstopdf. Feel free to use it. ;;; ob-ditaa-eps.el --- org-babel functions for ditaa evaluation ;; Copyright (C) 2009-2012 Free Software Foundation, Inc. ;; Author: Eric Schulte und Arne Babenhauserheide ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see http://www.gnu.org/licenses/. ;;; Commentary: ;; Org-Babel support for evaluating ditaa source code as eps/pdf. ;; ;; Almost verbatim copy from ob-ditaa, but with ditaa-eps and epstopdf ;; as intermediate step. ;; ;; Ditaa differs from most standard languages in that ;; ;; 1) there is no such thing as a session in ditaa ;; ;; 2) we are generally only going to return results of type file ;; ;; 3) we are adding the file and cmdline header arguments ;; ;; 4) there are no variables (at least for now) ;;; Code: (require 'ob) (defvar org-babel-default-header-args:ditaa-eps '((:results . file) (:exports . results) (:java .
Re: [O] babel for ditaa-eps
Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Hi Eric, It’s much easier to answer, what this does not share with ob-ditaa.el :) If I cut out the obvious renaming (to be able to use a ditaa-exp source type), it’s just this diff (and the first half of that only defines variables…): Hi Arne, I re-worked your diff into a patch against ob-ditaa.el which adds an :eps header argument to ditaa code blocks. Please try this out and let me know if it works and if it loses any functionality from your original ob-ditaa-eps.el. Should we distribute the DitaaEps.jar with Org-mode in the same manner as we now distribute ditaa.jar? From 643d59bfebc2a917bdd4b5da002df4b663f65be2 Mon Sep 17 00:00:00 2001 From: Eric Schulte eric.schu...@gmx.com 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 | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el index 1c6c712..3fbf50b 100644 --- a/lisp/ob-ditaa.el +++ b/lisp/ob-ditaa.el @@ -57,6 +57,9 @@ :group 'org-babel :type 'string) +(defcustom org-ditaa-eps-jar-path + (expand-file-name DitaaEps.jar (file-name-nondirectory org-ditaa-jar-path))) + (defcustom org-ditaa-jar-option -jar Option for the ditaa jar file. Do not leave leading or trailing spaces in this string. @@ -76,16 +79,24 @@ 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))) + (eps-cmd (when eps + (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 eps (message eps-cmd) (shell-command eps-cmd)) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:ditaa (session params) -- 1.7.12 -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] babel for ditaa-eps
Eric Schulte eric.schu...@gmx.com writes: Please, provide the option to not create the PDF file at the end for those poor people that use Groff to create documents in which will barf on a PDF file. Thanks, Luis -- Luis R. Anaya papo anaya aroba hot mail punto com Do not use 100 words if you can say it in 10 - Yamamoto Tsunetomo
Re: [O] babel for ditaa-eps
Luis Anaya papoan...@hotmail.com writes: Eric Schulte eric.schu...@gmx.com writes: Please, provide the option to not create the PDF file at the end for those poor people that use Groff to create documents in which will barf on a PDF file. Thanks, Luis Good idea, The attached version makes this change. If someone can confirm that this patch works I can apply it. Thanks, -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] babel for ditaa-eps
Eric Schulte eric.schu...@gmx.com writes: Luis Anaya papoan...@hotmail.com writes: Eric Schulte eric.schu...@gmx.com writes: Please, provide the option to not create the PDF file at the end for those poor people that use Groff to create documents in which will barf on a PDF file. Thanks, Luis Good idea, The attached version makes this change. If someone can confirm that this patch works I can apply it. Thanks, with the attachment :) From 014fa9fd68a6476df2da32c590781788672a0f1a Mon Sep 17 00:00:00 2001 From: Eric Schulte eric.schu...@gmx.com 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 | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el index 1c6c712..d97af14 100644 --- a/lisp/ob-ditaa.el +++ b/lisp/ob-ditaa.el @@ -57,6 +57,9 @@ :group 'org-babel :type 'string) +(defcustom org-ditaa-eps-jar-path + (expand-file-name DitaaEps.jar (file-name-nondirectory org-ditaa-jar-path))) + (defcustom org-ditaa-jar-option -jar Option for the ditaa jar file. Do not leave leading or trailing spaces in this string. @@ -76,16 +79,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 -- Eric Schulte http://cs.unm.edu/~eschulte
Re: [O] babel for ditaa-eps
Oh, I thought that I was going blind or needed stronger bifocals :).I'll take a look at it and play with it, Thanks!Luis Original Message From: Eric SchulteSent: Thu, Sep 13, 2012 10:51 PM To: Luis Anaya CC: emacs-orgmode@gnu.org; Arne Babenhauserheide (IMK) Subject: Re: [O] babel for ditaa-epsEric Schulte writes: > Luis Anaya writes: > >> Eric Schulte writes: >> >> Please, provide the option to not create the PDF file at the end for >> those poor people that use Groff to create documents in which will barf >> on a PDF file. >> >> Thanks, >> >> Luis > > Good idea, > > The attached version makes this change. If someone can confirm that > this patch works I can apply it. > > Thanks, with the attachment :) -- Eric Schulte http://cs.unm.edu/~eschulte
[O] babel for ditaa-eps
Dear org hackers, I don’t know if there’s already a babel-ditaa-option for using ditaa-eps, so I modified ob-ditaa.el to use ditaa-eps and convert the result using epstopdf. Feel free to use it. ;;; ob-ditaa-eps.el --- org-babel functions for ditaa evaluation ;; Copyright (C) 2009-2012 Free Software Foundation, Inc. ;; Author: Eric Schulte und Arne Babenhauserheide ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see http://www.gnu.org/licenses/. ;;; Commentary: ;; Org-Babel support for evaluating ditaa source code as eps/pdf. ;; ;; Almost verbatim copy from ob-ditaa, but with ditaa-eps and epstopdf ;; as intermediate step. ;; ;; Ditaa differs from most standard languages in that ;; ;; 1) there is no such thing as a session in ditaa ;; ;; 2) we are generally only going to return results of type file ;; ;; 3) we are adding the file and cmdline header arguments ;; ;; 4) there are no variables (at least for now) ;;; Code: (require 'ob) (defvar org-babel-default-header-args:ditaa-eps '((:results . file) (:exports . results) (:java . -Dfile.encoding=UTF-8)) Default arguments for evaluating a ditaa source block.) (defcustom org-ditaa-eps-jar-path (expand-file-name DitaaEps.jar (file-name-as-directory (expand-file-name scripts (file-name-as-directory (expand-file-name ../contrib (file-name-directory (find-library-name org))) Path to the ditaa-eps jar executable. :group 'org-babel :type 'string) (defvar org-ditaa-eps-jar-path) (defun org-babel-execute:ditaa-eps (body params) Execute a block of Ditaa code with org-babel. This function is called by `org-babel-execute-src-block'. (let* ((result-params (split-string (or (cdr (assoc :results params)) ))) (out-file ((lambda (el) (or el (error ditaa code block requires :file header argument))) (cdr (assoc :file params (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file ditaa-)) (cmd0 (concat java java -jar (shell-quote-argument (expand-file-name org-ditaa-eps-jar-path)) cmdline (org-babel-process-file-name in-file) (org-babel-process-file-name (concat in-file .eps (cmd1 (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-eps-jar-path) (error Could not find ditaa.jar at %s org-ditaa-eps-jar-path)) (with-temp-file in-file (insert body)) (message cmd0) (shell-command cmd0) (message cmd1) (shell-command cmd1) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:ditaa-eps (session params) Return an error because ditaa does not support sessions. (error Ditaa does not support sessions)) (defun ditaa-eps-mode () (artist-mode)) (provide 'ob-ditaa-eps) ;;; ob-ditaa-eps.el ends here Best wishes, Arne ;;; ob-ditaa-eps.el --- org-babel functions for ditaa evaluation ;; Copyright (C) 2009-2012 Free Software Foundation, Inc. ;; Author: Eric Schulte und Arne Babenhauserheide ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see http://www.gnu.org/licenses/.
Re: [O] babel for ditaa-eps
Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Dear org hackers, I don?t know if there?s already a babel-ditaa-option for using ditaa-eps, so I modified ob-ditaa.el to use ditaa-eps and convert the result using epstopdf. This is great, thanks. The way I addressed this in the Groff exporter was to convert the PNG to EPS. But if this creates EPS directly from the get go, it's a better approach for better fidelity. Thanks for sharing. -- Luis R. Anaya papo anaya aroba hot mail punto com Do not use 100 words if you can say it in 10 - Yamamoto Tsunetomo
Re: [O] babel for ditaa-eps
Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Hi: I made a small changed to the code. It will look for the suffix and run the epspdf step only if it's a pdf, otherwise, it will print the EPS. The reason for this is because on Groff, you're better off with the EPS file. Luis ob-ditaa-eps.el Description: Modified Ditaa EPS -- Luis R. Anaya papo anaya aroba hot mail punto com Do not use 100 words if you can say it in 10 - Yamamoto Tsunetomo
Re: [O] babel for ditaa-eps
Luis Anaya papoan...@hotmail.com writes: Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Hi: I made a small changed to the code. It will look for the suffix and run the epspdf step only if it's a pdf, otherwise, it will print the EPS. The reason for this is because on Groff, you're better off with the EPS file. Luis If this code is useful, perhaps it could be checked into contrib/lisp? Of course, it would be good to have some documentation on Worg, too. All the best, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] babel for ditaa-eps
It sounds like there is a good deal of desire for this functionality. How much code does this file share with ob-ditaa? If it is a large percentage perhaps it would be possible to instead add a new header argument to ditaa code blocks to run ditaa-eps. Some code blocks (e.g., sql) already have an :engine header argument which may be used to change the back-end tool which executes the block. Thanks for sharing! Arne Babenhauserheide (IMK) arne.babenhauserhe...@kit.edu writes: Dear org hackers, I don’t know if there’s already a babel-ditaa-option for using ditaa-eps, so I modified ob-ditaa.el to use ditaa-eps and convert the result using epstopdf. Feel free to use it. ;;; ob-ditaa-eps.el --- org-babel functions for ditaa evaluation ;; Copyright (C) 2009-2012 Free Software Foundation, Inc. ;; Author: Eric Schulte und Arne Babenhauserheide ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see http://www.gnu.org/licenses/. ;;; Commentary: ;; Org-Babel support for evaluating ditaa source code as eps/pdf. ;; ;; Almost verbatim copy from ob-ditaa, but with ditaa-eps and epstopdf ;; as intermediate step. ;; ;; Ditaa differs from most standard languages in that ;; ;; 1) there is no such thing as a session in ditaa ;; ;; 2) we are generally only going to return results of type file ;; ;; 3) we are adding the file and cmdline header arguments ;; ;; 4) there are no variables (at least for now) ;;; Code: (require 'ob) (defvar org-babel-default-header-args:ditaa-eps '((:results . file) (:exports . results) (:java . -Dfile.encoding=UTF-8)) Default arguments for evaluating a ditaa source block.) (defcustom org-ditaa-eps-jar-path (expand-file-name DitaaEps.jar (file-name-as-directory (expand-file-name scripts (file-name-as-directory (expand-file-name ../contrib (file-name-directory (find-library-name org))) Path to the ditaa-eps jar executable. :group 'org-babel :type 'string) (defvar org-ditaa-eps-jar-path) (defun org-babel-execute:ditaa-eps (body params) Execute a block of Ditaa code with org-babel. This function is called by `org-babel-execute-src-block'. (let* ((result-params (split-string (or (cdr (assoc :results params)) ))) (out-file ((lambda (el) (or el (error ditaa code block requires :file header argument))) (cdr (assoc :file params (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file ditaa-)) (cmd0 (concat java java -jar (shell-quote-argument (expand-file-name org-ditaa-eps-jar-path)) cmdline (org-babel-process-file-name in-file) (org-babel-process-file-name (concat in-file .eps (cmd1 (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-eps-jar-path) (error Could not find ditaa.jar at %s org-ditaa-eps-jar-path)) (with-temp-file in-file (insert body)) (message cmd0) (shell-command cmd0) (message cmd1) (shell-command cmd1) nil)) ;; signal that output has already been written to file (defun org-babel-prep-session:ditaa-eps (session params) Return an error because ditaa does not support sessions. (error Ditaa does not support sessions)) (defun ditaa-eps-mode () (artist-mode)) (provide 'ob-ditaa-eps) ;;; ob-ditaa-eps.el ends here Best wishes, Arne -- Eric Schulte http://cs.unm.edu/~eschulte