Executing ditaa from a script

Table of Contents

1. 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
#+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
#+begin_src ditaa :file images/hello-world-from-script.png :java "" :cmdline -r -e UTF-8
+----------------+
|                |
| Hello World    |
| from a script! |
|                |
+----------------+
#+end_src

hello-world-from-script.png

Author: Leo Butler

Created: 2023-10-26 Thu 10:23

Validate