summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luamplib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-01-12 21:19:46 +0000
committerKarl Berry <karl@freefriends.org>2022-01-12 21:19:46 +0000
commit81b17c3a69bb1b2f93e5ca4b114be5098da9b6d8 (patch)
tree23ee38849c7109b4dc35caeaa05070b6c988e39f /Master/texmf-dist/tex/luatex/luamplib
parent13f7e67a76bfe1f95e9778a7949e23dbe1acb955 (diff)
luamplib (12jan22)
git-svn-id: svn://tug.org/texlive/trunk@61587 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua13
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty41
2 files changed, 38 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index a0bdce00e70..35b7e435c1c 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.22.0",
- date = "2022/01/09",
+ version = "2.23.0",
+ date = "2022/01/12",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -642,11 +642,16 @@ local function unprotect_expansion (str)
end
end
+luamplib.everymplib = { [""] = "" }
+luamplib.everyendmplib = { [""] = "" }
+
local function process_mplibcode (data, instancename)
legacy_mplibcode_reset()
- local everymplib = texgettoks'everymplibtoks' or ''
- local everyendmplib = texgettoks'everyendmplibtoks' or ''
+ local everymplib = luamplib.everymplib[instancename] or
+ luamplib.everymplib[""]
+ local everyendmplib = luamplib.everyendmplib[instancename] or
+ luamplib.everyendmplib[""]
data = format("\n%s\n%s\n%s\n",everymplib, data, everyendmplib)
data = data:gsub("\r","\n")
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 5de8c9c6b36..97ebcc2789d 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}
- [2022/01/09 v2.22.0 mplib package for LuaTeX]
+ [2022/01/12 v2.23.0 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi
@@ -58,7 +58,7 @@
}
\long\def\mplibdocode#1\endmplibcode{%
\endgroup
- \directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===])}%
+ \directlua{luamplib.process_mplibcode([===[\unexpanded{#1}]===],"")}%
\endgroup
}
\else
@@ -110,26 +110,43 @@
end
}}
\newtoks\mplibtmptoks
-\newtoks\everymplibtoks
-\newtoks\everyendmplibtoks
\protected\def\everymplib{%
\begingroup
\mplibsetupcatcodes
\mplibdoeverymplib
}
-\long\def\mplibdoeverymplib#1{%
- \endgroup
- \everymplibtoks{#1}%
-}
\protected\def\everyendmplib{%
\begingroup
\mplibsetupcatcodes
\mplibdoeveryendmplib
}
-\long\def\mplibdoeveryendmplib#1{%
- \endgroup
- \everyendmplibtoks{#1}%
-}
+\ifcsname ver@luamplib.sty\endcsname
+ \newcommand\mplibdoeverymplib[2][]{%
+ \endgroup
+ \directlua{
+ luamplib.everymplib["#1"] = [===[\unexpanded{#2}]===]
+ }%
+ }
+ \newcommand\mplibdoeveryendmplib[2][]{%
+ \endgroup
+ \directlua{
+ luamplib.everyendmplib["#1"] = [===[\unexpanded{#2}]===]
+ }%
+ }
+\else
+ \long\def\mplibdoeverymplib#1{%
+ \endgroup
+ \directlua{
+ luamplib.everymplib[""] = [===[\unexpanded{#1}]===]
+ }%
+ }
+ \long\def\mplibdoeveryendmplib#1{%
+ \endgroup
+ \directlua{
+ luamplib.everyendmplib[""] = [===[\unexpanded{#1}]===]
+ }%
+ }
+\fi
\def\mpdim#1{ mplibdimen("#1") }
\def\mpcolor#1#{\domplibcolor{#1}}
\def\domplibcolor#1#2{ mplibcolor("#1{#2}") }