texlive[53933] Master/texmf-dist: luacolor (26feb20)
commits+karl at tug.org
commits+karl at tug.org
Wed Feb 26 23:10:26 CET 2020
Revision: 53933
http://tug.org/svn/texlive?view=revision&revision=53933
Author: karl
Date: 2020-02-26 23:10:25 +0100 (Wed, 26 Feb 2020)
Log Message:
-----------
luacolor (26feb20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf
trunk/Master/texmf-dist/source/latex/luacolor/luacolor.dtx
trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.lua
trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.sty
Modified: trunk/Master/texmf-dist/doc/latex/luacolor/luacolor.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/luacolor/luacolor.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/luacolor/luacolor.dtx 2020-02-26 22:10:12 UTC (rev 53932)
+++ trunk/Master/texmf-dist/source/latex/luacolor/luacolor.dtx 2020-02-26 22:10:25 UTC (rev 53933)
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
% File: luacolor.dtx
-% Version: 2020-02-22 v1.14
+% Version: 2020-02-24 v1.15
% Info: Color support via LuaTeX's attributes
%
% Copyright (C)
@@ -80,7 +80,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: luacolor 2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)}
+\Msg{* Package: luacolor 2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -92,7 +92,7 @@
This is a generated file.
Project: luacolor
-Version: 2020-02-22 v1.14
+Version: 2020-02-24 v1.15
Copyright (C)
2007, 2009-2011 Heiko Oberdiek
@@ -169,7 +169,7 @@
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luacolor.drv}%
- [2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)]%
+ [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2011/11/22]
\usepackage{paralist}
@@ -189,7 +189,7 @@
% \GetFileInfo{luacolor.drv}
%
% \title{The \xpackage{luacolor} package}
-% \date{2020-02-22 v1.14}
+% \date{2020-02-24 v1.15}
% \author{Heiko Oberdiek\thanks
% {Please report any issues at \url{https://github.com/ho-tex/luacolor/issues}}}
%
@@ -332,7 +332,7 @@
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
- [2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)]
+ [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)]
% \end{macrocode}
%
% \subsection{Check for \LuaTeX}
@@ -376,7 +376,7 @@
% \end{macrocode}
% \begin{macrocode}
\begingroup
- \edef\x{\directlua{tex.write("2020-02-22 v1.14")}}%
+ \edef\x{\directlua{tex.write("2020-02-24 v1.15")}}%
\edef\y{%
\directlua{%
if oberdiek.luacolor.getversion then %
@@ -488,16 +488,98 @@
\ifnum\outputmode=\@ne
\let\LuaCol at org@pdfxform\saveboxresource
% \end{macrocode}
+% First we need some helpers to allow expandable code to parse keyword style arguments:
+% \begin{macrocode}
+ \def\LuaCol at iii@i at ii#1#2#3{#3{#1}{#2}}
+ \def\LuaCol at ii@i#1#2{{#2#1}}
+ \def\LuaCol at if@keyword#1#2#3{%
+ \expanded{\unexpanded{\LuaCol at iii@i at ii{#2}{#3}}\expandafter}%
+ \directlua{%
+ token.put_next(token.create(token.scan_keyword(token.scan_string())
+ and '@firstoftwo'
+ or '@secondoftwo'))
+ }{#1}%
+ }
+% \end{macrocode}
+% The following macro scans a integer and expands to a token equivalent to a chardef
+% whose value corresponds to the scanned integer. This allows the integer to be passed
+% around as a undelimited argument.
+% \begin{macrocode}
+ \def\LuaCol at scan@number{%
+ \directlua{
+ token.put_next(token.new(token.scan_int(), token.command_id'char_given'))
+ }%
+ }
+% \end{macrocode}
+% \TeX\ primitives like \cs{saveboxresource} read braced arguments in a special way.
+% Especially they expand everything until they find a left brace. To simulate this, we
+% use Lua to expand everything else:
+% \begin{macrocode}
+ \def\LuaCol at scan@tobrace{%
+ \directlua{
+ local relax, space = token.command_id'relax', token.command_id'spacer'
+ local t
+ repeat
+ t = token.scan_token()
+ until not (t.command == relax or t.command == space)
+ token.put_next(t)
+ }%
+ }
+ \def\LuaCol at scan@boxresource at i#1#2{%
+ \LuaCol at if@keyword{attr}{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at iI{#1#2attr}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@tobrace
+ }{%
+ \LuaCol at scan@boxresource at ii{#1#2}%
+ }%
+ }
+ \def\LuaCol at scan@boxresource at iI#1#2{\LuaCol at scan@boxresource at ii{#1{#2}}}
+ \def\LuaCol at scan@boxresource at ii#1{%
+ \LuaCol at if@keyword{resources}{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at iiI{#1resources}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@tobrace
+ }{%
+ \LuaCol at scan@boxresource at iii{#1}%
+ }%
+ }
+ \def\LuaCol at scan@boxresource at iiI#1#2{\LuaCol at scan@boxresource at iii{#1{#2}}}
+ \def\LuaCol at scan@boxresource at iii#1{%
+ \LuaCol at if@keyword{margin}{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at iv{#1margin }}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@number
+ }{%
+ \LuaCol at scan@boxresource at iv{#1}{}%
+ }%
+ }
+ \def\LuaCol at scan@boxresource at iv#1#2{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at v{#1#2}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@number
+ }
+ \def\LuaCol at scan@boxresource at v#1#2{%
+ \luacolorProcessBox{#2}%
+ \LuaCol at org@pdfxform#1#2%
+ }
+
+% \end{macrocode}
+% This could be written in Lua, but at least upto Lua\TeX~1.11, feeding back too many tokens
+% from Lua to \TeX\ triggers a segmentation fault.
% This is written in Lua so the integer setting is expandable and does not interfere with
% a preceding \verb|\immediate|.
% \begin{macrocode}
\protected\def\saveboxresource{%
- \directlua{
- local c = token.scan_int()
- oberdiek.luacolor.process(c)
- token.put_next(token.create'LuaCol at org@pdfxform', token.new(c, token.command_id'char_given'))
+ \LuaCol at if@keyword{type}{%
+ \expandafter
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at i{type }}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@number
+ }{%
+ \LuaCol at scan@boxresource at i{}{}%
}%
- }%
+ }
% \end{macrocode}
% Legacy alias.
% \begin{macrocode}
@@ -526,7 +608,7 @@
% \begin{macro}{getversion()}
% \begin{macrocode}
function luacolor.getversion()
- tex.write("2020-02-22 v1.14")
+ tex.write("2020-02-24 v1.15")
end
% \end{macrocode}
% \end{macro}
@@ -1044,6 +1126,9 @@
% \verb|\saveboxresource|\slash \verb|\pdfxform|.
% \item Added handler for the color feature of luaotfload
% \end{Version}
+% \begin{Version}{2020-02-24 v1.15}
+% \item Grab all possible arguments for \verb|\saveboxresource|\slash \verb|\pdfxform|
+% \end{Version}
% \end{History}
%
% \PrintIndex
Modified: trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.lua 2020-02-26 22:10:12 UTC (rev 53932)
+++ trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.lua 2020-02-26 22:10:25 UTC (rev 53933)
@@ -9,7 +9,7 @@
-- This is a generated file.
--
-- Project: luacolor
--- Version: 2020-02-22 v1.14
+-- Version: 2020-02-24 v1.15
--
-- Copyright (C)
-- 2007, 2009-2011 Heiko Oberdiek
@@ -41,7 +41,7 @@
local luacolor = oberdiek.luacolor or {}
oberdiek.luacolor = luacolor
function luacolor.getversion()
- tex.write("2020-02-22 v1.14")
+ tex.write("2020-02-24 v1.15")
end
local ifpdf = tonumber(tex.outputmode or tex.pdfoutput) > 0
local prefix
Modified: trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.sty 2020-02-26 22:10:12 UTC (rev 53932)
+++ trunk/Master/texmf-dist/tex/latex/luacolor/luacolor.sty 2020-02-26 22:10:25 UTC (rev 53933)
@@ -9,7 +9,7 @@
%% This is a generated file.
%%
%% Project: luacolor
-%% Version: 2020-02-22 v1.14
+%% Version: 2020-02-24 v1.15
%%
%% Copyright (C)
%% 2007, 2009-2011 Heiko Oberdiek
@@ -89,7 +89,7 @@
\edef\LuaCol at AtEnd{\LuaCol at AtEnd\noexpand\endinput}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
- [2020-02-22 v1.14 Color support via LuaTeX's attributes (HO)]
+ [2020-02-24 v1.15 Color support via LuaTeX's attributes (HO)]
\RequirePackage{color}
\ifx\directlua\@undefined
\PackageError{luacolor}{%
@@ -112,7 +112,7 @@
require("luacolor")%
}
\begingroup
- \edef\x{\directlua{tex.write("2020-02-22 v1.14")}}%
+ \edef\x{\directlua{tex.write("2020-02-24 v1.15")}}%
\edef\y{%
\directlua{%
if oberdiek.luacolor.getversion then %
@@ -183,13 +183,80 @@
\set at color
\ifnum\outputmode=\@ne
\let\LuaCol at org@pdfxform\saveboxresource
- \protected\def\saveboxresource{%
+ \def\LuaCol at iii@i at ii#1#2#3{#3{#1}{#2}}
+ \def\LuaCol at ii@i#1#2{{#2#1}}
+ \def\LuaCol at if@keyword#1#2#3{%
+ \expanded{\unexpanded{\LuaCol at iii@i at ii{#2}{#3}}\expandafter}%
+ \directlua{%
+ token.put_next(token.create(token.scan_keyword(token.scan_string())
+ and '@firstoftwo'
+ or '@secondoftwo'))
+ }{#1}%
+ }
+ \def\LuaCol at scan@number{%
\directlua{
- local c = token.scan_int()
- oberdiek.luacolor.process(c)
- token.put_next(token.create'LuaCol at org@pdfxform', token.new(c, token.command_id'char_given'))
+ token.put_next(token.new(token.scan_int(), token.command_id'char_given'))
}%
- }%
+ }
+ \def\LuaCol at scan@tobrace{%
+ \directlua{
+ local relax, space = token.command_id'relax', token.command_id'spacer'
+ local t
+ repeat
+ t = token.scan_token()
+ until not (t.command == relax or t.command == space)
+ token.put_next(t)
+ }%
+ }
+ \def\LuaCol at scan@boxresource at i#1#2{%
+ \LuaCol at if@keyword{attr}{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at iI{#1#2attr}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@tobrace
+ }{%
+ \LuaCol at scan@boxresource at ii{#1#2}%
+ }%
+ }
+ \def\LuaCol at scan@boxresource at iI#1#2{\LuaCol at scan@boxresource at ii{#1{#2}}}
+ \def\LuaCol at scan@boxresource at ii#1{%
+ \LuaCol at if@keyword{resources}{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at iiI{#1resources}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@tobrace
+ }{%
+ \LuaCol at scan@boxresource at iii{#1}%
+ }%
+ }
+ \def\LuaCol at scan@boxresource at iiI#1#2{\LuaCol at scan@boxresource at iii{#1{#2}}}
+ \def\LuaCol at scan@boxresource at iii#1{%
+ \LuaCol at if@keyword{margin}{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at iv{#1margin }}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@number
+ }{%
+ \LuaCol at scan@boxresource at iv{#1}{}%
+ }%
+ }
+ \def\LuaCol at scan@boxresource at iv#1#2{%
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at v{#1#2}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@number
+ }
+ \def\LuaCol at scan@boxresource at v#1#2{%
+ \luacolorProcessBox{#2}%
+ \LuaCol at org@pdfxform#1#2%
+ }
+
+ \protected\def\saveboxresource{%
+ \LuaCol at if@keyword{type}{%
+ \expandafter
+ \expanded{\unexpanded{\LuaCol at scan@boxresource at i{type }}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol at scan@number
+ }{%
+ \LuaCol at scan@boxresource at i{}{}%
+ }%
+ }
\let\pdfxform\saveboxresource
\fi
\LuaCol at AtEnd%
More information about the tex-live-commits
mailing list.