ob-ditaa.el: New option `org-ditaa-jar-option'.

* ob-ditaa.el (org-ditaa-jar-path): Make a defcustom.
(org-ditaa-jar-option): New option.
(org-babel-execute:ditaa): Use it.

Thanks to Waldemar Reusch for reporting this need.
This commit is contained in:
Bastien Guerry 2012-01-04 11:22:28 +01:00
parent ad2f2df5db
commit d3a45bd722
1 changed files with 15 additions and 3 deletions

View File

@ -39,10 +39,22 @@
(require 'ob)
(defvar org-babel-default-header-args:ditaa
'((:results . "file") (:exports . "results") (:java . "-Dfile.encoding=UTF-8"))
'((:results . "file")
(:exports . "results")
(:java . "-Dfile.encoding=UTF-8"))
"Default arguments for evaluating a ditaa source block.")
(defvar org-ditaa-jar-path)
(defcustom org-ditaa-jar-path nil
"Path for the ditaa jar file."
: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."
:group 'org-babel
:type 'string)
(defun org-babel-execute:ditaa (body params)
"Execute a block of Ditaa code with org-babel.
This function is called by `org-babel-execute-src-block'."
@ -55,7 +67,7 @@ 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-"))
(cmd (concat "java " java " -jar "
(cmd (concat "java " java " " org-ditaa-jar-option " "
(shell-quote-argument
(expand-file-name org-ditaa-jar-path))
" " cmdline