diff options
author | Karl Berry <karl@freefriends.org> | 2014-07-09 21:20:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-07-09 21:20:53 +0000 |
commit | abee3e3f6d0f906b9fedb4f5f36eae089f865a73 (patch) | |
tree | c6c30482e02cd28f5156800314936310782efd04 /Master/texmf-dist/tex | |
parent | 8abeed184a80961b957fdec8d8c148f149419465 (diff) |
luamplib (8jul14)
git-svn-id: svn://tug.org/texlive/trunk@34557 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.lua | 19 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.sty | 19 |
2 files changed, 25 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua index 4dd1b5e946c..df329392c0b 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 = "" local err, warn, info, log = luatexbase.provides_module({ name = "luamplib", - version = "2.8.0", - date = "2014/06/17", + version = "2.8.1", + date = "2014/07/04", description = "Lua package to typeset Metapost with LuaTeX's MPLib.", }) @@ -202,15 +202,17 @@ local function replaceinputmpfile (name,file) local data = fh:read("*all"); fh:close() data = stringgsub(data, "\"[^\n]-\"", function(str) - str = stringgsub(str,"%%","!!!!!PERCENT!!!!!") str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1!!!T!!!E!!!X!!!") return str end) - data = stringgsub(data,"%%.-\n","") local count,cnt = 0,0 data,cnt = stringgsub(data, "%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]", function(str) + str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!") + str = stringgsub(str,"%%.-\n", "") + str = stringgsub(str,"%%.-$", "") + str = stringgsub(str,"\\!!!!!PERCENT!!!!!","\\%%") str = stringgsub(str,"[\n\r]%s*"," ") str = stringgsub(str,'"','"&ditto&"') return format("rawtextext(\"%s\")",str) @@ -230,7 +232,6 @@ local function replaceinputmpfile (name,file) return file end data = stringgsub(data,"([bem])!!!T!!!E!!!X!!!","%1tex") - data = stringgsub(data,"!!!!!PERCENT!!!!!","%%") fh = ioopen(newfile,"w") if not fh then return file end fh:write(data); fh:close() @@ -611,10 +612,12 @@ local function protecttextext(data) str = stringgsub(str,"([bem])tex%f[^A-Z_a-z]","%1!!!T!!!E!!!X!!!") return str end) - data = stringgsub(data,"%%.-\n","") data = stringgsub(data, "%f[A-Z_a-z]btex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]", function(str) + str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!") + str = stringgsub(str,"%%.-\n", "") + str = stringgsub(str,"%%.-$", "") str = stringgsub(str,'"','"&ditto&"') str = stringgsub(str,"\n%s*"," ") return format("rawtextext(\"%s\")",str) @@ -622,6 +625,9 @@ local function protecttextext(data) data = stringgsub(data, "%f[A-Z_a-z]verbatimtex%f[^A-Z_a-z]%s*(.-)%s*%f[A-Z_a-z]etex%f[^A-Z_a-z]", function(str) + str = stringgsub(str,"\\%%","\\!!!!!PERCENT!!!!!") + str = stringgsub(str,"%%.-\n", "") + str = stringgsub(str,"%%.-$", "") str = stringgsub(str,'"','"&ditto&"') str = stringgsub(str,"\n%s*"," ") return format("VerbatimTeX(\"%s\")",str) @@ -634,6 +640,7 @@ local function protecttextext(data) str = stringgsub(str,"#", "!!!!!SHARPE!!!!!") return format("\\detokenize{%s}",str) end) + data = stringgsub(data,"%%.-\n", "") luamplib.mpxcolors = {} data = stringgsub(data, "\\mpcolor%s*{(.-)}", function(str) diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty index 21e321e6a91..ffee72280ff 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} - [2014/06/17 v2.8.0 mplib package for LuaTeX] + [2014/07/04 v2.8.1 mplib package for LuaTeX] \RequirePackage{luatexbase-modutils} \fi \RequireLuaModule{luamplib} @@ -46,7 +46,7 @@ \begingroup\lccode`\~=`\^^M \lowercase{\endgroup \def\mplibdoreplacenewlinebr#1^^J{\endgroup\luatexscantextokens{{}#1~}}} \bgroup\expandafter\expandafter\expandafter\egroup -\expandafter\ifx\csname ProvidesPackage\endcsname\relax +\expandafter\ifx\csname selectfont\endcsname\relax \def\mplibreplacenewlinecs{% \begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs} \begingroup\lccode`\~=`\^^M \lowercase{\endgroup @@ -60,7 +60,8 @@ } \long\def\mplibdocode#1\endmplibcode{% \endgroup - \def\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}% + \edef\mplibtemp{\directlua{luamplib.protecttextext([===[\unexpanded{#1}]===])}}% + \directlua{ tex.sprint(table.concat(luamplib.mpxcolors)) }% \directlua{luamplib.tempdata = luamplib.makeTEXboxes([===[\mplibtemp]===])}% \directlua{luamplib.processwithTEXboxes(luamplib.tempdata)}% \endgroup @@ -93,17 +94,21 @@ \toks@\expandafter{\the\toks@\end{#2}}\expandafter\ltxdomplibcode \fi } +\fi \def\mplibcolor#1#2{% \ifcsname\string\color @#2\endcsname \edef#1{1 withprescript "MPlibOverrideColor=\csname\string\color @#2\endcsname"}% \else - \extractcolorspecs{#2}\mplibtemp@a\mplibtemp@b - \convertcolorspec\mplibtemp@a\mplibtemp@b{cmyk}\mplibtemp@c - \edef#1{(\mplibtemp@c)}% + \ifdefined\extractcolorspecs + \extractcolorspecs{#2}\mplibtemp@a\mplibtemp@b + \convertcolorspec\mplibtemp@a\mplibtemp@b{cmyk}\mplibtemp@c + \edef#1{(\mplibtemp@c)}% + \else + \errmessage{Undefined color `#2'}% + \fi \fi } -\fi \newtoks\everymplibtoks \newtoks\everyendmplibtoks \protected\def\everymplib{% |