forked from mirrors/org-mode
babel: python is more selective about None->hline replacement
thanks to Christopher Allan Webber for catching this * lisp/babel/langs/ob-python.el (org-babel-python-table-or-string): now more careful not to replace "None"s which are not isolated portions of lists
This commit is contained in:
parent
5461d3e605
commit
8217e8102e
|
@ -101,7 +101,11 @@ specifying a var of the same value."
|
|||
(defun org-babel-python-table-or-string (results)
|
||||
"If the results look like a list or tuple, then convert them into an
|
||||
Emacs-lisp table, otherwise return the results as a string."
|
||||
(org-babel-read
|
||||
((lambda (res)
|
||||
(if (listp res)
|
||||
(mapcar (lambda (el) (if (equal el 'None) 'hline el)) res)
|
||||
res))
|
||||
(org-babel-read
|
||||
(if (or (string-match "^\\[.+\\]$" results)
|
||||
(string-match "^(.+)$" results))
|
||||
(org-babel-read
|
||||
|
@ -110,10 +114,8 @@ Emacs-lisp table, otherwise return the results as a string."
|
|||
"\\[" "(" (replace-regexp-in-string
|
||||
"\\]" ")" (replace-regexp-in-string
|
||||
", " " " (replace-regexp-in-string
|
||||
"'" "\""
|
||||
(replace-regexp-in-string
|
||||
"None" "hline" results t)))))))
|
||||
results)))
|
||||
"'" "\"" results t))))))
|
||||
results))))
|
||||
|
||||
(defvar org-babel-python-buffers '(:default . nil))
|
||||
|
||||
|
|
Loading…
Reference in New Issue