From mboxrd@z Thu Jan 1 00:00:00 1970 From: asenal Subject: Re: how to quote "#+end_src" string in a Babel block? Date: Thu, 15 Aug 2013 19:38:04 +0800 Message-ID: <00C1CBC2-D98F-45A5-8358-67ADF04FBFB1@gmail.com> References: <65A347E6-F361-4410-93B6-CEA910195E7E@gmail.com> <87siz3oaa3.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9vsp-0008HM-9h for emacs-orgmode@gnu.org; Thu, 15 Aug 2013 07:38:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9vsi-0002Qj-QL for emacs-orgmode@gnu.org; Thu, 15 Aug 2013 07:38:27 -0400 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]:34127) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9vsi-0002QM-JF for emacs-orgmode@gnu.org; Thu, 15 Aug 2013 07:38:20 -0400 Received: by mail-pb0-f53.google.com with SMTP id up15so623206pbc.26 for ; Thu, 15 Aug 2013 04:38:19 -0700 (PDT) In-Reply-To: <87siz3oaa3.fsf@gmail.com> 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: Eric Schulte , Nicolas Goaziou Cc: emacs-orgmode@gnu.org Thank for the answers . I'm glad to know ', ' is the right escaping character to quote = '#+babel_statement'. I apologize for answering so late. On Jul 25, 2013, at 6:32 AM, Eric Schulte = wrote: > asenal writes: >=20 >> Hi Guys I'm trying to do literature programming with org mode. >> 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. >>=20 >> Here's an example: >> #+headers: :var varlist=3Dtop_iv >> #+begin_src python :return iv_template(varlist) >> def iv_template(varlist,db,table): >> for var in varlist: >> babel_template=3D''' >> #+name: var >> #+begin_src sqlite :db mydb >> SELECT colName,cnt,suc,fal,iv FROM mytable WHERE colName =3D=3D= %s'; >> #+end_src # org mode stop here! >> ''' % (var,var) >>=20 >> print babel_template >> #+end_src >>=20 >> I know it looks twisted,but what I really care is wheather org-mode >> holds the capability to do so. >>=20 >=20 > The following syntax should work. If you edit code blocks with C-' = the > leading ' characters will be added and stripped automatically. >=20 > #+begin_src python :return iv_template(varlist) > def iv_template(varlist,db,table): > for var in varlist: > babel_template=3D''' > ,#+name: var > ,#+begin_src sqlite :db mydb > SELECT colName,cnt,suc,fal,iv FROM mytable WHERE colName =3D=3D = %s'; > ,#+end_src # org mode stop here! > ''' % (var,var) >=20 > print babel_template > #+end_src >=20 >=20 > --=20 > Eric Schulte > http://cs.unm.edu/~eschulte