[latex3-commits] [git/LaTeX3-latex3-latex3] main: Add \color_if_exist:n(TF) (db2b264d5)

Joseph Wright joseph.wright at morningstar2.co.uk
Fri Aug 12 10:49:52 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/db2b264d50e658fa893b9d032a436ed33639ca15

>---------------------------------------------------------------

commit db2b264d50e658fa893b9d032a436ed33639ca15
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri Aug 12 09:49:52 2022 +0100

    Add \color_if_exist:n(TF)


>---------------------------------------------------------------

db2b264d50e658fa893b9d032a436ed33639ca15
 l3kernel/CHANGELOG.md |  1 +
 l3kernel/l3color.dtx  | 23 ++++++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 4375c9ebb..fd5fa096f 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -8,6 +8,7 @@ this project uses date-based 'snapshot' version identifiers.
 ## [Unreleased]
 
 ### Added
+- `\color_if_exist:n(TF)`
 - Support for case changing Vietnamese characters with 8-bit engines
 
 ## [2022-08-05]
diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index 8fc7268cd..e8f993778 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -235,6 +235,15 @@
 %   it to be saved to a name.
 % \end{function}
 %
+% \begin{function}[EXP, pTF, added = 2022-08-12]{\color_if_exist:n}
+%   \begin{syntax}
+%     \cs{color_if_exist:n} \Arg{name}
+%     \cs{color_if_exist:n} \Arg{name} \Arg{true code} \Arg{false code}
+%   \end{syntax}
+%   Tests whether \meta{name} is currently defined to provide a color
+%   specification.
+% \end{function}
+%
 % \begin{function}[added = 2021-05-11]{\color_show:n, \color_log:n}
 %   \begin{syntax}
 %     \cs{color_show:n} \Arg{name}
@@ -625,12 +634,12 @@
 %
 % \subsection{Utility functions}
 %
-% \begin{macro}[TF, EXP]{\@@_if_defined:n}
+% \begin{macro}[pTF, EXP]{\color_if_exist:n}
 %   A simple wrapper to avoid needing to have the lookup repeated in too many
 %   places.To guard against a color created in a group, we need to test for
 %   entries in the |prop|.
 %    \begin{macrocode}
-\prg_new_conditional:Npnn \@@_if_defined:n #1 { T, F, TF }
+\prg_new_conditional:Npnn \color_if_exist:n #1 { p , T, F, TF }
   {
     \prop_if_exist:cTF { l_@@_named_ #1 _prop }
       {
@@ -827,7 +836,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parse_aux:nN #1#2
   {
-    \@@_if_defined:nTF {#1}
+    \color_if_exist:nTF {#1}
       { \@@_parse_set_eq:Nn #2 {#1} }
       { \@@_parse:Nw #2#1 ! \s_@@_stop }
     \@@_check_model:N #2
@@ -865,7 +874,7 @@
   }
 \cs_new_protected:Npn \@@_parse:Nw #1#2 ! #3 \s_@@_stop
   {
-    \@@_if_defined:nTF {#2}
+    \color_if_exist:nTF {#2}
       {
         \tl_if_blank:nTF {#3}
           { \@@_parse_set_eq:Nn #1 {#2} }
@@ -938,7 +947,7 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_parse_loop:nn #1#2
   {
-    \@@_if_defined:nTF {#2}
+    \color_if_exist:nTF {#2}
       {
         \@@_extract:nNN {#2} \l_@@_next_model_tl \l_@@_next_value_tl
         \tl_if_eq:NNF \l_@@_model_tl \l_@@_next_model_tl
@@ -1738,7 +1747,7 @@
   }
 \cs_new_protected:Npn \color_set_eq:nn #1#2
   {
-    \@@_if_defined:nTF {#2}
+    \color_if_exist:nTF {#2}
       {
         \tl_clear_new:c { l_@@_named_ #1 _tl }
         \prop_clear_new:c { l_@@_named_ #1 _prop }
@@ -2932,7 +2941,7 @@
     #1 { color } { show }
       {#2}
       {
-        \@@_if_defined:nT {#2}
+        \color_if_exist:nT {#2}
           {
             \exp_args:Nv \@@_show:n { l_@@_named_ #2 _tl }
             \prop_map_function:cN





More information about the latex3-commits mailing list.