summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltkeys.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-07-18 03:05:23 +0000
committerNorbert Preining <norbert@preining.info>2022-07-18 03:05:23 +0000
commitfd8e2e79d92b88ea6e5598d3edc6972750a43e38 (patch)
tree73b3a4db7e2bf13d4a1c11b22e294139763fccae /macros/latex-dev/base/ltkeys.dtx
parente7c2b4be636c9df8dea1790bc3eb442059d734f2 (diff)
CTAN sync 202207180305
Diffstat (limited to 'macros/latex-dev/base/ltkeys.dtx')
-rw-r--r--macros/latex-dev/base/ltkeys.dtx64
1 files changed, 46 insertions, 18 deletions
diff --git a/macros/latex-dev/base/ltkeys.dtx b/macros/latex-dev/base/ltkeys.dtx
index c6dfa5f6dd..df671d4259 100644
--- a/macros/latex-dev/base/ltkeys.dtx
+++ b/macros/latex-dev/base/ltkeys.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltkeys.dtx}
- [2022/06/16 v1.0g LaTeX Kernel (Kevyal options)]
+ [2022/07/05 v1.0i LaTeX Kernel (Kevyal options)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{ltkeys.dtx}
@@ -72,6 +72,7 @@
% \begin{itemize}
% \item \texttt{.code} --- execute arbitrary code
% \item \texttt{.if} --- sets a \TeX{} \cs{if...} switch
+% \item \texttt{.ifnot} --- sets an inverted \TeX{} \cs{if...} switch
% \item \texttt{.store} --- stores a value in a macro
% \item \texttt{.usage} -- defines whether the option can be given only
% when loading (\texttt{load}), in the preamble (\texttt{preamble}) or
@@ -152,11 +153,13 @@
%
% \subsection{Key properties}
%
-% \begin{macro}{.code, .if, .store, .usage}
+% \begin{macro}{.code, .if, .ifnot, .store, .usage}
% \changes{v1.0b}{2022/02/05}
% {Create properties in \texttt{ltlkeys}}
% \changes{v1.0c}{2022/02/07}
% {Correct \texttt.{.code} property}
+% \changes{v1.0i}{2022/06/22}
+% {Add \texttt.{.notif} property}
% \begin{macrocode}
\group_begin:
\cs_set_protected:Npn \@@_tmp:nn #1#2
@@ -170,6 +173,7 @@
\@@_tmp:nn
{ code:n } { code }
{ legacy_if_set:n } { if }
+ { legacy_if_set_inverse:n } { ifnot }
{ tl_set:N } { store }
{ usage:n } { usage }
{ \q_recursion_tail } { }
@@ -205,6 +209,7 @@
% \begin{macro}{\@@_options_aux:n}
% \changes{v1.0b}{2022/01/15}
% {Clear option list in end-of-package hook}
+% \changes{v1.0i}{2022/07/05}{Support \cs{CurrentOption}}
% \begin{macro}{\@@_options_end:}
% The main function calls functions to collect up the global and local
% options into \cs{l_@@_options_clist} before calling the
@@ -239,7 +244,8 @@
{ \keys_define:nn {#1} { unknown .undefine: } }
}
\bool_set_true:N \l_@@_options_loading_bool
- \keys_set:nV {#1} \l_@@_options_clist
+ \clist_map_variable:NNn \l_@@_options_clist \CurrentOption
+ { \keys_set:nV {#1} \CurrentOption }
\bool_set_false:N \l_@@_options_loading_bool
\AtEndOfPackage { \cs_set_eq:NN \@unprocessedoptions \scan_stop: }
\@@_option_end:
@@ -258,6 +264,7 @@
%
% \begin{macro}{\@@_options_global:n}
% \changes{v1.0f}{2022/03/18}{Simplify to always cover global options}
+% \changes{v1.0h}{2022/06/20}{Use raw options data}
% Global (class) options are handled differently for \LaTeXe{} packages
% and classes. Hence this function is essentially a check on the current
% file type. The initial test is needed as \LaTeXe{} allows variables to
@@ -266,7 +273,7 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_options_global:n #1
{
- \cs_if_eq:NNF \@classoptionslist \scan_stop:
+ \cs_if_eq:NNF \@raw@classoptionslist \scan_stop:
{
\cs_if_eq:NNTF \@currext \@clsextension
{ \@@_options_class:n {#1} }
@@ -278,8 +285,11 @@
%
% \begin{macro}{\@@_options_class:n}
% \changes{v1.0g}{2022/06/16}{Better handling of option removal}
-% \begin{macro}{\@@_options_remove:nnn}
-% \changes{v1.0g}{2022/06/16}{New function}
+% \changes{v1.0h}{2022/06/19}{Further work on handling of option removal}
+% \changes{v1.0h}{2022/06/20}{Use raw options data}
+% \begin{macro}{\@@_options_class:nnn}
+% \changes{v1.0h}{2022/06/20}{New function}
+% \changes{v1.0i}{2022/07/05}{Correct naming of raw class options storage}
% For classes, each option (stripped of any content after |=|)
% is checked for existence as a key. If found, the option is added to
% the combined list for processing. On the other hand, unused options
@@ -289,36 +299,44 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_options_class:n #1
{
- \cs_if_free:cF { opt@ \@currname . \@currext }
+ \cs_if_free:cF { @raw@opt@ \@currname . \@currext }
{
\keys_if_exist:nnTF {#1} { unknown }
{
\clist_put_right:Nv \l_@@_options_clist
- { opt@ \@currname . \@currext }
+ { @raw@opt@ \@currname . \@currext }
}
{
- \clist_map_inline:cn { opt@ \@currname . \@currext }
+ \clist_map_inline:cn { @raw@opt@ \@currname . \@currext }
{
- \@@_options_remove:enn
+ \exp_args:Ne \@@_options_class:nnn
{ \@@_remove_equals:n {##1} }
{##1} {#1}
}
}
}
}
-\cs_new_protected:Npn \@@_options_remove:nnn #1#2#3
+\cs_new_protected:Npn \@@_options_class:nnn #1#2#3
{
\keys_if_exist:nnTF {#3} {#1}
{ \clist_put_right:Nn \l_@@_options_clist {#2} }
- { \clist_put_right:Nn \@unusedoptionlist {#1} }
+ {
+ \str_if_eq:eeF
+ { \exp_not:v { @raw@opt@ \@currname . \@currext } }
+ { \exp_not:V \@raw@classoptionslist }
+ { \clist_put_right:Nn \@unusedoptionlist {#1} }
+ }
}
-\cs_generate_variant:Nn \@@_options_remove:nnn { e }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@@_options_package:n}
% \changes{v1.0g}{2022/06/16}{Better handling of option removal}
+% \changes{v1.0h}{2022/06/19}{Further work on handling of option removal}
+% \changes{v1.0h}{2022/06/20}{Use raw options data}
+% \begin{macro}{\@@_options_package:nnn}
+% \changes{v1.0h}{2022/06/19}{New function}
% For global options when processing a package, the tasks are slightly
% different from those for a class. The check is the same, but here
% there is nothing to do if the option is not applicable. Each valid
@@ -326,18 +344,28 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_options_package:n #1
{
- \clist_map_inline:Nn \@classoptionslist
+ \clist_map_inline:Nn \@raw@classoptionslist
{
- \@@_options_remove:enn
+ \exp_args:Ne \@@_options_package:nnn
{ \@@_remove_equals:n {##1} }
{##1} {#1}
}
}
+\cs_new_protected:Npn \@@_options_package:nnn #1#2#3
+ {
+ \keys_if_exist:nnT {#3} {#1}
+ {
+ \clist_put_right:Nn \l_@@_options_clist {#2}
+ \clist_remove_all:Nn \@unusedoptionlist {#1}
+ }
+ }
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_options_local:}
-% If local options are found, the are added to the processing list.
+% \changes{v1.0h}{2022/06/20}{Use raw options data}
+% If local options are found, they are added to the processing list.
% \LaTeXe{} stores options for each file in a macro which may or may not
% exist, hence the need to use \cs{cs_if_exist:c}.
% \begin{macrocode}
@@ -345,10 +373,10 @@
{
\cs_if_eq:NNF \@currext \@clsextension
{
- \cs_if_exist:cT { opt@ \@currname . \@currext }
+ \cs_if_exist:cT { @raw@opt@ \@currname . \@currext }
{
\clist_put_right:Nv \l_@@_options_clist
- { opt@ \@currname . \@currext }
+ { @raw@opt@ \@currname . \@currext }
}
}
}