From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: process diagrams with dot and some glue using org Date: Sat, 20 Jul 2013 12:02:18 +0100 Message-ID: <87a9lh4hqd.fsf@ucl.ac.uk> References: <87vc46ea4y.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0Uvn-0008O8-Fw for emacs-orgmode@gnu.org; Sat, 20 Jul 2013 07:02:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0Uvm-0005Dy-Dx for emacs-orgmode@gnu.org; Sat, 20 Jul 2013 07:02:31 -0400 Received: from mail-db9lp0249.outbound.messaging.microsoft.com ([213.199.154.249]:37707 helo=db9outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0Uvm-0005DH-5j for emacs-orgmode@gnu.org; Sat, 20 Jul 2013 07:02:30 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rick Frankel Cc: emacs-orgmode Rick Frankel writes: [...] > I (sort of) disagree. I think specifying required arguments as header > vars makes the calling requirements clearer. Perhaps: > > #+HEADER: :var nodes='() graph='() > > would be better... > > rick > For Karl's benefit, the following is the latest version of the graph-from-tables source code block including the above suggestion from Rick and also the addition of an options variable. #+begin_src org ,#+name: graph-from-tables ,#+header: :var options="" :var nodes='() graph='() ,#+BEGIN_SRC emacs-lisp :colnames yes (org-babel-execute:dot (concat "digraph {\n" options "\n" ;; "//rankdir=LR;\n" ;; remove comment characters '//' for horizontal layout; add for vertical layout (mapconcat (lambda (x) (format "%s [label=\"%s\" shape=%s style=\"filled\" fillcolor=\"%s\"]" (car x) (nth 1 x) (if (string= "" (nth 2 x)) "box" (nth 2 x)) (if (string= "" (nth 3 x)) "none" (nth 3 x)) )) nodes "\n") "\n" (mapconcat (lambda (x) (format "%s -> %s [taillabel=\"%s\"]" (car x) (nth 1 x) (nth 2 x))) graph "\n") "}\n") params) ,#+END_SRC #+end_src I can update the tutorial on Worg if desired. -- : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.6-341-g338603