emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tangling org file with nested org source block
@ 2017-09-28  2:49 Thibault Marin
  2017-10-21  4:05 ` Thibault Marin
  0 siblings, 1 reply; 3+ messages in thread
From: Thibault Marin @ 2017-09-28  2:49 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-22 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-28  2:49 Tangling org file with nested org source block Thibault Marin
2017-10-21  4:05 ` Thibault Marin
2017-10-22 10:43   ` Nicolas Goaziou

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).