diff options
-rw-r--r-- | Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf | bin | 492628 -> 494475 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx | 43 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex | 30 |
4 files changed, 46 insertions, 31 deletions
diff --git a/Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf b/Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf Binary files differindex a282009843b..79d59210e7a 100644 --- a/Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf +++ b/Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf diff --git a/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx b/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx index c7d7cc35081..3b9c483ba8f 100644 --- a/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx +++ b/Master/texmf-dist/source/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/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty b/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty index 3613b101af2..0d64a58a9be 100644 --- a/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty +++ b/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty @@ -45,8 +45,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/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex b/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex index 05255e19410..f9867e41cd6 100644 --- a/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex +++ b/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex @@ -131,7 +131,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 } @@ -159,17 +159,20 @@ { luabridge } { writing-helper-script } \g_luabridge_helper_script_filename_str - \tl_set:Nn + \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(" @@ -177,13 +180,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 } @@ -194,7 +198,7 @@ } \iow_now:NV \g_tmpa_iow - \l_tmpb_tl + \l_tmpa_tl \iow_close:N \g_tmpa_iow \msg_info:nnV @@ -253,7 +257,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 } @@ -279,7 +283,7 @@ \l_tmpa_tl { #1 } \tl_set:Nx - \l_tmpb_tl + \l_tmpa_tl { _ENV = setmetatable({}, {__index = _ENV}) local~function~print(input) @@ -296,7 +300,7 @@ \exp_not:V \l_tmpa_tl } \lua_now:V - \l_tmpb_tl + \l_tmpa_tl } \cs_generate_variant:Nn \lua_now:n |