summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-26 21:01:21 +0000
committerKarl Berry <karl@freefriends.org>2019-03-26 21:01:21 +0000
commit1bd89250219a1f2d07e579df52dce11bbcd7e994 (patch)
treed7cd2be2fb67c15ffa33c65aebacee16b4873fd2 /Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
parent92b7814a76a0652922328edf72c488cebd878be7 (diff)
luamplib (26mar19)
git-svn-id: svn://tug.org/texlive/trunk@50608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib/luamplib.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua30
1 files changed, 10 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index c94fb761fc9..bf4603cdeca 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.0",
- date = "2019/03/20",
+ version = "2.20.1",
+ date = "2019/03/26",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -36,7 +36,6 @@ local texget = tex.get
local texgettoks = tex.gettoks
local texgetbox = tex.getbox
local texruntoks = tex.runtoks
-local texscantoks = tex.scantoks
if not texruntoks then
err("Your LuaTeX version is too old. Please upgrade it to the latest")
@@ -164,8 +163,8 @@ local function replaceformatmp(file,newfile,ofmodify)
return newfile
end
-local name_b = "%f[A-Z_a-z]"
-local name_e = "%f[^A-Z_a-z]"
+local name_b = "%f[%a_]"
+local name_e = "%f[^%a_]"
local btex_etex = name_b.."btex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e
local verbatimtex_etex = name_b.."verbatimtex"..name_e.."%s*(.-)%s*"..name_b.."etex"..name_e
@@ -231,7 +230,7 @@ local function finder(name, mode, ftype)
end
return replaceinputmpfile(name,file)
end
- return mpkpse:find_file(name, name:match("[a-zA-Z]+$"))
+ return mpkpse:find_file(name, name:match("%a+$"))
end
end
luamplib.finder = finder
@@ -330,9 +329,6 @@ luamplib.codeinherit = false
local mplibinstances = {}
local function process (data)
- if not data:find(name_b.."beginfig%s*%([%+%-%s]*%d[%.%d%s]*%)") then
- data = data .. "beginfig(-1);endfig;"
- end
local standalone = not luamplib.codeinherit
local currfmt = currentformat .. (luamplib.numbersystem or "scaled")
.. tostring(luamplib.textextlabel) .. tostring(luamplib.legacy_verbatimtex)
@@ -350,12 +346,6 @@ end
local catlatex = luatexbase.registernumber("catcodetable@latex")
local catat11 = luatexbase.registernumber("catcodetable@atletter")
-local function run_tex_code_no_use (str, cat)
- cat = cat or catlatex
- texscantoks("mplibtmptoks", cat, str)
- texruntoks("mplibtmptoks")
-end
-
local function run_tex_code (str, cat)
cat = cat or catlatex
texruntoks(function() texsprint(cat, str) end)
@@ -446,7 +436,6 @@ mp = mp or {}
local mp = mp
mp.mf_path_reset = mp.mf_path_reset or function() end
mp.mf_finish_saving_data = mp.mf_finish_saving_data or function() end
-LUATEXFUNCTIONALITY = LUATEXFUNCTIONALITY or 0
local function mpprint(buffer,...)
for i=1,select("#",...) do
@@ -458,7 +447,7 @@ local function mpprint(buffer,...)
elseif t == "string" then
buffer[#buffer+1] = value
elseif t == "table" then
- buffer[#buffer+1] = "(" .. concat(value,",") .. ")"
+ buffer[#buffer+1] = "(" .. tableconcat(value,",") .. ")"
else -- boolean or whatever
buffer[#buffer+1] = tostring(value)
end
@@ -576,9 +565,8 @@ local textextlabelpreamble = [[
primarydef s infont f = rawtextext(s) enddef;
def fontsize expr f =
begingroup
- save size,pic; numeric size; picture pic;
- pic := rawtextext("\hskip\pdffontsize\font");
- size := xpart urcorner pic - xpart llcorner pic;
+ save size; numeric size;
+ size := mplibdimen("1em");
if size = 0: 10pt else: size fi
endgroup
enddef;
@@ -617,6 +605,8 @@ local function process_mplibcode (data)
data = data:gsub("\r","\n")
data = data:gsub("\\mpcolor%s+(.-%b{})","mplibcolor(\"%1\")")
+ data = data:gsub("\\mpdim%s+(%b{})", "mplibdimen(\"%1\")")
+ data = data:gsub("\\mpdim%s+(\\%a+)","mplibdimen(\"%1\")")
data = data:gsub(btex_etex, function(str)
return format("btex %s etex ", -- space