From: asenal <asenalhere@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>,
Nicolas Goaziou <n.goaziou@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: how to quote "#+end_src" string in a Babel block?
Date: Thu, 15 Aug 2013 19:38:04 +0800 [thread overview]
Message-ID: <00C1CBC2-D98F-45A5-8358-67ADF04FBFB1@gmail.com> (raw)
In-Reply-To: <87siz3oaa3.fsf@gmail.com>
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 <schulte.eric@gmail.com> wrote:
> asenal <asenalhere@gmail.com> 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 parent reply other threads:[~2013-08-15 11:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 5:39 how to quote "#+end_src" string in a Babel block? asenal
2013-07-24 6:11 ` Thorsten Jolitz
2013-07-24 7:24 ` Nicolas Goaziou
2013-07-24 22:32 ` Eric Schulte
2013-08-15 11:38 ` asenal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00C1CBC2-D98F-45A5-8358-67ADF04FBFB1@gmail.com \
--to=asenalhere@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=n.goaziou@gmail.com \
--cc=schulte.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).