emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: how to quote "#+end_src" string in a Babel block?
Date: Wed, 24 Jul 2013 08:11:19 +0200	[thread overview]
Message-ID: <8761w0jxmg.fsf@gmail.com> (raw)
In-Reply-To: 65A347E6-F361-4410-93B6-CEA910195E7E@gmail.com

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.

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	other threads:[~2013-07-24  6:11 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 [this message]
2013-07-24  7:24 ` Nicolas Goaziou
2013-07-24 22:32 ` Eric Schulte
2013-08-15 11:38   ` asenal

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=8761w0jxmg.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).