texlive[52795] Master/texmf-dist: luamplib (14nov19)

commits+karl at tug.org commits+karl at tug.org
Thu Nov 14 22:55:29 CET 2019


Revision: 52795
          http://tug.org/svn/texlive?view=revision&revision=52795
Author:   karl
Date:     2019-11-14 22:55:29 +0100 (Thu, 14 Nov 2019)
Log Message:
-----------
luamplib (14nov19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
    trunk/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
    trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-11-14 21:55:14 UTC (rev 52794)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2019-11-14 21:55:29 UTC (rev 52795)
@@ -1,5 +1,8 @@
                        History of the luamplib package
 
+2019/11/14 2.20.3
+    * fix issue #86 (LaTeX command inside metapost label)
+
 2019/10/11 2.20.2
     * fix issue #84 (pgf package hinders \mpcolor process)
 

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

Modified: trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-11-14 21:55:14 UTC (rev 52794)
+++ trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2019-11-14 21:55:29 UTC (rev 52795)
@@ -1158,11 +1158,11 @@
 %    \begin{macrocode}
 local function protect_expansion (str)
   if str then
-    str = str:gsub("\\","\1Control\1")
-             :gsub("%%","\1Comment\1")
-             :gsub("#", "\1HashSign\1")
-             :gsub("{", "\1LBrace\1")
-             :gsub("}", "\1RBrace\1")
+    str = str:gsub("\\","!!!Control!!!")
+             :gsub("%%","!!!Comment!!!")
+             :gsub("#", "!!!HashSign!!!")
+             :gsub("{", "!!!LBrace!!!")
+             :gsub("}", "!!!RBrace!!!")
     return format("\\unexpanded{%s}",str)
   end
 end
@@ -1169,11 +1169,11 @@
 
 local function unprotect_expansion (str)
   if str then
-    return str:gsub("\1Control\1", "\\")
-              :gsub("\1Comment\1", "%%")
-              :gsub("\1HashSign\1","#")
-              :gsub("\1LBrace\1",  "{")
-              :gsub("\1RBrace\1",  "}")
+    return str:gsub("!!!Control!!!", "\\")
+              :gsub("!!!Comment!!!", "%%")
+              :gsub("!!!HashSign!!!","#")
+              :gsub("!!!LBrace!!!",  "{")
+              :gsub("!!!RBrace!!!",  "}")
   end
 end
 
@@ -1210,7 +1210,11 @@
 %    \begin{macrocode}
   if not luamplib.verbatiminput then
     data = data:gsub("\".-\"", protect_expansion)
+
+    data = data:gsub("\\%%", "\0PerCent\0")
     data = data:gsub("%%.-\n","")
+    data = data:gsub("%zPerCent%z", "\\%%")
+
     run_tex_code(format("\\mplibtmptoks\\expanded{{%s}}",data))
     data = texgettoks"mplibtmptoks"
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-11-14 21:55:14 UTC (rev 52794)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2019-11-14 21:55:29 UTC (rev 52795)
@@ -580,11 +580,11 @@
 
 local function protect_expansion (str)
   if str then
-    str = str:gsub("\\","\1Control\1")
-             :gsub("%%","\1Comment\1")
-             :gsub("#", "\1HashSign\1")
-             :gsub("{", "\1LBrace\1")
-             :gsub("}", "\1RBrace\1")
+    str = str:gsub("\\","!!!Control!!!")
+             :gsub("%%","!!!Comment!!!")
+             :gsub("#", "!!!HashSign!!!")
+             :gsub("{", "!!!LBrace!!!")
+             :gsub("}", "!!!RBrace!!!")
     return format("\\unexpanded{%s}",str)
   end
 end
@@ -591,11 +591,11 @@
 
 local function unprotect_expansion (str)
   if str then
-    return str:gsub("\1Control\1", "\\")
-              :gsub("\1Comment\1", "%%")
-              :gsub("\1HashSign\1","#")
-              :gsub("\1LBrace\1",  "{")
-              :gsub("\1RBrace\1",  "}")
+    return str:gsub("!!!Control!!!", "\\")
+              :gsub("!!!Comment!!!", "%%")
+              :gsub("!!!HashSign!!!","#")
+              :gsub("!!!LBrace!!!",  "{")
+              :gsub("!!!RBrace!!!",  "}")
   end
 end
 
@@ -622,7 +622,11 @@
 
   if not luamplib.verbatiminput then
     data = data:gsub("\".-\"", protect_expansion)
+
+    data = data:gsub("\\%%", "\0PerCent\0")
     data = data:gsub("%%.-\n","")
+    data = data:gsub("%zPerCent%z", "\\%%")
+
     run_tex_code(format("\\mplibtmptoks\\expanded{{%s}}",data))
     data = texgettoks"mplibtmptoks"
     data = data:gsub("##", "#")



More information about the tex-live-commits mailing list