소스 검색

babel: python: Fix recognition of lists and tuples

2010-08-03  Dan Davison  <davison@stats.ox.ac.uk>

    * ob-python.el (org-babel-python-table-or-string): Fix
    recognition of lists and tuples

Prior to this we had

 #+begin_src python
   return [1, 2]
 #+end_src

 #+results:
 : [1, 2]
Dan Davison 14 년 전
부모
커밋
1239099120
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 4
      lisp/ob-python.el

+ 1 - 4
lisp/ob-python.el

@@ -125,10 +125,7 @@ Emacs-lisp table, otherwise return the results as a string."
 	 (mapcar (lambda (el) (if (equal el 'None) 'hline el)) res)
        res))
    (org-babel-read
-    (if (or (and (equal (substring results 0 1) "[")
-		 (equal (substring results -2 -1) "]"))
-	    (and (equal (substring results 0 1) "(")
-		 (equal (substring results -2 -1) ")")))
+    (if (and (stringp results) (string-match "^[([].+[])]$" results))
        (org-babel-read
         (concat "'"
                 (replace-regexp-in-string