[latex3-commits] [git/LaTeX3-latex3-latex3] master: Drop an (almost) unnecessary \AtBeginDocument (414f2a9dd)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed Jul 22 16:45:21 CEST 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/414f2a9ddc6be26ae51f3911451d5e6e260007e8
>---------------------------------------------------------------
commit 414f2a9ddc6be26ae51f3911451d5e6e260007e8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed Jul 22 15:45:21 2020 +0100
Drop an (almost) unnecessary \AtBeginDocument
Here, with the delayed loading approach for the backend,
we only need the test if loading of expl3 is forced,
color package has not been loaded but it is loaded later.
That is sufficiently unusual that I feel we can tidy up here.
>---------------------------------------------------------------
414f2a9ddc6be26ae51f3911451d5e6e260007e8
l3backend/l3backend-color.dtx | 80 +++++++++++++++++++------------------------
1 file changed, 35 insertions(+), 45 deletions(-)
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 6875ce757..7a72f1062 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -81,32 +81,27 @@
% spot ones (here we need a model and a tint). The \texttt{x}-type expansion
% is there to cover the case where \pkg{xcolor} is in use.
% \begin{macrocode}
-%<*package>
\cs_new_protected:Npn \@@_backend_pickup:N #1 { }
-\AtBeginDocument
+\cs_if_exist:cT { ver at color.sty }
{
- \cs_if_exist:cT { ver at color.sty }
+ \cs_set_protected:Npn \@@_backend_pickup:N #1
{
- \cs_set_protected:Npn \@@_backend_pickup:N #1
+ \exp_args:NV \tl_if_head_is_space:nTF \current at color
{
- \exp_args:NV \tl_if_head_is_space:nTF \current at color
- {
- \tl_set:Nx #1
- {
- { spot }
- { \exp_after:wN \use:n \current at color \c_space_tl 1 }
- }
- }
- {
- \exp_last_unbraced:Nx \@@_backend_pickup:w
- { \current at color } \s_@@_stop #1
- }
+ \tl_set:Nx #1
+ {
+ { spot }
+ { \exp_after:wN \use:n \current at color \c_space_tl 1 }
+ }
+ }
+ {
+ \exp_last_unbraced:Nx \@@_backend_pickup:w
+ { \current at color } \s_@@_stop #1
}
- \cs_new_protected:Npn \@@_backend_pickup:w #1 ~ #2 \s_@@_stop #3
- { \tl_set:Nn #3 { {#1} {#2} } }
}
+ \cs_new_protected:Npn \@@_backend_pickup:w #1 ~ #2 \s_@@_stop #3
+ { \tl_set:Nn #3 { {#1} {#2} } }
}
-%</package>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -166,43 +161,38 @@
% \cs{@@_backend_pickup:w} breaks it apart, because for instance
% \pkg{xcolor} sets it to be instructions to generate a color
% \begin{macrocode}
-%<*package>
\cs_new_protected:Npn \@@_backend_pickup:N #1 { }
-\AtBeginDocument
+\cs_if_exist:cT { ver at color.sty }
{
- \cs_if_exist:cT { ver at color.sty }
+ \cs_set_protected:Npn \@@_backend_pickup:N #1
{
- \cs_set_protected:Npn \@@_backend_pickup:N #1
- {
- \exp_last_unbraced:Nx \@@_backend_pickup:w
- { \current at color } ~ 0 ~ 0 ~ 0 \s_@@_stop #1
- }
- \cs_new_protected:Npn \@@_backend_pickup:w
- #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \s_@@_stop #7
+ \exp_last_unbraced:Nx \@@_backend_pickup:w
+ { \current at color } ~ 0 ~ 0 ~ 0 \s_@@_stop #1
+ }
+ \cs_new_protected:Npn \@@_backend_pickup:w
+ #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 \s_@@_stop #7
+ {
+ \str_if_eq:nnTF {#2} { g }
+ { \tl_set:Nn #7 { { gray } {#1} } }
{
- \str_if_eq:nnTF {#2} { g }
- { \tl_set:Nn #7 { { gray } {#1} } }
+ \str_if_eq:nnTF {#4} { rg }
+ { \tl_set:Nn #7 { { rgb } { #1 ~ #2 ~ #3 } } }
{
- \str_if_eq:nnTF {#4} { rg }
- { \tl_set:Nn #7 { { rgb } { #1 ~ #2 ~ #3 } } }
- {
- \str_if_eq:nnTF {#5} { k }
- { \tl_set:Nn #7 { { cmyk } { #1 ~ #2 ~ #3 ~ #4 } } }
+ \str_if_eq:nnTF {#5} { k }
+ { \tl_set:Nn #7 { { cmyk } { #1 ~ #2 ~ #3 ~ #4 } } }
+ {
+ \str_if_eq:nnTF {#2} { cs }
+ {
+ \tl_set:Nx #7 { { spot } { \use_none:n #1 ~ #5 } }
+ }
{
- \str_if_eq:nnTF {#2} { cs }
- {
- \tl_set:Nx #7 { { spot } { \use_none:n #1 ~ #5 } }
- }
- {
- \tl_set:Nn #7 { { gray } { 0 } }
- }
+ \tl_set:Nn #7 { { gray } { 0 } }
}
- }
+ }
}
}
}
}
-%</package>
% \end{macrocode}
% \end{macro}
% \end{macro}
More information about the latex3-commits
mailing list.