emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Darlan Cavalcante Moreira <darcamo@gmail.com>
Cc: Orgmode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [babel] How to set multiple variables with properties
Date: Tue, 21 Jun 2011 13:17:17 -0700	[thread overview]
Message-ID: <87y60vhrci.fsf@gmail.com> (raw)
In-Reply-To: <4e00e5ff.634dec0a.10c2.462f@mx.google.com> (Darlan Cavalcante Moreira's message of "Tue, 21 Jun 2011 15:42:03 -0300")

Unfortunately org-mode properties only allow a single entry for any
given key, so you can only specify one variable using properties.

However the following workaround does exist.

*** alternative
    :PROPERTIES:
    :var:      vars=variables
    :END:

#+tblname: variables
| var1 | 1 |
| var2 | 2 |

#+begin_src python
  print vars[0][1]
  print vars[1][1]
#+end_src

Best -- Eric

Darlan Cavalcante Moreira <darcamo@gmail.com> writes:

> I'm using org-babel to automate a few tasks and I'd like to define a few
> variables that are common to several code blocks as sub-tree properties.
>
> It works when I have only one variable, where I can use
> * Heading
>   :PROPERTY:
>   :var: variable1="value1"
>   :END:
>   #+begin_src python :results output
>     print variable1
>   #+end_src
>
>   #+results:
>   : value1
>
> Is it possible to set multiples variables in this way?
> I tried things like
> :PROPERTY:
> :var: variable1="value1" variable2="value2"
> :END:
>
> :PROPERTY:
> :var: variable1="value1",variable2="value2"
> :END:
>
> :PROPERTY:
> :variable1: "value1"
> :variable2: "value2"
> :END:
> but none of them worked.
>
>
> --
> Darlan Cavalcante
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-06-21 20:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21 18:42 [babel] How to set multiple variables with properties Darlan Cavalcante Moreira
2011-06-21 20:17 ` Eric Schulte [this message]
2011-06-21 21:01   ` Christian Moe
2011-06-21 21:03     ` Eric Schulte
2011-06-22 18:27       ` Christian Moe
2011-06-23  1:38         ` Darlan Cavalcante Moreira
2011-06-24  5:28           ` Eric Schulte
2011-06-24  5:25         ` Eric Schulte
2011-06-22  1:03   ` Darlan Cavalcante Moreira

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=87y60vhrci.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=darcamo@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).