[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: |
asenal |
Subject: |
Re: [O] how to quote "#+end_src" string in a Babel block? |
Date: |
Thu, 15 Aug 2013 19:38:04 +0800 |
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 <address@hidden> wrote:
> 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.
>>
>
> The following syntax should work. If you edit code blocks with C-' the
> leading ' characters will be added and stripped automatically.
>
> #+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
>
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [O] how to quote "#+end_src" string in a Babel block?,
asenal <=