Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Ihor Radchenko
Rudolf Adamkovič writes: > Max Nikulin writes: > >> On 30/04/2024 03:26, Rudolf Adamkovič wrote: >>> +local value = result[1] >>> +if string.find(value, '[%%(%%[{]') == 1 then >>> + return quotes .. value .. quotes >> >> Am I wrong that quotes in value may cause issues? I expect

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Rudolf Adamkovič writes: > I am attaching a V2 of the patch that: Oops, I forgot to attach the patch. Here it is. :) Rudy >From b4d61bf511df74094fbcdf13c8c0c2b57b1e4a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Mon, 29 Apr 2024 21:42:04 +0200 Subject: [PATCH]

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Max Nikulin writes: > On 30/04/2024 03:26, Rudolf Adamkovič wrote: >> +local value = result[1] >> +if string.find(value, '[%%(%%[{]') == 1 then >> + return quotes .. value .. quotes > > Am I wrong that quotes in value may cause issues? I expect some way of > escaping " characters.

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Ihor Radchenko writes: > May you please elaborate why this breaking change is going to lead to > significant improvement? How is using "," worse than using "|"? Either > way, strings containing the separator will become problematic and need > to be escaped. Moreover, using "|" may lead to

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-02 Thread Rudolf Adamkovič
Ihor Radchenko writes: > May you please elaborate why this breaking change is going to lead to > significant improvement? How is using "," worse than using "|"? Either > way, strings containing the separator will become problematic and need > to be escaped. Moreover, using "|" may lead to

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-05-01 Thread Max Nikulin
On 30/04/2024 03:26, Rudolf Adamkovič wrote: +local value = result[1] +if string.find(value, '[%%(%%[{]') == 1 then + return quotes .. value .. quotes Am I wrong that quotes in value may cause issues? I expect some way of escaping " characters.

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-30 Thread Ihor Radchenko
Rudolf Adamkovič writes: > Rudolf Adamkovič writes: > >> Definitely! I am on it. Thanks! > All right, how about the attached patch? > ... > * lisp/ob-lua.el (org-babel-lua-multiple-values-separator): Change the > default value from ", " to "|" to avoid '\\,' appearing in strings. May you

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-29 Thread Rudolf Adamkovič
Rudolf Adamkovič writes: > Definitely! I am on it. All right, how about the attached patch? Rudy >From 40270bc62f951cfd20916c17e2dfc52863d6b8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Mon, 29 Apr 2024 21:42:04 +0200 Subject: [PATCH] ob-lua: Quote list-like

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-29 Thread Rudolf Adamkovič
Ihor Radchenko writes: >> We need *better tests*, otherwise all this is kind of useless. >> >> I will hack on this some more... > > Will you be willing to provide some? Definitely! I am on it. Rudy -- "Genius is 1% inspiration and 99% perspiration." --- Thomas Alva Edison, 1932 Rudolf

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-28 Thread Ihor Radchenko
Rudolf Adamkovič writes: > ... > We need *better tests*, otherwise all this is kind of useless. > > I will hack on this some more... Will you be willing to provide some? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-27 Thread Rudolf Adamkovič
Ihor Radchenko writes: > Maybe something like the attached. Nice: src_elisp{"foo"} {{{results(=foo=)}}} src_python{return "foo"} {{{results(=foo=)}}} src_lua{return "foo"} {{{results(=foo=)}}} That said, I have just noticed: # expected: a, b, c src_lua{return "a", "b", "c"}

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-27 Thread Max Nikulin
On 26/04/2024 20:40, Ihor Radchenko wrote: +++ b/lisp/ob-lua.el @@ -282,6 +282,8 @@ (defvar org-babel-lua-wrapper-method end end return result + elseif type(it) == 'string' then + return '\"' .. it .. '\"' If you are adding quotes around then quote characters

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-26 Thread Ihor Radchenko
Rudolf Adamkovič writes: > Ihor Radchenko writes: > >> May you create a test for this with expected failure? > > Sure! Here is one: > > (should >(equal "{B}" > (org-test-with-temp-text > "src_lua{return string.match('A {B} C', '%b{}')}" >

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-24 Thread Rudolf Adamkovič
Ihor Radchenko writes: > May you create a test for this with expected failure? Sure! Here is one: (should (equal "{B}" (org-test-with-temp-text "src_lua{return string.match('A {B} C', '%b{}')}" (org-babel-execute-src-block The return value from

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-24 Thread Ihor Radchenko
Rudolf Adamkovič writes: > P.S. #1 > > We still have an old bug where > > src_lua{return string.match("A {B} C", "%b{}")} > > is misjudged to be a table: > > org-babel-insert-result: Inline error: list result cannot be used May you create a test for this with expected failure? > P.S. #2 >

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-24 Thread Ihor Radchenko
Rudolf Adamkovič writes: > * etc/ORG-NEWS > (New and changed options): Describe the new option > 'org-babel-lua-multiple-values-separator'. > (New features): Describe the main change, as per the title of this > commit message. Thanks! Applied, onto main, after removing redundant :version

Re: [PATCH] ob-lua: Support all types and multiple values in results

2024-04-23 Thread Rudolf Adamkovič
Rudolf Adamkovič writes: > +Lua code blocks can now return values of any type and can also return > +multiple values. Previously, values of certain types were incorrectly > +converted to the empty string =""=, which broke HTML export for inline > +code blocks, and multiple values were

[PATCH] ob-lua: Support all types and multiple values in results

2024-04-23 Thread Rudolf Adamkovič
* etc/ORG-NEWS (New and changed options): Describe the new option 'org-babel-lua-multiple-values-separator'. (New features): Describe the main change, as per the title of this commit message. * lisp/ob-lua.el (org-babel-lua-multiple-values-separator): Enable the user to customize the string that