emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Rick Frankel <rick@rickster.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: process diagrams with dot and some glue using org
Date: Sat, 20 Jul 2013 12:02:18 +0100	[thread overview]
Message-ID: <87a9lh4hqd.fsf@ucl.ac.uk> (raw)
In-Reply-To: eb831478f04695a2a481b9f08bfcf979@mail.rickster.com

Rick Frankel <rick@rickster.com> 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

  parent reply	other threads:[~2013-07-20 11:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 17:23 process diagrams with dot and some glue using org Eric S Fraga
2013-07-19 17:37 ` Rick Frankel
2013-07-19 17:56   ` Eric S Fraga
2013-07-20 11:02   ` Eric S Fraga [this message]
2013-07-20 12:47     ` Rick Frankel
2013-07-21 19:05 ` Karl Voit
2013-07-22  8:00   ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9lh4hqd.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=rick@rickster.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).