From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Peter Moresi <peter.moresi@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Issue with multiline string variable for JavaScript source code blocks
Date: Sat, 22 Nov 2014 00:07:47 +0100 [thread overview]
Message-ID: <87wq6o40fw.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAK_Lq028E1wYfGgOHmPRmu4SdpJf+8azMKRK-pGVryoXoTof5g@mail.gmail.com> (Peter Moresi's message of "Tue, 18 Nov 2014 16:04:25 -0800")
Hello,
Peter Moresi <peter.moresi@gmail.com> writes:
> Sure, the patch is attached.
Applied. Thank you.
However I had to fill your commit message, which was incomplete. For
reference, here is what I used, from your initial report:
--8<---------------cut here---------------start------------->8---
ob-js: Fix passing multiline variables
* lisp/ob-js.el (org-babel-js-var-to-js): Replace newline characters
with "\n" in strings.
Let's say I have a multi-line string stored in an example block.
I want to store my CSV in an example block.
#+NAME: my-csv-data
#+BEGIN_EXAMPLE
ColA,ColB,ColC
1,2,3
4,5,6
#+END_EXAMPLE
I have a JavaScript function that accepts a string named 'csv' and passing in 'my-csv-data'.
#+BEGIN_SRC js :var csv=my-csv-data :results output
console.log(csv);
#+END_SRC
When I expand the source block I end up with:
#+BEGIN_SRC js
var csv="ColA,ColB,ColC
1,2,3
4,5,6";
console.log(csv);
#+END_SRC
This will not execute correctly because JavaScript does not support newlines in strings.
What I want instead is:
#+BEGIN_SRC js
var csv="ColA,ColB,ColC\n 1,2,3\n 4,5,6";
console.log(csv);
#+END_SRC
TINYCHANGE
--8<---------------cut here---------------end--------------->8---
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2014-11-21 23:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 20:44 Issue with multiline string variable for JavaScript source code blocks Peter Moresi
2014-11-18 21:30 ` Nicolas Goaziou
2014-11-19 0:04 ` Peter Moresi
2014-11-21 23:07 ` Nicolas Goaziou [this message]
2014-11-22 0:12 ` Peter Moresi
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wq6o40fw.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=peter.moresi@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.