[latex3-commits] [git/LaTeX3-latex3-latex3] main: Support legacy if switches in l3keys (b7aceaca2)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Nov 22 15:41:36 CET 2021


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

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

commit b7aceaca254995bdda55d0334d4b577963cadc94
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Nov 22 14:39:49 2021 +0000

    Support legacy if switches in l3keys


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

b7aceaca254995bdda55d0334d4b577963cadc94
 l3kernel/CHANGELOG.md |  3 +++
 l3kernel/l3keys.dtx   | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index db09aee2d..b9e6a33ed 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+- Support for legacy `if` switches in `l3keys`
+
 ### Changed
 - Documentation improvements
 - Implementation of `intarray` data tyep with LuaTeX
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index 6d3b271d0..22da93dcd 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -1989,6 +1989,33 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_legacy_if_set:nn, \@@_legacy_if_inverse:nn}
+% \begin{macro}{\@@_legacy_if_inverse:nnnn}
+%   Much the same as \pkg{expl3} booleans, except we assume that the switch
+%   exists.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_legacy_if_set:nn #1#2
+  { \@@_legacy_if_set:nnnn {#1} {#2} { true } { false } }
+\cs_new_protected:Npn \@@_legacy_if_set_inverse:nn #1#2
+  { \@@_legacy_if_set:nnnn {#1} {#2} { false } { true } }
+\cs_new_protected:Npn \@@_legacy_if_set:nnnn #1#2#3#4
+  {
+    \@@_choice_make:
+    \@@_cmd_set:nx { \l_keys_path_str / true }
+      { \exp_not:c { legacy_if_#2  set_ #3 :n } { \exp_not:n {#1} } }
+    \@@_cmd_set:nx { \l_keys_path_str / false }
+      { \exp_not:c { legacy_if_#2  set_ #4 :n } { \exp_not:n {#1} } }
+    \@@_cmd_set:nn { \l_keys_path_str / unknown }
+      {
+        \msg_error:nnx { keys } { boolean-values-only }
+          \l_keys_key_str
+      }
+    \@@_default_set:n { true }
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{\@@_meta_make:n}
 % \begin{macro}{\@@_meta_make:nn}
 %   To create a meta-key, simply set up to pass data through.
@@ -2337,6 +2364,23 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}
+%   {
+%     .legacy_if_set:n, .legacy_if_gset:n,
+%     .legacy_if_set_inverse:n, .legacy_if_gset_inverse:n
+%   }
+%    \begin{macrocode}
+\cs_new_protected:cpn { \c_@@_props_root_str .legacy_if_set:n } #1
+  { \@@_legacy_if_set:nn {#1} { } }
+\cs_new_protected:cpn { \c_@@_props_root_str .legacy_if_gset:n } #1
+  { \@@_legacy_if_set:nn {#1} { g } }
+\cs_new_protected:cpn { \c_@@_props_root_str .legacy_if_set_inverse:n } #1
+  { \@@_legacy_if_set_inverse:nn {#1} { } }
+\cs_new_protected:cpn { \c_@@_props_root_str .legacy_if_gset_inverse:n } #1
+  { \@@_legacy_if_set_inverse:nn {#1} { g } }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{.meta:n}
 %   Making a meta is handled internally.
 %    \begin{macrocode}





More information about the latex3-commits mailing list.