summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS3
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin160514 -> 159306 bytes
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx45
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua19
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty22
5 files changed, 49 insertions, 40 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index ed1d29c0568..4df1e017121 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -1,5 +1,8 @@
History of the luamplib package
+2016/03/31 2.11.3
+ * fix a bug regarding nested mplibcode environments (issue #63)
+
2016/01/02 2.11.2
* updates for luatex 0.87
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index 99ac85e3997..737c4fc9b10 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
+++ b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
index 9d1af863bf3..3b03b6935fe 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}%
- [2016/01/02 v2.11.2 Interface for using the mplib library]%
+ [2016/03/31 v2.11.3 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{2016/01/02 v2.11.2}
+% \date{2016/03/31 v2.11.3}
%
% \maketitle
%
@@ -369,8 +369,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.11.2",
- date = "2016/01/02",
+ version = "2.11.3",
+ date = "2016/03/31",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -1136,6 +1136,8 @@ end
luamplib.protecttextextVerbatim = protecttextextVerbatim
+luamplib.mpxcolors = {}
+
local function protecttextext(data)
data = protect_tex_text_common(data)
@@ -1150,13 +1152,14 @@ local function protecttextext(data)
data = data:gsub("%%.-\n", "")
- luamplib.mpxcolors = {}
+ local grouplevel = tex.currentgrouplevel
+ luamplib.mpxcolors[grouplevel] = {}
data = data:gsub("\\mpcolor"..endname.."(.-){(.-)}", function(opt,str)
- local cnt = #luamplib.mpxcolors + 1
- luamplib.mpxcolors[cnt] = format(
- "\\expandafter\\mplibcolor\\csname mpxcolor%i\\endcsname%s{%s}",
- cnt,opt,str)
- return format("\\csname mpxcolor%i\\endcsname",cnt)
+ local cnt = #luamplib.mpxcolors[grouplevel] + 1
+ luamplib.mpxcolors[grouplevel][cnt] = format(
+ "\\expandafter\\mplibcolor\\csname mpxcolor%i:%i\\endcsname%s{%s}",
+ grouplevel,cnt,opt,str)
+ return format("\\csname mpxcolor%i:%i\\endcsname",grouplevel,cnt)
end)
% \end{macrocode}
@@ -1705,7 +1708,7 @@ luamplib.colorconverter = colorconverter
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2016/01/02 v2.11.2 mplib package for LuaTeX]
+ [2016/03/31 v2.11.3 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi
@@ -1792,13 +1795,13 @@ luamplib.colorconverter = colorconverter
\long\def\mplibdocode#1\endmplibcode{%
\endgroup
\ifdefined\mplibverbatimYes
- \directlua{luamplib.tempdata = luamplib.protecttextextVerbatim([===[\detokenize{#1}]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.protecttextextVerbatim([===[\detokenize{#1}]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\else
\edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
- \directlua{ tex.sprint(luamplib.mpxcolors) }%
- \directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\fi
\endgroup
\ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi
@@ -1824,13 +1827,13 @@ luamplib.colorconverter = colorconverter
\toks@\expandafter{\the\toks@#1}%
\def\mplibtemp@a{#2}\ifx\mplib@mplibcode\mplibtemp@a
\ifdefined\mplibverbatimYes
- \directlua{luamplib.tempdata = luamplib.protecttextextVerbatim([===[\the\toks@]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.protecttextextVerbatim([===[\the\toks@]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\else
\edef\mplibtemp{\directlua{luamplib.protecttextext([===[\the\toks@]===])}}%
- \directlua{ tex.sprint(luamplib.mpxcolors) }%
- \directlua{luamplib.tempdata=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\fi
\end{mplibcode}%
\ifnum\mplibstartlineno<\inputlineno
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index db75e0d90c0..5030c708e47 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -18,8 +18,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.11.2",
- date = "2016/01/02",
+ version = "2.11.3",
+ date = "2016/03/31",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -704,6 +704,8 @@ end
luamplib.protecttextextVerbatim = protecttextextVerbatim
+luamplib.mpxcolors = {}
+
local function protecttextext(data)
data = protect_tex_text_common(data)
@@ -718,13 +720,14 @@ local function protecttextext(data)
data = data:gsub("%%.-\n", "")
- luamplib.mpxcolors = {}
+ local grouplevel = tex.currentgrouplevel
+ luamplib.mpxcolors[grouplevel] = {}
data = data:gsub("\\mpcolor"..endname.."(.-){(.-)}", function(opt,str)
- local cnt = #luamplib.mpxcolors + 1
- luamplib.mpxcolors[cnt] = format(
- "\\expandafter\\mplibcolor\\csname mpxcolor%i\\endcsname%s{%s}",
- cnt,opt,str)
- return format("\\csname mpxcolor%i\\endcsname",cnt)
+ local cnt = #luamplib.mpxcolors[grouplevel] + 1
+ luamplib.mpxcolors[grouplevel][cnt] = format(
+ "\\expandafter\\mplibcolor\\csname mpxcolor%i:%i\\endcsname%s{%s}",
+ grouplevel,cnt,opt,str)
+ return format("\\csname mpxcolor%i:%i\\endcsname",grouplevel,cnt)
end)
data = data:gsub("([^`\\])#","%1##")
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 3cfeb24912b..e9eb69dbd00 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}
- [2016/01/02 v2.11.2 mplib package for LuaTeX]
+ [2016/03/31 v2.11.3 mplib package for LuaTeX]
\ifx\newluafunction\@undefined
\input ltluatex
\fi
@@ -70,13 +70,13 @@
\long\def\mplibdocode#1\endmplibcode{%
\endgroup
\ifdefined\mplibverbatimYes
- \directlua{luamplib.tempdata = luamplib.protecttextextVerbatim([===[\detokenize{#1}]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.protecttextextVerbatim([===[\detokenize{#1}]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\else
\edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
- \directlua{ tex.sprint(luamplib.mpxcolors) }%
- \directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\fi
\endgroup
\ifnum\mplibstartlineno<\inputlineno\expandafter\mplibreplacenewlinecs\fi
@@ -97,13 +97,13 @@
\toks@\expandafter{\the\toks@#1}%
\def\mplibtemp@a{#2}\ifx\mplib@mplibcode\mplibtemp@a
\ifdefined\mplibverbatimYes
- \directlua{luamplib.tempdata = luamplib.protecttextextVerbatim([===[\the\toks@]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.protecttextextVerbatim([===[\the\toks@]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\else
\edef\mplibtemp{\directlua{luamplib.protecttextext([===[\the\toks@]===])}}%
- \directlua{ tex.sprint(luamplib.mpxcolors) }%
- \directlua{luamplib.tempdata=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
- \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}%
+ \directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }%
+ \directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
+ \directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\fi
\end{mplibcode}%
\ifnum\mplibstartlineno<\inputlineno