From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brad Knotwell Subject: resend of a patch for ob-lua.el Date: Tue, 22 Jan 2019 06:42:05 +0000 (UTC) Message-ID: <1530980378.1568524.1548139325432@mail.yahoo.com> References: <1530980378.1568524.1548139325432.ref@mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1568523_2019525770.1548139325430" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:53723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1glplF-00016i-Nt for emacs-orgmode@gnu.org; Tue, 22 Jan 2019 01:42:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1glplE-0007Xb-Tf for emacs-orgmode@gnu.org; Tue, 22 Jan 2019 01:42:13 -0500 Received: from sonic317-22.consmr.mail.gq1.yahoo.com ([98.137.66.148]:41440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1glplE-0007VM-NB for emacs-orgmode@gnu.org; Tue, 22 Jan 2019 01:42:12 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org-mode ------=_Part_1568523_2019525770.1548139325430 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable It looks like my original patch was never integrated. =C2=A0The code below = makes tangling multi-line variable work by using Lua's multi-line string sy= ntax ([=3D[ ... ]=3D]) instead of the python-like but invalid """. Likewise, it doesn't change the single line behavior. Testing is pretty straightforward: =C2=A0pass a multi-line variable in as a= header argument, tangle the file and try to load it. =C2=A0Before =3D=3D s= yntax error and after =3D=3D code loads and runs. Thx. --Brad diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el index 6b438b4f9..70d328ecf 100644 --- a/lisp/ob-lua.el +++ b/lisp/ob-lua.el @@ -148,7 +148,7 @@ specifying a variable of the same value." =C2=A0=C2=A0 =C2=A0 (if (eq var 'hline) =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 org-babel-lua-hline-to =C2=A0=C2=A0 =C2=A0 =C2=A0 (format - =C2=A0 =C2=A0 =C2=A0 (if (and (stringp var) (string-match "[\n\r]" var)) = "\"\"%S\"\"" "%S") + =C2=A0 =C2=A0 =C2=A0 (if (and (stringp var) (string-match "[\n\r]" var)) = "[=3D[%s]=3D]" "%S") =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (stringp var) (substring-no-properties var)= var))))) =C2=A0 =C2=A0(defun org-babel-lua-table-or-string (results) ------=_Part_1568523_2019525770.1548139325430 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
It looks like my original patch was never integrated.  The code below makes tangling multi-line variable work by using Lua's multi-line string syntax ([=[ ... ]=]) instead of the python-like but invalid """.

Likewise, it doesn't change the single line behavior.

Testing is pretty straightforward:  pass a multi-line variable in as a header argument, tangle the file and try to load it.  Before == syntax error and after == code loads and runs.

Thx.

--Brad

diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el

index 6b438b4f9..70d328ecf 100644

--- a/lisp/ob-lua.el

+++ b/lisp/ob-lua.el

@@ -148,7 +148,7 @@ specifying a variable of the same value."

     (if (eq var 'hline)

         org-babel-lua-hline-to

       (format

-       (if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")

+       (if (and (stringp var) (string-match "[\n\r]" var)) "[=[%s]=]" "%S")

        (if (stringp var) (substring-no-properties var) var)))))

 

 (defun org-babel-lua-table-or-string (results)


------=_Part_1568523_2019525770.1548139325430--