summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/luacolor
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-02-27 03:01:13 +0000
committerNorbert Preining <norbert@preining.info>2020-02-27 03:01:13 +0000
commitcfcab0823d16bb9acd6d6a7d3f80a7b2176a6260 (patch)
tree4db3d6f79edb6570d6c812c4962a4322c0605534 /macros/latex/contrib/luacolor
parent2dfd6df5d1db270dc874c6c319d51eed43defb91 (diff)
CTAN sync 202002270301
Diffstat (limited to 'macros/latex/contrib/luacolor')
-rw-r--r--macros/latex/contrib/luacolor/luacolor.dtx111
-rw-r--r--macros/latex/contrib/luacolor/luacolor.pdfbin316983 -> 322070 bytes
2 files changed, 98 insertions, 13 deletions
diff --git a/macros/latex/contrib/luacolor/luacolor.dtx b/macros/latex/contrib/luacolor/luacolor.dtx
index 3073f2be03..68c92f056a 100644
--- a/macros/latex/contrib/luacolor/luacolor.dtx
+++ b/macros/latex/contrib/luacolor/luacolor.dtx
@@ -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 @@ and the derived files
%<*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 @@ and the derived files
% \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 @@ and the derived files
% \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 @@ and the derived files
% \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 @@ and the derived files
\ifnum\outputmode=\@ne
\let\LuaCol@org@pdfxform\saveboxresource
% \end{macrocode}
+% First we need some helpers to allow expandable code to parse keyword style arguments:
+% \begin{macrocode}
+ \def\LuaCol@iii@i@ii#1#2#3{#3{#1}{#2}}
+ \def\LuaCol@ii@i#1#2{{#2#1}}
+ \def\LuaCol@if@keyword#1#2#3{%
+ \expanded{\unexpanded{\LuaCol@iii@i@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@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@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@scan@boxresource@i#1#2{%
+ \LuaCol@if@keyword{attr}{%
+ \expanded{\unexpanded{\LuaCol@scan@boxresource@iI{#1#2attr}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol@scan@tobrace
+ }{%
+ \LuaCol@scan@boxresource@ii{#1#2}%
+ }%
+ }
+ \def\LuaCol@scan@boxresource@iI#1#2{\LuaCol@scan@boxresource@ii{#1{#2}}}
+ \def\LuaCol@scan@boxresource@ii#1{%
+ \LuaCol@if@keyword{resources}{%
+ \expanded{\unexpanded{\LuaCol@scan@boxresource@iiI{#1resources}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol@scan@tobrace
+ }{%
+ \LuaCol@scan@boxresource@iii{#1}%
+ }%
+ }
+ \def\LuaCol@scan@boxresource@iiI#1#2{\LuaCol@scan@boxresource@iii{#1{#2}}}
+ \def\LuaCol@scan@boxresource@iii#1{%
+ \LuaCol@if@keyword{margin}{%
+ \expanded{\unexpanded{\LuaCol@scan@boxresource@iv{#1margin }}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol@scan@number
+ }{%
+ \LuaCol@scan@boxresource@iv{#1}{}%
+ }%
+ }
+ \def\LuaCol@scan@boxresource@iv#1#2{%
+ \expanded{\unexpanded{\LuaCol@scan@boxresource@v{#1#2}}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol@scan@number
+ }
+ \def\LuaCol@scan@boxresource@v#1#2{%
+ \luacolorProcessBox{#2}%
+ \LuaCol@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@org@pdfxform', token.new(c, token.command_id'char_given'))
+ \LuaCol@if@keyword{type}{%
+ \expandafter
+ \expanded{\unexpanded{\LuaCol@scan@boxresource@i{type }}%
+ \expandafter\expandafter\expandafter}%
+ \LuaCol@scan@number
+ }{%
+ \LuaCol@scan@boxresource@i{}{}%
}%
- }%
+ }
% \end{macrocode}
% Legacy alias.
% \begin{macrocode}
@@ -526,7 +608,7 @@ oberdiek.luacolor = luacolor
% \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 @@ end
% \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
diff --git a/macros/latex/contrib/luacolor/luacolor.pdf b/macros/latex/contrib/luacolor/luacolor.pdf
index edcf74c136..b01a36cc92 100644
--- a/macros/latex/contrib/luacolor/luacolor.pdf
+++ b/macros/latex/contrib/luacolor/luacolor.pdf
Binary files differ