emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Chaining strings between babel blocks: why so many '\'?
@ 2014-03-26 21:59 Alan Schmitt
  2014-03-26 22:19 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2014-03-26 21:59 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I've been playing with block chaining to generate some dot file then to
export then as images. I had a little trouble finding the number of '\'
I need to put in front of a quote if I want the quote to be quoted. Here
is a way to make it work:

--8<---------------cut here---------------start------------->8---
#+name: foo
#+begin_src emacs-lisp :exports none
"bar [label = \"\\\\\"test1\\\\\"\"]\nbaz [label = \"\\\\\"test2\\\\\"\"]"
#+end_src

#+results: foo
: bar [label = "\\"test1\\""]
: baz [label = "\\"test2\\""]

#+begin_src dot :file ~/tmp/test-dot.png :var input=foo :exports results
graph {
  $input
}
#+end_src
--8<---------------cut here---------------end--------------->8---

My question is: why can't I simply use this:

--8<---------------cut here---------------start------------->8---
#+name: foo
#+begin_src emacs-lisp :exports none
"bar [label = \"\\\"test1\\\"\"]\nbaz [label = \"\\\"test2\\\"\"]"
#+end_src

#+results: foo
: bar [label = "\"test1\""]
: baz [label = "\"test2\""]
--8<---------------cut here---------------end--------------->8---

(I guess the answer is in the error in replace-regexp-in-string:
(error "Invalid use of `\\' in replacement text")
.)

Would it be problematic to first transform every "\\" into a "\\\\" in
org-babel-expand-body:dot, before the call to replace-regexp-in-string?

Thanks,

Alan

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

end of thread, other threads:[~2014-04-16 18:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26 21:59 Chaining strings between babel blocks: why so many '\'? Alan Schmitt
2014-03-26 22:19 ` Nicolas Goaziou
2014-03-26 23:35   ` Peter Neilson
2014-03-27 12:41   ` Alan Schmitt
2014-03-29 11:10     ` Alan Schmitt
2014-04-16 15:37       ` Bastien
2014-04-16 18:01         ` Alan Schmitt

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