Max Nikulin <maniku...@gmail.com> writes:

> On 29/04/2024 18:58, Ihor Radchenko wrote:
>> 
>> The nested "..." are stripped on purpose via `org-babel-string-read'.
>> Although this function dates back to R output processing and I do not
>> fully understand why stripping nested quotes is useful for all possible
>> babel backends. But that's a completely different story.
>
> I would say heuristics is quite fragile
>
> #+begin_src elisp :results verbatim
>    (org-babel-string-read "\"1 2\" 3 \"4 5\"")
> #+end_src
>
> #+RESULTS:
> : "1 2\" 3 \"4 5"
>
> Leading and trailing quote characters are not stripped in the case of
>
> #+begin_src elisp :results verbatim
>    (org-babel-read "\"1 2\" 3 \"4 5\"" t)
> #+end_src

Let's zoom out a bit.

`org-babel-string-read' is used exclusively by 
`org-babel-import-elisp-from-file'

Its effect is making the following tables look same for Org babel:

| 1 | 2 |
| 1 | 2 |

| "1" | "2" |
|  1  |  2  |

I cannot find justification - this behavior has been introduced in ob-R
from the very beginning (over 15 years ago) and then ported to ob-core.

IMHO, the current behavior is not correct. Moreover, it is unexpected.

Consider

#+begin_src C :results output table :includes <stdio.h>
printf("1 2\n\"1\" \"2\"");
#+end_src

#+RESULTS[30c03a8e3f8a71e03d7892e6817cb45713bec424]:
| 1 | 2 |
| 1 | 2 |

Why are the quotes dropped?

And replacing the call to org-babel-string-read with org-babel-read does not
break any tests...

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to