emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thibault Marin <thibault.marin@gmx.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Tangling org file with nested org source block
Date: Wed, 27 Sep 2017 21:49:49 -0500	[thread overview]
Message-ID: <87ing3h702.fsf@dell-desktop.WORKGROUP> (raw)


Hi list,

I am trying to tangle the following org file:

,----
| #+PROPERTY: header-args :tangle output.org
| 
| #+BEGIN_SRC org
| 
| ,* Test
| 
| ,#+BEGIN_SRC org
| ,,#+BEGIN_SRC emacs-lisp
| '(1 2 3)
| ,,#+END_SRC
| ,#+END_SRC
| 
| #+END_SRC
`----

(note the double commas at the beginning of the inner-most block).
I am working on master (Org mode version 9.1.1 (release_9.1.1-79-g731e1c.dirty @
.../org-mode/lisp/)), and I get the following:

,---- output.org
| * Test
| 
| #+BEGIN_SRC org
| #+BEGIN_SRC emacs-lisp
| '(1 2 3)
| #+END_SRC
| #+END_SRC
`----

The inner block does not get escaped which causes issues when exporting.  Trying
to investigate this, I ended up in the ~org-babel-tangle-single-block~ function
in =ob-tangle.el=.  The second comma is removed by a call to
~org-unescape-code-in-string~ (l. 497).  Since the incoming string has already
been cleaned-up (i.e. the first comma removed) at that point I wonder why this
call is necessary.  When I remove that call to ~org-unescape-code-in-string~,
tangling produces the output I expect:

,---- output.org
| * Test
| 
| #+BEGIN_SRC org
| ,#+BEGIN_SRC emacs-lisp
| '(1 2 3)
| ,#+END_SRC
| #+END_SRC
`----

where the inner source block is properly escaped.

So, is the call to ~org-unescape-code-in-string~ required?  Does anyone know if
there is a way to get the desired output?

Thanks in advance,
thibault

             reply	other threads:[~2017-09-28  2:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28  2:49 Thibault Marin [this message]
2017-10-21  4:05 ` Tangling org file with nested org source block Thibault Marin
2017-10-22 10:43   ` Nicolas Goaziou

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=87ing3h702.fsf@dell-desktop.WORKGROUP \
    --to=thibault.marin@gmx.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).