emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Seeking advice for conditional code


From: Sebastien Vauban
Subject: Re: [O] Seeking advice for conditional code
Date: Thu, 31 Jan 2013 22:03:44 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.92 (windows-nt)

Hi François,

François Pinard wrote:
> Would someone be kind enough to point me in the right direction, if
> there is one already?  My need is to have conditional code at
> publication time, and being able to include or exclude regions of code
> according to some symbol being "active" or "defined", or not.

I want to be sure to understand: do you need

- conditional tangled code, or

- conditional "full" document (containing conditional code and conditional
  doc)?

When you say "conditional", do you mean to to be able to decide to include it
or not, or even more (such as including one version or the other)?

What's sure if that you can have conditions based on tags, and things in the
following spirit::

--8<---------------cut here---------------start------------->8---
* Global constants

#+tblname: params
| Variable           | dev | stg | prd |
|--------------------+-----+-----+-----|
| webServerName      | a   | g   | m   |
| loginWebServerName | b   | h   | n   |
| pwWebServerName    | c   | i   | o   |
| appBaseDir         | d   | j   | p   |
| dbName             | e   | k   | q   |
| dbBackupFile       | f   | l   | r   |

* Show the params                                                        :dev:

Params are "dynamically" assigned. Here the results with the "dev" tag:

#+begin_src sh :rownames no :var data=(concat (car (org-get-tags-at (point))) 
"-params") :exports both
echo $data
#+end_src
--8<---------------cut here---------------end--------------->8---

Please tell if that's more or less the direction you want to take...

Best regards,
  Seb

-- 
Sebastien Vauban




reply via email to

[Prev in Thread] Current Thread [Next in Thread]