texlive[70562] branches/branch2023.final/Master/texmf-dist: luamplib

commits+karl at tug.org commits+karl at tug.org
Sun Mar 10 21:07:17 CET 2024


Revision: 70562
          https://tug.org/svn/texlive?view=revision&revision=70562
Author:   karl
Date:     2024-03-10 21:07:17 +0100 (Sun, 10 Mar 2024)
Log Message:
-----------
luamplib (branch) (10mar24)

Modified Paths:
--------------
    branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/NEWS
    branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
    branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
    branches/branch2023.final/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
    branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
    branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty

Modified: branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/NEWS
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/NEWS	2024-03-10 20:07:08 UTC (rev 70561)
+++ branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/NEWS	2024-03-10 20:07:17 UTC (rev 70562)
@@ -1,6 +1,10 @@
                        History of the luamplib package
 
-2024/03/09 2.26.3
+2024/03/10 2.26.4
+    * not just color names but also color expressions of l3color module
+    are now supported even if xcolor package is loaded
+
+2024/03/07 2.26.3
     * color expressions of l3color are supported as well.
     But they are regarded as xcolor's expressions if xcolor package is loaded.
     * support pdfmanagement's opacity and shading management.

Modified: branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
===================================================================
(Binary files differ)

Modified: branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex	2024-03-10 20:07:08 UTC (rev 70561)
+++ branches/branch2023.final/Master/texmf-dist/doc/luatex/luamplib/test-luamplib-latex.tex	2024-03-10 20:07:17 UTC (rev 70562)
@@ -1,4 +1,4 @@
-\DocumentMetadata{ }
+\DocumentMetadata{ uncompress }
 \documentclass{article}
 \usepackage{luamplib}
 \usepackage{xcolor}

Modified: branches/branch2023.final/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
===================================================================
--- branches/branch2023.final/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2024-03-10 20:07:08 UTC (rev 70561)
+++ branches/branch2023.final/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx	2024-03-10 20:07:17 UTC (rev 70562)
@@ -85,7 +85,7 @@
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luamplib.drv}%
-  [2024/03/07 v2.26.3 Interface for using the mplib library]%
+  [2024/03/10 v2.26.4 Interface for using the mplib library]%
 \documentclass{ltxdoc}
 \usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
 \usepackage[x11names]{xcolor}
@@ -153,7 +153,7 @@
 % \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
 % Maintainer: LuaLaTeX Maintainers ---
 % Support: \email{lualatex-dev at tug.org}}
-% \date{2024/03/07 v2.26.3}
+% \date{2024/03/10 v2.26.4}
 %
 % \maketitle
 %
@@ -306,9 +306,7 @@
 %   as well.
 %
 %   From v2.26.1, \textsf{l3color} is also supported by the command
-%   \cs{mpcolor\{color expression\}}.
-%   But color expressions (|red!50|) are regarded as \textsf{xcolor}'s
-%   expressions if \textsf{xcolor} package is loaded.
+%   \cs{mpcolor\{color expression\}}, including spot colors.
 %
 % \paragraph{\cs{mplibnumbersystem}}
 %   Users can choose |numbersystem| option since v2.4.
@@ -457,8 +455,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.26.3",
-  date          = "2024/03/07",
+  version       = "2.26.4",
+  date          = "2024/03/10",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -509,6 +507,8 @@
   err("Your LuaTeX version is too old. Please upgrade it to the latest")
 end
 
+local is_defined  = token.is_defined
+
 local mplib = require ('mplib')
 local kpse  = require ('kpse')
 local lfs   = require ('lfs')
@@ -1005,7 +1005,7 @@
   [[\color%s}\endgroup]],
 }
 
-local colfmt = token.is_defined'color_select:n' and "l3color" or "xcolor"
+local colfmt = is_defined'color_select:n' and "l3color" or "xcolor"
 if colfmt == "l3color" then
   run_tex_code{
     "\\newcatcodetable\\luamplibcctabexplat",
@@ -1022,15 +1022,24 @@
 
 local function process_color (str)
   if str then
-    if colfmt == "l3color" and token.is_defined"ver at xcolor.sty" then
-      colfmt = "l3xcolor"
-    end
-    local myfmt = mplibcolorfmt[colfmt]
     if not str:find("%b{}") then
       str = format("{%s}",str)
     end
-    if str:find("%b[]") then
-      myfmt = mplibcolorfmt.xcolor
+    local myfmt = mplibcolorfmt[colfmt]
+    if colfmt == "l3color" and (is_defined"ver at xcolor.sty" or is_defined"ver at color.sty") then
+      if str:find("%b[]") then
+        myfmt = mplibcolorfmt.xcolor
+      else
+        for _,v in ipairs(str:match"{(.+)}":explode"!") do
+          if not v:find("^%s*%d+%s*$") then
+            local pp = token.get_macro(format("l__color_named_%s_prop",v))
+            if not pp or pp == "" then
+              myfmt = mplibcolorfmt.xcolor
+              break
+            end
+          end
+        end
+      end
     end
     run_tex_code(myfmt:format(str,str,str), ccexplat or catat11)
     local t = texgettoks"mplibtmptoks"
@@ -1590,7 +1599,7 @@
 %
 %    Colors and Transparency
 %    \begin{macrocode}
-local pdfmanagement = token.is_defined'pdfmanagement_add:nnn'
+local pdfmanagement = is_defined'pdfmanagement_add:nnn'
 
 local pdf_objs = {}
 local getpageres, setpageres
@@ -1656,7 +1665,7 @@
 
 local function tr_pdf_pageresources(mode,opaq)
   if not pgf.loaded and pgf.bye then
-    pgf.loaded = token.is_defined(pgf.bye)
+    pgf.loaded = is_defined(pgf.bye)
     pgf.bye    = pgf.loaded and pgf.bye
   end
   local res, on_on, off_on = "", nil, nil
@@ -2142,7 +2151,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2024/03/07 v2.26.3 mplib package for LuaTeX]
+    [2024/03/10 v2.26.4 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi

Modified: branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2024-03-10 20:07:08 UTC (rev 70561)
+++ branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua	2024-03-10 20:07:17 UTC (rev 70562)
@@ -11,8 +11,8 @@
 
 luatexbase.provides_module {
   name          = "luamplib",
-  version       = "2.26.3",
-  date          = "2024/03/07",
+  version       = "2.26.4",
+  date          = "2024/03/10",
   description   = "Lua package to typeset Metapost with LuaTeX's MPLib.",
 }
 
@@ -46,6 +46,8 @@
   err("Your LuaTeX version is too old. Please upgrade it to the latest")
 end
 
+local is_defined  = token.is_defined
+
 local mplib = require ('mplib')
 local kpse  = require ('kpse')
 local lfs   = require ('lfs')
@@ -413,7 +415,7 @@
   [[\color%s}\endgroup]],
 }
 
-local colfmt = token.is_defined'color_select:n' and "l3color" or "xcolor"
+local colfmt = is_defined'color_select:n' and "l3color" or "xcolor"
 if colfmt == "l3color" then
   run_tex_code{
     "\\newcatcodetable\\luamplibcctabexplat",
@@ -430,15 +432,24 @@
 
 local function process_color (str)
   if str then
-    if colfmt == "l3color" and token.is_defined"ver at xcolor.sty" then
-      colfmt = "l3xcolor"
-    end
-    local myfmt = mplibcolorfmt[colfmt]
     if not str:find("%b{}") then
       str = format("{%s}",str)
     end
-    if str:find("%b[]") then
-      myfmt = mplibcolorfmt.xcolor
+    local myfmt = mplibcolorfmt[colfmt]
+    if colfmt == "l3color" and (is_defined"ver at xcolor.sty" or is_defined"ver at color.sty") then
+      if str:find("%b[]") then
+        myfmt = mplibcolorfmt.xcolor
+      else
+        for _,v in ipairs(str:match"{(.+)}":explode"!") do
+          if not v:find("^%s*%d+%s*$") then
+            local pp = token.get_macro(format("l__color_named_%s_prop",v))
+            if not pp or pp == "" then
+              myfmt = mplibcolorfmt.xcolor
+              break
+            end
+          end
+        end
+      end
     end
     run_tex_code(myfmt:format(str,str,str), ccexplat or catat11)
     local t = texgettoks"mplibtmptoks"
@@ -905,7 +916,7 @@
   end
 end
 
-local pdfmanagement = token.is_defined'pdfmanagement_add:nnn'
+local pdfmanagement = is_defined'pdfmanagement_add:nnn'
 
 local pdf_objs = {}
 local getpageres, setpageres
@@ -971,7 +982,7 @@
 
 local function tr_pdf_pageresources(mode,opaq)
   if not pgf.loaded and pgf.bye then
-    pgf.loaded = token.is_defined(pgf.bye)
+    pgf.loaded = is_defined(pgf.bye)
     pgf.bye    = pgf.loaded and pgf.bye
   end
   local res, on_on, off_on = "", nil, nil

Modified: branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2024-03-10 20:07:08 UTC (rev 70561)
+++ branches/branch2023.final/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty	2024-03-10 20:07:17 UTC (rev 70562)
@@ -14,7 +14,7 @@
 \else
   \NeedsTeXFormat{LaTeX2e}
   \ProvidesPackage{luamplib}
-    [2024/03/07 v2.26.3 mplib package for LuaTeX]
+    [2024/03/10 v2.26.4 mplib package for LuaTeX]
   \ifx\newluafunction\@undefined
   \input ltluatex
   \fi



More information about the tex-live-commits mailing list.