#+author: Leo Butler #+title: Executing ditaa from a script * Executing =ditaa= from a script Org assumes that =ditaa= is run as a java jar file. Users may need to use a script to run =ditaa=. This example shows how. First, set ~org-babel-ditaa-java-cmd~ and ~org-ditaa-jar-option~ to empty strings and ~org-ditaa-jar-path~ to the script's path; here, it is =/usr/bin/ditaa=. This example uses ~setq-local~ to change only the values in this buffer. #+name: hello-world-from-script.el.org #+begin_src org :exports code :results replace ,#+name: hello-world-from-script.el ,#+begin_src emacs-lisp :exports none :results none (setq-local org-babel-ditaa-java-cmd "" org-ditaa-jar-option "" org-ditaa-jar-path "/usr/bin/ditaa") ,#+end_src #+end_src #+RESULTS: hello-world-from-script.el.org #+name: hello-world-from-script.el #+begin_src emacs-lisp :exports none :results none (setq-local org-babel-ditaa-java-cmd "" org-ditaa-jar-option "" org-ditaa-jar-path "/usr/bin/ditaa") #+end_src Second, in the =ditaa= code-block, set the header argument =:java= to the empty string =""=. The =:cmdline= header argument can be used to pass command-line options to =ditaa= via the script. #+name: hello-world-from-script.org #+begin_src org :exports code :results replace ,#+name: hello-world-from-script ,#+begin_src ditaa :file images/hello-world-from-script.png :java "" :cmdline -r -e UTF-8 +----------------+ | | | Hello World | | from a script! | | | +----------------+ ,#+end_src #+end_src #+RESULTS: hello-world-from-script.org #+name: hello-world-from-script #+begin_src ditaa :file images/hello-world-from-script.png :java "" :cmdline -r -e UTF-8 +----------------+ | | | Hello World | | from a script! | | | +----------------+ #+end_src #+RESULTS: hello-world-from-script [[file:images/hello-world-from-script.png]]