diff options
-rw-r--r-- | Master/texmf-dist/doc/luatex/luamplib/NEWS | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf | bin | 150094 -> 151067 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/luatex/luamplib/luamplib.dtx | 47 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.lua | 20 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | 13 |
5 files changed, 64 insertions, 20 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS index a47ff79ff35..76cf284ab9d 100644 --- a/Master/texmf-dist/doc/luatex/luamplib/NEWS +++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS @@ -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 diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf Binary files differindex c6ed578cb8d..3a0f3c8b650 100644 --- a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf +++ b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx index dec028813fb..88371fafd49 100644 --- a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx +++ b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx @@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information. %<*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 @@ See source file '\inFileName' for licencing and contact information. % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\ % Maintainer: LuaLaTeX Maintainers --- % Support: \email{lualatex-dev@tug.org}} -% \date{2021/03/11 v2.20.7} +% \date{2021/08/02 v2.20.8} % % \maketitle % @@ -382,6 +382,12 @@ See source file '\inFileName' for licencing and contact information. % |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 @@ See source file '\inFileName' for licencing and contact information. 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,19 +707,25 @@ local preamble = [[ 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) 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 @@ local function reporterror (result, indeed) 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 @@ function luamplib.runscript (code) 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 @@ luamplib.colorconverter = colorconverter \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 @@ luamplib.colorconverter = colorconverter % % The Plain-specific stuff. % \begin{macrocode} -\bgroup\expandafter\expandafter\expandafter\egroup -\expandafter\ifx\csname selectfont\endcsname\relax +\unless\ifcsname ver@luamplib.sty\endcsname \def\mplibcode{% \begingroup \begingroup @@ -2097,6 +2114,14 @@ luamplib.colorconverter = colorconverter % % 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 diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua index 74dbf45d062..0ea75e7b61f 100644 --- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua +++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua @@ -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,28 +246,33 @@ local preamble = [[ 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) 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 @@ function luamplib.runscript (code) if buffer and buffer ~= "" then return buffer end - return result or "" + buffer = {} + mpprint(buffer, result) + buffer = tableconcat(buffer) + return buffer end return "" end diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty index 8540ce79c90..e37fc3da406 100644 --- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty +++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty @@ -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@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 |