From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Fran=C3=A7ois_Pinard?= Subject: Seeking advice for conditional code Date: Thu, 31 Jan 2013 12:09:34 -0500 Message-ID: <86lib96zzl.fsf@iro.umontreal.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0xds-0006L4-BP for emacs-orgmode@gnu.org; Thu, 31 Jan 2013 12:09:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0xdn-0002XE-PU for emacs-orgmode@gnu.org; Thu, 31 Jan 2013 12:09:40 -0500 Received: from bureau.ubity.com ([64.254.249.42]:36182 helo=mercure.bureau.ubity.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0xdn-0002Wt-Lk for emacs-orgmode@gnu.org; Thu, 31 Jan 2013 12:09:35 -0500 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: emacs-orgmode@gnu.org Hi, Org friends. 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. The use case is a piece of Python code implementing an API interface, for which items are implemented through functions (methods). These functions each have a doc-string, using Org, documenting that item. Now, there are API items which we publish for our users, and other API items which are rather internal and which we would not document externally. I would much prefer keeping a single source, and generate different documentation for the external site and the internal site. Currently, I use poporg (https://github.com/pinard/poporg) to edit these doc-strings, and a small program which reads and concatenate them all. This program already recognizes #+FILE: (not Org standard) to drive the splitting of the resulting Org document into many files, each of which will end up being an HTML page. The first idea which comes to my mind is adding #+IF: #+ELIF: #+ELSE #+ENDIF directives for that program to recognize as well. But if possible, I would much prefer to stick to known and standard Org paradigms than inventing my own, and this is why I'm asking here... Keep happy, all! Fran=C3=A7ois