Browse Source

ob-sh: can now handle variable strings which contain newlines

* lisp/ob-sh.el (org-babel-sh-var-to-sh): shell can now handle input
  strings which contain newlines
Eric Schulte 14 years ago
parent
commit
57bfa1989d
1 changed files with 5 additions and 1 deletions
  1. 5 1
      lisp/ob-sh.el

+ 5 - 1
lisp/ob-sh.el

@@ -113,7 +113,11 @@ var of the same value."
 	(format "$(cat <<BABEL_TABLE\n%s\nBABEL_TABLE\n)"
 		(orgtbl-to-generic
 		 (deep-string var) (list :sep (or sep "\t")))))
-    (if (stringp var) (format "%s" var) (format "%S" var))))
+    (if (stringp var)
+	(if (string-match "[\n\r]" var)
+	    (format "$(cat <<BABEL_STRING\n%s\nBABEL_STRING\n)" var)
+	  (format "%s" var))
+      (format "%S" var))))
 
 (defun org-babel-sh-table-or-results (results)
   "Convert RESULTS to an appropriate elisp value.