summaryrefslogtreecommitdiff
path: root/macros/generic
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-10-25 03:01:19 +0000
committerNorbert Preining <norbert@preining.info>2022-10-25 03:01:19 +0000
commit170c76072a2b68eeeb23fa4a9e3dfbdee131e29c (patch)
tree938d306578d616ae5f01f09a49fb3e102fed8f8c /macros/generic
parent74697976d2ffe935077542593ccbb18a00603251 (diff)
CTAN sync 202210250301
Diffstat (limited to 'macros/generic')
-rw-r--r--macros/generic/lt3luabridge/lt3luabridge.dtx43
-rw-r--r--macros/generic/lt3luabridge/lt3luabridge.pdfbin492628 -> 494475 bytes
2 files changed, 27 insertions, 16 deletions
diff --git a/macros/generic/lt3luabridge/lt3luabridge.dtx b/macros/generic/lt3luabridge/lt3luabridge.dtx
index c7d7cc3508..3b9c483ba8 100644
--- a/macros/generic/lt3luabridge/lt3luabridge.dtx
+++ b/macros/generic/lt3luabridge/lt3luabridge.dtx
@@ -47,7 +47,7 @@
% }^^A
% }
%
-% \date{Released 2022-08-16}
+% \date{Released 2022-10-24}
%
% \maketitle
%
@@ -267,7 +267,7 @@
{
\str_new:N
\g_luabridge_output_dirname_str
- \tl_gset:Nn
+ \str_gset_eq:NN
\g_luabridge_output_dirname_str
\c_luabridge_default_output_dirname_str
}
@@ -295,17 +295,27 @@
{ luabridge }
{ writing-helper-script }
\g_luabridge_helper_script_filename_str
- \tl_set:Nn
+% \end{macrocode}
+%
+% Escape |"| and |\| in the Lua code, so that we can represent it as a
+% double-quoted string that we can pass into the |load()| Lua built-in
+% and fail gracefully if the Lua code fails to compile.
+%
+% \begin{macrocode}
+ \tl_set:Nx
+ \l_tmpa_tl
+ { \tl_to_str:n { #1 } }
+ \regex_replace_all:nnN
+ { [\\"] }
+ { \\\0 }
\l_tmpa_tl
- { #1 }
\tl_set:Nx
- \l_tmpb_tl
+ \l_tmpa_tl
{
- local~ran_ok, error = pcall(function()
+ local~ran_ok, err = pcall(function()
local~ran_ok, kpse = pcall(require,~"kpse")
if~ran_ok~then~kpse.set_program_name("luatex") end~
- \exp_not:V \l_tmpa_tl
- \iow_newline:
+ assert(load(" \exp_not:V \l_tmpa_tl "))()
end)
if~not~ran_ok~then~
local~file = io.open("
@@ -313,13 +323,14 @@
\g_luabridge_error_output_filename_str
", "w")
if~file~then~
- file:write(error .. " \iow_char:N \\ n ")
+ file:write(err .. " \iow_char:N \\ n ")
file:close()
end~
print('
\iow_char:N \\ \iow_char:N \\ begingroup
\iow_char:N \\ \iow_char:N \\ ExplSyntaxOn
- \iow_char:N \\ \iow_char:N \\ msg_error:nnvv
+ \iow_char:N \\ \iow_char:N \\ csname~
+ msg_error:nnvv\iow_char:N \\ \iow_char:N \\ endcsname
{ luabridge }
{ failed-to-execute }
{ g_luabridge_output_dirname_str }
@@ -330,7 +341,7 @@
}
\iow_now:NV
\g_tmpa_iow
- \l_tmpb_tl
+ \l_tmpa_tl
\iow_close:N
\g_tmpa_iow
\msg_info:nnV
@@ -389,7 +400,7 @@
An~error~was~encountered~while~executing~Lua~code
}
{
- For further clues, examine file #1 / #2
+ For~further~clues,~examine~file~#1 / #2
}
\msg_new:nnnn
{ luabridge }
@@ -415,7 +426,7 @@
\l_tmpa_tl
{ #1 }
\tl_set:Nx
- \l_tmpb_tl
+ \l_tmpa_tl
{
_ENV = setmetatable({}, {__index = _ENV})
local~function~print(input)
@@ -432,7 +443,7 @@
\exp_not:V \l_tmpa_tl
}
\lua_now:V
- \l_tmpb_tl
+ \l_tmpa_tl
}
\cs_generate_variant:Nn
\lua_now:n
@@ -461,8 +472,8 @@
\RequirePackage{expl3}
\ProvidesExplPackage
{lt3luabridge}%
- {2022-08-16}%
- {2.0.1}%
+ {2022-10-24}%
+ {2.0.2}%
{An expl3 package that allows you to execute Lua code in LuaTeX or any other
TeX engine that exposes the shell}
\input lt3luabridge\relax
diff --git a/macros/generic/lt3luabridge/lt3luabridge.pdf b/macros/generic/lt3luabridge/lt3luabridge.pdf
index a282009843..79d59210e7 100644
--- a/macros/generic/lt3luabridge/lt3luabridge.pdf
+++ b/macros/generic/lt3luabridge/lt3luabridge.pdf
Binary files differ