[latex3-commits] [git/LaTeX3-latex3-latex3] main: Implement \color_log:n to complement the show function (see #241) (2d3b508f2)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed May 12 14:36:30 CEST 2021


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

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

commit 2d3b508f20fa14f57419ad6e98ceec27fd62632e
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Tue May 11 12:44:12 2021 +0200

    Implement \color_log:n to complement the show function (see #241)


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

2d3b508f20fa14f57419ad6e98ceec27fd62632e
 l3kernel/CHANGELOG.md             |  2 +-
 l3kernel/l3color.dtx              | 25 +++++++++++++++----------
 l3kernel/testfiles/m3color002.lvt |  4 ++--
 l3kernel/testfiles/m3color002.tlg |  8 ++------
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 8423cd21d..ff82083e4 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -9,7 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Added
 - `\sys_timer:`
-- `\tl_log_analysis:N`, `\tl_log_analysis:n` (issue #241)
+- `\color_log:n`, `\tl_log_analysis:N`, `\tl_log_analysis:n` (issue #241)
 
 ## [2021-05-11]
 
diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index 9b72bdc46..8b95524f6 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -235,12 +235,13 @@
 %   it to be saved to a name.
 % \end{function}
 %
-% \begin{function}{\color_show:n}
+% \begin{function}[added = 2021-05-11]{\color_show:n, \color_log:n}
 %   \begin{syntax}
 %     \cs{color_show:n} \Arg{name}
+%     \cs{color_log:n} \Arg{name}
 %   \end{syntax}
 %   Displays the color specification stored in the \meta{name} on the
-%   terminal.
+%   terminal or log file.
 % \end{function}
 %
 % \section{Selecting colors}
@@ -2508,21 +2509,25 @@
 %
 % \subsection{Diagnostics}
 %
-% \begin{macro}{\color_show:n}
-% \begin{macro}{\@@_show:n}
+% \begin{macro}{\color_show:n, \color_log:n, \@@_show:Nn}
+% \begin{macro}[EXP]{\@@_show:n}
 %   Extract the information about a color and format for the user: the approach
 %   is similar to the keys module here.
 %    \begin{macrocode}
-\cs_new_protected:Npn \color_show:n #1
+\cs_new_protected:Npn \color_show:n
+  { \@@_show:Nn \__kernel_msg_show:nnxxxx }
+\cs_new_protected:Npn \color_log:n
+  { \@@_show:Nn \__kernel_msg_log:nnxxxx }
+\cs_new_protected:Npn \@@_show:Nn #1#2
   {
-    \__kernel_msg_show:nnxxxx { color } { show }
-      {#1}
+    #1 { color } { show }
+      {#2}
       {
-        \@@_if_defined:nT {#1}
+        \@@_if_defined:nT {#2}
           {
-            \exp_args:Nv \@@_show:n { l_@@_named_ #1 _tl }
+            \exp_args:Nv \@@_show:n { l_@@_named_ #2 _tl }
             \prop_map_function:cN
-              { l_@@_named_ #1 _prop }
+              { l_@@_named_ #2 _prop }
               \msg_show_item_unbraced:nn
           }
       }
diff --git a/l3kernel/testfiles/m3color002.lvt b/l3kernel/testfiles/m3color002.lvt
index dcba0d6f7..71300a385 100644
--- a/l3kernel/testfiles/m3color002.lvt
+++ b/l3kernel/testfiles/m3color002.lvt
@@ -20,9 +20,9 @@
 \TEST { Gray~model }
   {
     \color_set:nnn { foo1 } { Gray } { 2 }
-    \color_show:n { foo1 }
+    \color_log:n { foo1 }
     \color_set:nnn { foo1 } { Gray } { 14 }
-    \color_show:n { foo1 }
+    \color_log:n { foo1 }
   }
 
 \TEST { hsb~model }
diff --git a/l3kernel/testfiles/m3color002.tlg b/l3kernel/testfiles/m3color002.tlg
index 0c8654164..9a9d2d0ef 100644
--- a/l3kernel/testfiles/m3color002.tlg
+++ b/l3kernel/testfiles/m3color002.tlg
@@ -8,14 +8,10 @@ Defining \l__color_named_foo1_tl on line ...
 Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  gray
->  gray  =>  0.1333333333333333.
-<recently read> }
-l. ...  }
+>  gray  =>  0.1333333333333333
 The color foo1 has the properties:
 >  model  =>  gray
->  gray  =>  0.9333333333333333.
-<recently read> }
-l. ...  }
+>  gray  =>  0.9333333333333333
 ============================================================
 ============================================================
 TEST 2: hsb model





More information about the latex3-commits mailing list.