[latex3-commits] [git/LaTeX3-latex3-latex3] main: Normalise catcodes in color models (fixes #962) (1c9ef635d)
Joseph Wright
joseph.wright at morningstar2.co.uk
Fri Jul 9 22:42:37 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/1c9ef635d0210a6658475b9db1e86ea93b858323
>---------------------------------------------------------------
commit 1c9ef635d0210a6658475b9db1e86ea93b858323
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Fri Jul 9 09:54:10 2021 +0100
Normalise catcodes in color models (fixes #962)
>---------------------------------------------------------------
1c9ef635d0210a6658475b9db1e86ea93b858323
l3kernel/CHANGELOG.md | 3 +++
l3kernel/l3color.dtx | 15 ++++++++++-----
l3kernel/testfiles/m3color002.lvt | 11 +++++++++++
l3kernel/testfiles/m3color002.tlg | 16 ++++++++++++++++
4 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index ba547574c..b53d494e4 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+### Fixed
+- Handling of multiple color models (issue #962)
+
## [2021-06-18]
### Fixed
diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index a6b1b1126..109739958 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -1339,7 +1339,7 @@
% \begin{macro}{\@@_set:nnn}
% \begin{macro}{\@@_set:nn}
% \begin{macro}{\@@_set:nnw}
-% \begin{macro}{\color_set:nnn}
+% \begin{macro}{\color_set:nnn, \@@_set_aux:nnn}
% \begin{macro}{\@@_set_colon:nnw}
% \begin{macro}{\@@_set_loop:nw}
% \begin{macro}{\color_set_eq:nn}
@@ -1403,16 +1403,21 @@
}
}
}
-\cs_new_protected:Npx \color_set:nnn #1#2#3
+\cs_new_protected:Npn \color_set:nnn #1#2#3
{
- \exp_not:N \str_if_eq:nnF {#1} { . }
+ \str_if_eq:nnF {#1} { . }
{
\tl_clear_new:c { l_@@_named_ #1 _tl }
\prop_clear_new:c { l_@@_named_ #1 _prop }
- \exp_not:N \@@_set_colon:nnw {#1} {#3}
- #2 \c_colon_str \c_colon_str \exp_not:N \s_@@_stop
+ \exp_args:Ne \@@_set_aux:nnn { \tl_to_str:n {#2} }
+ {#1} {#3}
}
}
+\cs_new_protected:Npx \@@_set_aux:nnn #1#2#3
+ {
+ \exp_not:N \@@_set_colon:nnw {#2} {#3}
+ #1 \c_colon_str \c_colon_str \exp_not:N \s_@@_stop
+ }
\use:x
{
\cs_new_protected:Npn \exp_not:N \@@_set_colon:nnw
diff --git a/l3kernel/testfiles/m3color002.lvt b/l3kernel/testfiles/m3color002.lvt
index 71300a385..5056216a5 100644
--- a/l3kernel/testfiles/m3color002.lvt
+++ b/l3kernel/testfiles/m3color002.lvt
@@ -136,4 +136,15 @@
}
}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\TEST { Multiple~models }
+ {
+ \color_set:nnn { foo3 } { rgb : Hsb } { 240 , 0.67 , 0.70 }
+ \color_show:n { foo3 }
+ \exp_args:Nnx \color_set:nnn
+ { foo3 } { rgb \c_colon_str Hsb } { 240 , 0.67 , 0.70 }
+ \color_show:n { foo3 }
+ }
+
\END
diff --git a/l3kernel/testfiles/m3color002.tlg b/l3kernel/testfiles/m3color002.tlg
index 9a9d2d0ef..62652ebb0 100644
--- a/l3kernel/testfiles/m3color002.tlg
+++ b/l3kernel/testfiles/m3color002.tlg
@@ -288,3 +288,19 @@ l. ... }
<recently read> }
l. ... }
============================================================
+============================================================
+TEST 9: Multiple models
+============================================================
+Defining \l__color_named_foo3_tl on line ...
+Defining \l__color_named_foo3_prop on line ...
+The color foo3 has the properties:
+> model => rgb
+> rgb => 0.231 0.231 0.70.
+<recently read> }
+l. ... }
+The color foo3 has the properties:
+> model => rgb
+> rgb => 0.231 0.231 0.70.
+<recently read> }
+l. ... }
+============================================================
More information about the latex3-commits
mailing list.