summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib/luamplib.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua37
1 files changed, 18 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 44f44d5cf10..96164ec72df 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.5",
- date = "2020/02/24",
+ version = "2.20.6",
+ date = "2020/12/30",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -26,7 +26,6 @@ luamplib = luamplib or { }
local luamplib = luamplib
luamplib.showlog = luamplib.showlog or false
-luamplib.lastlog = ""
local tableconcat = table.concat
local texsprint = tex.sprint
@@ -247,22 +246,27 @@ local preamble = [[
input %s ;
]]
-local function luamplibresetlastlog()
- luamplib.lastlog = ""
-end
-
-local function reporterror (result)
+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"
- log = log:gsub("^%s+","\n")
- luamplib.lastlog = luamplib.lastlog .. "\n" .. (l or t or "no-log")
+ log = log:gsub("%(Please type a command or say `end'%)",""):gsub("\n+","\n")
if result.status > 0 then
- warn("%s",log)
+ warn(log)
if result.status > 1 then
- err("%s",e or "see above messages")
+ err(e or "see above messages")
+ end
+ else
+ 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
+ info(log)
+ end
end
end
return log
@@ -306,16 +310,11 @@ local function process_indeed (mpx, data)
local converted, result = false, {}
if mpx and data then
result = mpx:execute(data)
- local log = reporterror(result)
+ local log = reporterror(result, true)
if log then
- if luamplib.showlog then
- info("%s",luamplib.lastlog)
- luamplibresetlastlog()
- elseif result.fig then
- if log:find("\n>>") then info("%s",log) end
+ if result.fig then
converted = luamplib.convert(result)
else
- info("%s",log)
warn("No figure output. Maybe no beginfig/endfig")
end
end