Skip to content

Commit

Permalink
more fix for lualatex#63
Browse files Browse the repository at this point in the history
  • Loading branch information
dohyunkim committed Mar 31, 2016
1 parent f5ff48e commit 78b4e90
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions luamplib.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,8 @@ end
luamplib.protecttextextVerbatim = protecttextextVerbatim
luamplib.mpxcolors = {}
local function protecttextext(data)
data = protect_tex_text_common(data)
Expand All @@ -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}
Expand Down Expand Up @@ -1796,7 +1799,7 @@ luamplib.colorconverter = colorconverter
\directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\else
\edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}%
\directlua{ tex.sprint(luamplib.mpxcolors) }%
\directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }%
\directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
\directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\fi
Expand Down Expand Up @@ -1828,7 +1831,7 @@ luamplib.colorconverter = colorconverter
\directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\else
\edef\mplibtemp{\directlua{luamplib.protecttextext([===[\the\toks@]===])}}%
\directlua{ tex.sprint(luamplib.mpxcolors) }%
\directlua{ tex.sprint(luamplib.mpxcolors[\the\currentgrouplevel]) }%
\directlua{luamplib.tempdata\the\currentgrouplevel=luamplib.makeTEXboxes([===[\mplibtemp]===])}%
\directlua{luamplib.processwithTEXboxes(luamplib.tempdata\the\currentgrouplevel)}%
\fi
Expand Down

0 comments on commit 78b4e90

Please sign in to comment.