فهرست منبع

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
Eric Schulte 14 سال پیش
والد
کامیت
8217e8102e
1فایلهای تغییر یافته به همراه7 افزوده شده و 5 حذف شده
  1. 7 5
      lisp/babel/langs/ob-python.el

+ 7 - 5
lisp/babel/langs/ob-python.el

@@ -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))