1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-10-18 02:19:46 +00:00

ob-lua: Escape double quote characters in results

* lisp/ob-lua.el (org-babel-lua-wrapper-method): Escape all double
quote characters in Lua before giving them to Org Babel.
* testing/lisp/test-ob-lua.el (test-ob-lua/escaping-quotes): Test
automatic escaping of double quote characters.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://list.orgmode.org/216278dc-075c-47d1-94dc-f5bde8346b3c@gmail.com/
This commit is contained in:
Rudolf Adamkovič 2024-06-14 16:55:24 +02:00 committed by Ihor Radchenko
parent 73da6beb50
commit 3ccc1ca6ec
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 7 additions and 1 deletions

View File

@ -283,7 +283,7 @@ function dump(it, indent)
end
return result
else
return tostring(it)
return string.gsub(tostring(it), '\"', '\\\"')
end
end

View File

@ -176,6 +176,12 @@ return x
(org-test-with-temp-text "src_lua{return 1, 2, 3}"
(org-babel-execute-src-block))))))
(ert-deftest test-ob-lua/escaping-quotes ()
(should
(equal "A \" B"
(org-test-with-temp-text "src_lua{return 'A \" B'}"
(org-babel-execute-src-block)))))
(provide 'test-ob-lua)
;;; test-ob-lua.el ends here