From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: how to quote "#+end_src" string in a Babel block? Date: Wed, 24 Jul 2013 08:11:19 +0200 Message-ID: <8761w0jxmg.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]:54145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1sIR-0003Rp-Un for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 02:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1sIR-0002Dy-2r for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 02:11:35 -0400 Received: from plane.gmane.org ([80.91.229.3]:41420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1sIQ-0002Do-TG for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 02:11:35 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V1sIP-0001HK-Aw for emacs-orgmode@gnu.org; Wed, 24 Jul 2013 08:11:33 +0200 Received: from e178188051.adsl.alicedsl.de ([85.178.188.51]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Jul 2013 08:11:33 +0200 Received: from tjolitz by e178188051.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Jul 2013 08:11:33 +0200 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 asenal writes: > 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. > > 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 > > I know it looks twisted,but what I really care is wheather org-mode > holds the capability to do so. I don't know Python, but maybe you could do something like this #+begin_src emacs-lisp :results value (concat (format "%s%s %s\n\n" "\#+" "begin_src" "python") (format "%s%s" "\#+" "end_src")) #+end_src #+results: : #+begin_src python : : #+end_src -- cheers, Thorsten