Function: org-babel-execute:ditaa
org-babel-execute:ditaa is a byte-compiled function defined in
ob-ditaa.el.gz.
Signature
(org-babel-execute:ditaa BODY PARAMS)
Documentation
Execute BODY of Ditaa code with org-babel according to PARAMS.
This function is called by org-babel-execute-src-block.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-ditaa.el.gz
(defun org-babel-execute:ditaa (body params)
"Execute BODY of Ditaa code with org-babel according to PARAMS.
This function is called by `org-babel-execute-src-block'."
(let* ((out-file (or (cdr (assq :file params))
(error
"Ditaa code block requires :file header argument")))
(cmdline (cdr (assq :cmdline params)))
(java (cdr (assq :java params)))
(in-file (org-babel-temp-file "ditaa-"))
(eps (cdr (assq :eps params)))
(eps-file (when eps
(org-babel-process-file-name (concat in-file ".eps"))))
(pdf-cmd (when (and (or (string= (file-name-extension out-file) "pdf")
(cdr (assq :pdf params))))
(concat
"epstopdf"
" " eps-file
" -o=" (org-babel-process-file-name out-file))))
(cmd (concat org-babel-ditaa-java-cmd
" " java " " org-ditaa-jar-option " "
(shell-quote-argument
(expand-file-name
(if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))
" " cmdline
" " (org-babel-process-file-name in-file)
" " (if pdf-cmd
eps-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))
(with-temp-file in-file (insert body))
(unless noninteractive (message cmd))
(shell-command cmd)
(when pdf-cmd (unless noninteractive (message pdf-cmd)) (shell-command pdf-cmd))
nil)) ;; signal that output has already been written to file