summaryrefslogtreecommitdiff
path: root/lisp/ob-js.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ob-js.el')
-rw-r--r--lisp/ob-js.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/ob-js.el b/lisp/ob-js.el
index 7789449..e126787 100644
--- a/lisp/ob-js.el
+++ b/lisp/ob-js.el
@@ -97,14 +97,15 @@ This function is called by `org-babel-execute-src-block'"
If RESULTS look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
(org-babel-read
- (if (and (stringp results) (string-match "^\\[.+\\]$" results))
+ (if (and (stringp results) (string-match "^\\[[^\000]+\\]$" results))
(org-babel-read
(concat "'"
(replace-regexp-in-string
"\\[" "(" (replace-regexp-in-string
"\\]" ")" (replace-regexp-in-string
- ", " " " (replace-regexp-in-string
- "'" "\"" results))))))
+ ",[[:space:]]" " "
+ (replace-regexp-in-string
+ "'" "\"" results))))))
results)))
(defun org-babel-js-var-to-js (var)
@@ -113,7 +114,7 @@ Convert an elisp value into a string of js source code
specifying a variable of the same value."
(if (listp var)
(concat "[" (mapconcat #'org-babel-js-var-to-js var ", ") "]")
- (format "%S" var)))
+ (replace-regexp-in-string "\n" "\\\\n" (format "%S" var))))
(defun org-babel-prep-session:js (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."