Browse Source

[BUG FIX] DONE problem with newlines in output when :results value

Eric Schulte 16 years ago
parent
commit
d07c2f3b5c
2 changed files with 21 additions and 4 deletions
  1. 2 1
      lisp/org-babel.el
  2. 19 3
      org-babel.org

+ 2 - 1
lisp/org-babel.el

@@ -668,7 +668,8 @@ This is taken almost directly from `org-read-prop'."
 
 (defun org-babel-number-p (string)
   "Return t if STRING represents a number"
-  (if (string-match "^[[:digit:]]*\\.?[[:digit:]]*$" string)
+  (if (and (string-match "^[[:digit:]]*\\.?[[:digit:]]*$" string)
+           (= (match-end 0) (length string)))
       (string-to-number string)))
 
 (defun org-babel-import-elisp-from-file (file-name)

+ 19 - 3
org-babel.org

@@ -2819,7 +2819,7 @@ dot("$(2a,0)$",(2,0),N+E);
 *** DONE sh
 
 
-* Bugs [34/41]
+* Bugs [35/41]
 ** TODO Python session evaluation bug
    The following block evaluates correctly with :session none
    (set :results to output), but fails with session-based evaluation
@@ -2915,7 +2915,7 @@ I have this error showing up:
 executing Ruby source code block
 apply: Searching for program: no such file or directory, irb
 
-** TODO problem with newlines in output when :results value
+** DONE problem with newlines in output when :results value
 
 #+begin_src python :results value
 '\n'.join(map(str, range(4)))
@@ -2923,7 +2923,9 @@ apply: Searching for program: no such file or directory, irb
 
 #+resname:
 : 0
-
+: 1
+: 2
+: 3
 
 Whereas I was hoping for
 
@@ -2932,6 +2934,20 @@ Whereas I was hoping for
 | 2 |
 | 3 |
 
+This is now working, it doesn't return as a table because the value
+returned is technically a string.  To return the table mentioned above
+try something like the following.
+
+#+begin_src python
+[[0], [1], [2], [3]]
+#+end_src
+
+#+resname:
+| 0 |
+| 1 |
+| 2 |
+| 3 |
+
 This is some sort of non-printing char / quoting issue I think. Note
 that