emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Luis Anaya <papoanaya@hotmail.com>
Cc: emacs-orgmode@gnu.org,
	"Arne Babenhauserheide (IMK)" <arne.babenhauserheide@kit.edu>
Subject: Re: babel for ditaa-eps
Date: Sun, 16 Sep 2012 08:13:40 -0600	[thread overview]
Message-ID: <874nmycay3.fsf@gmx.com> (raw)
In-Reply-To: <BLU0-SMTP262165747EE4F037EF70874B7960@phx.gbl> (Luis Anaya's message of "Sat, 15 Sep 2012 22:13:57 -0400")

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

Luis Anaya <papoanaya@hotmail.com> writes:

> Eric Schulte <eric.schulte@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-adding-eps-header-argument-to-ditaa-code-blocks.patch --]
[-- Type: text/x-patch, Size: 2356 bytes --]

From ef4c42ff1fba005077276458d9be70534d48a0fa Mon Sep 17 00:00:00 2001
From: Eric Schulte <eric.schulte@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


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



-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  reply	other threads:[~2012-09-16 14:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 14:00 babel for ditaa-eps Arne Babenhauserheide (IMK)
2012-09-13  2:19 ` Luis Anaya
2012-09-13  3:08 ` Luis Anaya
2012-09-13  5:03   ` Thomas S. Dye
2012-09-13  5:16 ` Eric Schulte
2012-09-13 11:53   ` Arne Babenhauserheide (IMK)
2012-09-13 15:03     ` Eric Schulte
2012-09-13 23:28       ` Luis Anaya
2012-09-14  0:15         ` Eric Schulte
2012-09-14  2:51           ` Eric Schulte
2012-09-16  2:13             ` Luis Anaya
2012-09-16 14:13               ` Eric Schulte [this message]
2012-09-19  8:22                 ` Bastien
2012-09-19  8:21       ` Bastien
2012-09-21  5:20       ` Thomas S. Dye
2012-09-21 13:29         ` Bastien
2012-09-22  8:48         ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2012-09-14  3:05 Luis Anaya

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=874nmycay3.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=arne.babenhauserheide@kit.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=papoanaya@hotmail.com \
    /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).