emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] how to quote "#+end_src" string in a Babel block?


From: Thorsten Jolitz
Subject: Re: [O] how to quote "#+end_src" string in a Babel block?
Date: Wed, 24 Jul 2013 08:11:19 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

asenal <address@hidden> 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




reply via email to

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