From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: how to quote "#+end_src" string in a Babel block? Date: Wed, 24 Jul 2013 09:24:52 +0200 Message-ID: <8738r4773v.fsf@gmail.com> References: <65A347E6-F361-4410-93B6-CEA910195E7E@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1tRC-0000u7-IR for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 03:24:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1tRB-0003sZ-Aq for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 03:24:42 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:59493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1tRB-0003rw-4u for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 03:24:41 -0400 Received: by mail-wi0-f170.google.com with SMTP id ey16so4735316wid.1 for ; Wed, 24 Jul 2013 00:24:40 -0700 (PDT) In-Reply-To: <65A347E6-F361-4410-93B6-CEA910195E7E@gmail.com> (asenal's message of "Wed, 24 Jul 2013 13:39:13 +0800") 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: asenal Cc: emacs-orgmode@gnu.org Hello, asenal writes: > My problem is How can I safely quote "#+XXX" inside a Babel-block? > I found org-mode mismatch the outter "#+begin_src" with the first "#+end_src" inside the block hence gives me a wrong parse. > > Here's an example: > #+headers: :var varlist=top_iv > #+begin_src python :return iv_template(varlist) > def iv_template(varlist,db,table): > for var in varlist: > babel_template=''' > #+name: var > #+begin_src sqlite :db mydb > SELECT colName,cnt,suc,fal,iv FROM mytable WHERE colName == %s'; > #+end_src # org mode stop here! > ''' % (var,var) > > print babel_template > #+end_src Within a source block, you must prepend a comma to every line starting with "*" or "#+". C-c ' will do that for you. Regards, -- Nicolas Goaziou