summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-07-14 11:31:38 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-07-14 11:34:30 -0700
commitf904376df4d6e295ce5185f7f01fc76a4a1d4935 (patch)
tree951c9d919fae5fcdc313ba0e569cbcaf111b3021
parente3af061f90bf471a782f6ba7e1efc33447a6c0ac (diff)
downloadorg-mode-f904376df4d6e295ce5185f7f01fc76a4a1d4935.tar.gz
ob-python: can now handle variable strings with newlines
* lisp/ob-python.el (org-babel-python-var-to-python): python can now handle input strings with newlines
-rw-r--r--lisp/ob-python.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 8d2a3b4..1be8a33 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -110,7 +110,11 @@ Convert an elisp value, VAR, into a string of python source code
specifying a variable of the same value."
(if (listp var)
(concat "[" (mapconcat #'org-babel-python-var-to-python var ", ") "]")
- (if (equal var 'hline) "None" (format "%S" var))))
+ (if (equal var 'hline)
+ "None"
+ (format
+ (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
+ var))))
(defun org-babel-python-table-or-string (results)
"Convert RESULTS into an appropriate elisp value.