From f670508774c35b585b520fa9217d156664b4cb2a Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Fri, 19 Feb 2021 03:01:02 +0000
Subject: CTAN sync 202102190301

---
 macros/latex/contrib/luacolor/luacolor.dtx | 53 ++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 13 deletions(-)

(limited to 'macros/latex/contrib/luacolor/luacolor.dtx')

diff --git a/macros/latex/contrib/luacolor/luacolor.dtx b/macros/latex/contrib/luacolor/luacolor.dtx
index 68c92f056a..8f072db0f1 100644
--- a/macros/latex/contrib/luacolor/luacolor.dtx
+++ b/macros/latex/contrib/luacolor/luacolor.dtx
@@ -1,12 +1,12 @@
 % \iffalse meta-comment
 %
 % File: luacolor.dtx
-% Version: 2020-02-24 v1.15
+% Version: 2021-02-17 v1.17
 % Info: Color support via LuaTeX's attributes
 %
 % Copyright (C)
 %    2007, 2009-2011 Heiko Oberdiek
-%    2016-2020 Oberdiek Package Support Group
+%    2016-2021 Oberdiek Package Support Group
 %    https://github.com/ho-tex/luacolor/issues
 %
 % This work may be distributed and/or modified under the
@@ -80,7 +80,7 @@
 \input docstrip.tex
 \Msg{************************************************************************}
 \Msg{* Installation}
-\Msg{* Package: luacolor 2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)}
+\Msg{* Package: luacolor 2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)}
 \Msg{************************************************************************}
 
 \keepsilent
@@ -92,11 +92,11 @@
 This is a generated file.
 
 Project: luacolor
-Version: 2020-02-24 v1.15
+Version: 2021-02-17 v1.17
 
 Copyright (C)
    2007, 2009-2011 Heiko Oberdiek
-   2016-2020 Oberdiek Package Support Group
+   2016-2021 Oberdiek Package Support Group
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either
@@ -169,7 +169,7 @@ and the derived files
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesFile{luacolor.drv}%
-  [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)]%
+  [2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)]%
 \documentclass{ltxdoc}
 \usepackage{holtxdoc}[2011/11/22]
 \usepackage{paralist}
@@ -189,7 +189,7 @@ and the derived files
 % \GetFileInfo{luacolor.drv}
 %
 % \title{The \xpackage{luacolor} package}
-% \date{2020-02-24 v1.15}
+% \date{2021-02-17 v1.17}
 % \author{Heiko Oberdiek\thanks
 % {Please report any issues at \url{https://github.com/ho-tex/luacolor/issues}}}
 %
@@ -332,7 +332,7 @@ and the derived files
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{luacolor}%
-  [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)]
+  [2021-02-17 v1.17 Color support via LuaTeX's attributes (HO)]
 %    \end{macrocode}
 %
 % \subsection{Check for \LuaTeX}
@@ -376,7 +376,7 @@ and the derived files
 %    \end{macrocode}
 %    \begin{macrocode}
 \begingroup
-  \edef\x{\directlua{tex.write("2020-02-24 v1.15")}}%
+  \edef\x{\directlua{tex.write("2021-02-17 v1.17")}}%
   \edef\y{%
     \directlua{%
       if oberdiek.luacolor.getversion then %
@@ -471,9 +471,15 @@ and the derived files
 %    \end{macro}
 %
 %    \begin{macrocode}
-\RequirePackage{atbegshi}[2011/01/30]
-\AtBeginShipout{%
-  \luacolorProcessBox\AtBeginShipoutBox
+\directlua{%
+  if luatexbase.callbacktypes.pre_shipout_filter then
+    token.get_next()
+  end
+}\@secondoftwo\@gobble{
+  \RequirePackage{atbegshi}[2011/01/30]
+  \AtBeginShipout{%
+    \luacolorProcessBox\AtBeginShipoutBox
+  }
 }
 %    \end{macrocode}
 %
@@ -608,7 +614,7 @@ oberdiek.luacolor = luacolor
 %    \begin{macro}{getversion()}
 %    \begin{macrocode}
 function luacolor.getversion()
-  tex.write("2020-02-24 v1.15")
+  tex.write("2021-02-17 v1.17")
 end
 %    \end{macrocode}
 %    \end{macro}
@@ -727,6 +733,7 @@ local LIST = 1
 local LIST_LEADERS = 2
 local LIST_DISC = 3
 local COLOR = 4
+local NOCOLOR = 5
 local RULE = node.id("rule")
 local node_types = {
   [node.id("hlist")] = LIST,
@@ -735,6 +742,10 @@ local node_types = {
   [node.id("glyph")] = COLOR,
   [node.id("disc")]  = LIST_DISC,
   [node.id("whatsit")] = {
+    [node.subtype("pdf_colorstack")] =
+      function(n)
+        return n.stack == 0 and NOCOLOR or nil
+      end,
     [node.subtype("special")] = COLOR,
     [node.subtype("pdf_literal")] = COLOR,
     [node.subtype("pdf_save")] = COLOR,
@@ -829,6 +840,8 @@ local function traverse(list, color, dry)
           end
         end
       end
+    elseif t == NOCOLOR then
+      color = ''
     end
   end
   if get_type(list) == LIST then
@@ -848,6 +861,13 @@ function luacolor.process(box)
   local list = tex.getbox(box)
   traverse(list, color, DRY_FALSE)
 end
+
+if luatexbase.callbacktypes.pre_shipout_filter then
+  luatexbase.add_to_callback("pre_shipout_filter", function(list)
+    traverse(list, "", DRY_FALSE)
+    return true
+  end, "luacolor.process")
+end
 %    \end{macrocode}
 %    \end{macro}
 % For recent versions of luaotfload, we can register a callback to
@@ -1129,6 +1149,13 @@ end
 %   \begin{Version}{2020-02-24 v1.15}
 %   \item Grab all possible arguments for \verb|\saveboxresource|\slash \verb|\pdfxform|
 %   \end{Version}
+%   \begin{Version}{2020-04-04 v1.16}
+%   \item Reset color after \verb|pdf_colorstack| whatsits.
+%   \end{Version}
+%   \begin{Version}{2021-02-17 v1.17}
+%   \item Use \LaTeXe's new \verb|pre_shipout_filter| callback if it's available to
+%         allow coloring background and foregrund layer material
+%   \end{Version}
 % \end{History}
 %
 % \PrintIndex
-- 
cgit v1.2.3

