all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: ob-ditaa fails in generating pdf correctly
@ 2014-05-22 15:27 Anders Johansson
  2014-06-06 16:22 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Anders Johansson @ 2014-05-22 15:27 UTC (permalink / raw
  To: emacs-orgmode

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

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

[-- Attachment #2: ob-ditaa-patch --]
[-- Type: text/plain, Size: 1424 bytes --]

--- "/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))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug: ob-ditaa fails in generating pdf correctly
  2014-05-22 15:27 Bug: ob-ditaa fails in generating pdf correctly Anders Johansson
@ 2014-06-06 16:22 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2014-06-06 16:22 UTC (permalink / raw
  To: Anders Johansson; +Cc: emacs-orgmode

Anders Johansson <mejlaandersj@gmail.com> writes:

> 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

Applied.

> (this is ugly because it repeats the line:
> (org-babel-process-file-name (concat in-file ".eps")) )
>

I un-duplicated this line.

Thanks,

>
> Cheers,
> Anders Johansson
>
> --- "/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))

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-06 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-22 15:27 Bug: ob-ditaa fails in generating pdf correctly Anders Johansson
2014-06-06 16:22 ` Eric Schulte

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.