texlive[64801] Master/texmf-dist: lt3luabridge (24oct22)

commits+karl at tug.org commits+karl at tug.org
Mon Oct 24 21:34:41 CEST 2022


Revision: 64801
          http://tug.org/svn/texlive?view=revision&revision=64801
Author:   karl
Date:     2022-10-24 21:34:41 +0200 (Mon, 24 Oct 2022)
Log Message:
-----------
lt3luabridge (24oct22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf
    trunk/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx
    trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty
    trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex

Modified: trunk/Master/texmf-dist/doc/generic/lt3luabridge/lt3luabridge.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx	2022-10-24 10:57:00 UTC (rev 64800)
+++ trunk/Master/texmf-dist/source/generic/lt3luabridge/lt3luabridge.dtx	2022-10-24 19:34:41 UTC (rev 64801)
@@ -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
-          { #1 }
+          { \tl_to_str:n { #1 } }
+        \regex_replace_all:nnN
+          { [\\"] }
+          { \\\0 }
+          \l_tmpa_tl
         \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

Modified: trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty
===================================================================
--- trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty	2022-10-24 10:57:00 UTC (rev 64800)
+++ trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.sty	2022-10-24 19:34:41 UTC (rev 64801)
@@ -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

Modified: trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex	2022-10-24 10:57:00 UTC (rev 64800)
+++ trunk/Master/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex	2022-10-24 19:34:41 UTC (rev 64801)
@@ -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
-          { #1 }
+          { \tl_to_str:n { #1 } }
+        \regex_replace_all:nnN
+          { [\\"] }
+          { \\\0 }
+          \l_tmpa_tl
         \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



More information about the tex-live-commits mailing list.