texlive[60147] Master/texmf-dist: luamplib (2aug21)

commits+karl at tug.org commits+karl at tug.org
Mon Aug 2 22:24:16 CEST 2021


Revision: 60147
          http://tug.org/svn/texlive?view=revision&revision=60147
Author:   karl
Date:     2021-08-02 22:24:16 +0200 (Mon, 02 Aug 2021)
Log Message:
-----------
luamplib (2aug21)

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
    trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty

Modified: trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2021-08-02 20:23:48 UTC (rev 60146)
+++ trunk/Master/texmf-dist/doc/luatex/luamplib/NEWS	2021-08-02 20:24:16 UTC (rev 60147)
@@ -1,5 +1,9 @@
                        History of the luamplib package
 
+2021/08/02 2.20.8
+    * when \mplibshowlog{enable} is declared, log (not term) messages
+      returned by mplib instance will be printed into the .log file.
+
 2021/03/11 2.20.7
     * emegency patch for context metafun 2021-03-06
 

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	2021-08-02 20:23:48 UTC (rev 60146)
+++ trunk/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2021-08-02 20:24:16 UTC (rev 60147)
@@ -85,7 +85,7 @@
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luamplib.drv}%
-  [2021/03/11 v2.20.7 Interface for using the mplib library]%
+  [2021/08/02 v2.20.8 Interface for using the mplib library]%
 \documentclass{ltxdoc}
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
@@ -153,7 +153,7 @@
 % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
 % Maintainer: LuaLaTeX Maintainers ---
 % Support: \email{lualatex-dev at tug.org}}
-% \date{2021/03/11 v2.20.7}
+% \date{2021/08/02 v2.20.8}
 %
 % \maketitle
 %
@@ -382,6 +382,12 @@
 %   |btex ... etex| or |verbatimtex ... etex| are not expanded and will be fed
 %   literally into the mplib process.
 %
+% \paragraph{\cs{mplibshowlog}}
+%   When |\mplibshowlog{enable}| is declared, log messages returned by
+%   |mplib| instance will be printed into the |.log| file.
+%   |\mplibshowlog{disable}| will revert this functionality.
+%   This is a \TeX{} side interface for |luamplib.showlog|. (v2.20.8)
+%
 % \paragraph{luamplib.cfg}
 %   At the end of package loading, \textsf{luamplib} searches
 %   |luamplib.cfg| and, if found, reads the file in automatically.
@@ -407,8 +413,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.20.7",
-  date          = "2021/03/11",
+  version       = "2.20.8",
+  date          = "2021/08/02",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -701,12 +707,17 @@
   input %s ;
 ]]
 
+local logatload
 local function reporterror (result, indeed)
   if not result then
     err("no result object returned")
   else
     local t, e, l = result.term, result.error, result.log
-    local log = t or l or "no-term"
+%    \end{macrocode}
+%
+%    log has more information than term, so log first (2021/08/02)
+%    \begin{macrocode}
+    local log = l or t or "no-term"
     log = log:gsub("%(Please type a command or say `end'%)",""):gsub("\n+","\n")
     if result.status > 0 then
       warn(log)
@@ -713,7 +724,8 @@
       if result.status > 1 then
         err(e or "see above messages")
       end
-    else
+    elseif indeed then
+      local log = logatload..log
 %    \end{macrocode}
 %
 %    v2.6.1: now luamplib does not disregard |show| command,
@@ -726,10 +738,13 @@
       elseif log:find"%g" then
         if luamplib.showlog then
           info(log)
-        elseif indeed and not result.fig then
+        elseif not result.fig then
           info(log)
         end
       end
+      logatload = ""
+    else
+      logatload = log
     end
     return log
   end
@@ -1054,7 +1069,10 @@
     if buffer and buffer ~= "" then
       return buffer
     end
-    return result or ""
+    buffer = {}
+    mpprint(buffer, result)
+    buffer = tableconcat(buffer)
+    return buffer
   end
   return ""
 end
@@ -1978,7 +1996,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2021/03/11 v2.20.7 mplib package for LuaTeX]
+    [2021/08/02 v2.20.8 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi
@@ -2053,8 +2071,7 @@
 %
 %    The Plain-specific stuff.
 %    \begin{macrocode}
-\bgroup\expandafter\expandafter\expandafter\egroup
-\expandafter\ifx\csname selectfont\endcsname\relax
+\unless\ifcsname ver at luamplib.sty\endcsname
 \def\mplibcode{%
   \begingroup
   \begingroup
@@ -2097,6 +2114,14 @@
 %
 %    User settings.
 %    \begin{macrocode}
+\def\mplibshowlog#1{\directlua{
+    local s = string.lower("#1")
+    if s == "enable" or s == "true" or s == "yes" then
+      luamplib.showlog = true
+    else
+      luamplib.showlog = false
+    end
+}}
 \def\mpliblegacybehavior#1{\directlua{
     local s = string.lower("#1")
     if s == "enable" or s == "true" or s == "yes" then

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2021-08-02 20:23:48 UTC (rev 60146)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2021-08-02 20:24:16 UTC (rev 60147)
@@ -11,8 +11,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.20.7",
-  date          = "2021/03/11",
+  version       = "2.20.8",
+  date          = "2021/08/02",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -246,12 +246,13 @@
   input %s ;
 ]]
 
+local logatload
 local function reporterror (result, indeed)
   if not result then
     err("no result object returned")
   else
     local t, e, l = result.term, result.error, result.log
-    local log = t or l or "no-term"
+    local log = l or t or "no-term"
     log = log:gsub("%(Please type a command or say `end'%)",""):gsub("\n+","\n")
     if result.status > 0 then
       warn(log)
@@ -258,16 +259,20 @@
       if result.status > 1 then
         err(e or "see above messages")
       end
-    else
+    elseif indeed then
+      local log = logatload..log
       if log:find"\n>>" then
         warn(log)
       elseif log:find"%g" then
         if luamplib.showlog then
           info(log)
-        elseif indeed and not result.fig then
+        elseif not result.fig then
           info(log)
         end
       end
+      logatload = ""
+    else
+      logatload = log
     end
     return log
   end
@@ -488,7 +493,10 @@
     if buffer and buffer ~= "" then
       return buffer
     end
-    return result or ""
+    buffer = {}
+    mpprint(buffer, result)
+    buffer = tableconcat(buffer)
+    return buffer
   end
   return ""
 end

Modified: trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2021-08-02 20:23:48 UTC (rev 60146)
+++ trunk/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2021-08-02 20:24:16 UTC (rev 60147)
@@ -14,7 +14,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2021/03/11 v2.20.7 mplib package for LuaTeX]
+    [2021/08/02 v2.20.8 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi
@@ -49,8 +49,7 @@
   \catcode`\&=12 \catcode`\$=12 \catcode`\%=12 \catcode`\^^M=12
 }
 \def\mplibputtextbox#1{\vbox to 0pt{\vss\hbox to 0pt{\raise\dp#1\copy#1\hss}}}
-\bgroup\expandafter\expandafter\expandafter\egroup
-\expandafter\ifx\csname selectfont\endcsname\relax
+\unless\ifcsname ver at luamplib.sty\endcsname
 \def\mplibcode{%
   \begingroup
   \begingroup
@@ -85,6 +84,14 @@
   \fi
 }
 \fi
+\def\mplibshowlog#1{\directlua{
+    local s = string.lower("#1")
+    if s == "enable" or s == "true" or s == "yes" then
+      luamplib.showlog = true
+    else
+      luamplib.showlog = false
+    end
+}}
 \def\mpliblegacybehavior#1{\directlua{
     local s = string.lower("#1")
     if s == "enable" or s == "true" or s == "yes" then



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