diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-12 21:18:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-12 21:18:16 +0000 |
commit | 37427a439f796a7ef14eb367dcced3cf4898442c (patch) | |
tree | 3c8c75c4d5c6d3cff3d2c8cb6d4089d38e732c3d | |
parent | 2233f3aaaa222731e5a13bbc44d4c64958838137 (diff) |
zref-clever (12feb22)
git-svn-id: svn://tug.org/texlive/trunk@61994 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf | bin | 1248656 -> 1255128 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf | bin | 312992 -> 312995 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex | 1 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx | 1209 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty | 1017 |
6 files changed, 1201 insertions, 1035 deletions
diff --git a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md index 66d7e69c3d1..5023b04b7ae 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.1-alpha...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.2.2-alpha...HEAD) + +## [v0.2.2-alpha](https://github.com/gusbrs/zref-clever/compare/v0.2.1-alpha...v0.2.2-alpha) (2022-02-11) + +### Changed +- (Internal) Option variables setting was reviewed, ensuring proper scope is + in use and that they are always properly declared. `expl3` debugging + enabled in regression tests. ## [v0.2.1-alpha](https://github.com/gusbrs/zref-clever/compare/v0.2.0-alpha...v0.2.1-alpha) (2022-02-07) diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf Binary files differindex 9e8212f0830..c77a6ef340c 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf Binary files differindex f623839df64..2b439d1d54c 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex index 3079e6384a0..e26992005d6 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex @@ -2304,6 +2304,7 @@ were generously provided by (in chronological order): % 2021-10-06: https://tex.stackexchange.com/a/617998 % 2021-10-21: https://github.com/latex3/latex2e/pull/699 % 2022-01-12: https://tex.stackexchange.com/questions/629946/#comment1571118_629946 + % 2022-01-11: https://tex.stackexchange.com/questions/633341/#comment1579825_633347 Enrico Gregorio, % 2021-08-20: https://tex.stackexchange.com/a/611385 % 2021-08-20: https://tex.stackexchange.com/q/611370/#comment1529282_611385 diff --git a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx index e6c175d33f2..5464fb5575f 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx @@ -162,7 +162,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-clever} {2022-02-07} {0.2.1-alpha} +\ProvidesExplPackage {zref-clever} {2022-02-11} {0.2.2-alpha} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -643,6 +643,11 @@ Option~'check'~requested~\msg_line_context:.~ But~package~'zref-check'~is~not~loaded,~can't~run~the~checks. } +\msg_new:nnn { zref-clever } { zref-check-too-old } + { + Option~'check'~requested~\msg_line_context:.~ + But~'zref-check'~newer~than~'#1'~is~required,~can't~run~the~checks. + } \msg_new:nnn { zref-clever } { missing-type } { Reference~type~undefined~for~label~'#1'~\msg_line_context:. } \msg_new:nnn { zref-clever } { missing-property } @@ -856,56 +861,158 @@ % \end{macro} % % +% \begin{macro}[EXP]{\@@_opt_var_set_bool:n} +% The \LaTeX3 programming layer does not have the concept of a variable +% \emph{existing} only locally, it also considers an ``error'' if an +% assignment is made to a variable which was not previously declared, but +% declaration is always global, which means that ``setting a local variable +% at a local scope'', given these requirements, results in it existing, and +% being empty, globally. Therefore, we need an independent mechanism from +% the mere existence of a variable to keep track of whether variables are +% ``set'' or ``unset'', within the logic of the precedence rules for options +% in different scopes. \cs{@@_opt_var_set_bool:n} expands to the name of +% the boolean variable used to track this state for \meta{option var}. See +% discussion with \contributor{Phelype Oleinik} at +% \url{https://tex.stackexchange.com/questions/633341/#comment1579825_633347} +% \begin{syntax} +% \cs{@@_opt_var_set_bool:n} \Arg{option var} +% \end{syntax} +% \begin{macrocode} +\cs_new:Npn \@@_opt_var_set_bool:n #1 + { \cs_to_str:N #1 _is_set_bool } +% \end{macrocode} +% \end{macro} +% +% % % \begin{macro} % { -% \@@_opt_tl_unset:N , -% \@@_opt_tl_gunset:N , +% \@@_opt_tl_set:Nn , +% \@@_opt_tl_clear:N , +% \@@_opt_tl_gset:Nn , +% \@@_opt_tl_gclear:N , % } -% Unset \meta{option tl}. These functions \emph{define} what means to be -% unset for an option token list, and it must match what the conditional -% \cs{@@_opt_tl_if_set:N} tests for. +% \begin{syntax} +% \cs{@@_opt_tl_set:N} \Arg{option tl} \Arg{value} +% \cs{@@_opt_tl_clear:N} \Arg{option tl} +% \cs{@@_opt_tl_gset:N} \Arg{option tl} \Arg{value} +% \cs{@@_opt_tl_gclear:N} \Arg{option tl} +% \end{syntax} +% \begin{macrocode} +\cs_new_protected:Npn \@@_opt_tl_set:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_set:Nn #1 {#2} + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_tl_set:Nn { cn } +\cs_new_protected:Npn \@@_opt_tl_clear:N #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_clear:N #1 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_tl_clear:N { c } +\cs_new_protected:Npn \@@_opt_tl_gset:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } +\cs_generate_variant:Nn \@@_opt_tl_gset:Nn { cn } +\cs_new_protected:Npn \@@_opt_tl_gclear:N #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gclear:N #1 + } +\cs_generate_variant:Nn \@@_opt_tl_gclear:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_opt_tl_unset:N} +% Unset \meta{option tl}. % \begin{syntax} % \cs{@@_opt_tl_unset:N} \Arg{option tl} -% \cs{@@_opt_tl_gunset:N} \Arg{option tl} % \end{syntax} % \begin{macrocode} \cs_new_protected:Npn \@@_opt_tl_unset:N #1 - { \tl_set_eq:NN #1 \c_novalue_tl } -\cs_new_protected:Npn \@@_opt_tl_gunset:N #1 - { \tl_gset_eq:NN #1 \c_novalue_tl } + { + \tl_if_exist:NT #1 + { + \tl_clear:N #1 % ? + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \@@_opt_var_set_bool:n {#1} } } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + } + } \cs_generate_variant:Nn \@@_opt_tl_unset:N { c } -\cs_generate_variant:Nn \@@_opt_tl_gunset:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP,TF]{\@@_opt_tl_if_set:N} +% This conditional \emph{defines} what means to be unset for a token list +% option. Note that the ``set bool'' not existing signals that the variable +% \emph{is set}, that would be the case of all global option variables +% (language-specific ones). But this means care should be taken to always +% define and set the ``set bool'' for local variables. % \begin{syntax} % \cs{@@_opt_tl_if_set:N(TF)} \Arg{option tl} \Arg{true} \Arg{false} % \end{syntax} % \begin{macrocode} \prg_new_conditional:Npnn \@@_opt_tl_if_set:N #1 { F , TF } { - \bool_lazy_and:nnTF - { \tl_if_exist_p:N #1 } - { ! \tl_if_novalue_p:n {#1} } - { \prg_return_true: } + \tl_if_exist:NTF #1 + { + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \@@_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } { \prg_return_false: } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_opt_tl_gset_if_new:Nn} +% \begin{macro} +% { +% \@@_opt_tl_gset_if_new:Nn , +% \@@_opt_tl_gclear_if_new:N , +% } % \begin{syntax} % \cs{@@_opt_tl_gset_if_new:Nn} \Arg{option tl} \Arg{value} +% \cs{@@_opt_tl_gclear_if_new:N} \Arg{option tl} % \end{syntax} % \begin{macrocode} \cs_new_protected:Npn \@@_opt_tl_gset_if_new:Nn #1#2 { \@@_opt_tl_if_set:NF #1 - { \tl_gset:Nn #1 {#2} } + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } } \cs_generate_variant:Nn \@@_opt_tl_gset_if_new:Nn { cn } +\cs_new_protected:Npn \@@_opt_tl_gclear_if_new:N #1 + { + \@@_opt_tl_if_set:NF #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gclear:N #1 + } + } +\cs_generate_variant:Nn \@@_opt_tl_gclear_if_new:N { c } % \end{macrocode} % \end{macro} % @@ -935,48 +1042,81 @@ % { % \@@_opt_seq_set_clist_split:Nn , % \@@_opt_seq_gset_clist_split:Nn , +% \@@_opt_seq_set_eq:NN , +% \@@_opt_seq_gset_eq:NN , % } % \begin{syntax} % \cs{@@_opt_seq_set_clist_split:Nn} \Arg{option seq} \Arg{value} % \cs{@@_opt_seq_gset_clist_split:Nn} \Arg{option seq} \Arg{value} +% \cs{@@_opt_seq_set_eq:NN} \Arg{option seq} \Arg{seq var} +% \cs{@@_opt_seq_gset_eq:NN} \Arg{option seq} \Arg{seq var} % \end{syntax} % \begin{macrocode} \cs_new_protected:Npn \@@_opt_seq_set_clist_split:Nn #1#2 { \seq_set_split:Nnn #1 { , } {#2} } \cs_new_protected:Npn \@@_opt_seq_gset_clist_split:Nn #1#2 { \seq_gset_split:Nnn #1 { , } {#2} } +\cs_new_protected:Npn \@@_opt_seq_set_eq:NN #1#2 + { + \seq_if_exist:NF #1 + { \seq_new:N #1 } + \seq_set_eq:NN #1 #2 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_seq_set_eq:NN { cN } +\cs_new_protected:Npn \@@_opt_seq_gset_eq:NN #1#2 + { + \seq_if_exist:NF #1 + { \seq_new:N #1 } + \seq_gset_eq:NN #1 #2 + } +\cs_generate_variant:Nn \@@_opt_seq_gset_eq:NN { cN } % \end{macrocode} % \end{macro} % -% \begin{macro} -% { -% \@@_opt_seq_unset:N , -% \@@_opt_seq_gunset:N , -% } -% Unset \meta{option seq}. These functions \emph{define} what means to be -% unset for an option sequence, and it must match what the conditional -% \cs{@@_opt_seq_if_set:N} tests for. +% \begin{macro}{\@@_opt_seq_unset:N} +% Unset \meta{option seq}. % \begin{syntax} % \cs{@@_opt_seq_unset:N} \Arg{option seq} -% \cs{@@_opt_seq_gunset:N} \Arg{option seq} % \end{syntax} % \begin{macrocode} \cs_new_protected:Npn \@@_opt_seq_unset:N #1 - { \cs_set_eq:NN #1 \scan_stop: } -\cs_new_protected:Npn \@@_opt_seq_gunset:N #1 - { \cs_gset_eq:NN #1 \scan_stop: } + { + \seq_if_exist:NT #1 + { + \seq_clear:N #1 % ? + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \@@_opt_var_set_bool:n {#1} } } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + } + } \cs_generate_variant:Nn \@@_opt_seq_unset:N { c } -\cs_generate_variant:Nn \@@_opt_seq_gunset:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP,TF]{\@@_opt_seq_if_set:N} +% This conditional \emph{defines} what means to be unset for a sequence +% option. % \begin{syntax} % \cs{@@_opt_seq_if_set:N(TF)} \Arg{option seq} \Arg{true} \Arg{false} % \end{syntax} % \begin{macrocode} \prg_new_conditional:Npnn \@@_opt_seq_if_set:N #1 { F , TF } - { \seq_if_exist:NTF #1 { \prg_return_true: } { \prg_return_false: } } + { + \seq_if_exist:NTF #1 + { + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \@@_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } + { \prg_return_false: } + } \prg_generate_conditional_variant:Nnn \@@_opt_seq_if_set:N { c } { F , TF } % \end{macrocode} @@ -1004,44 +1144,103 @@ % % % -% \begin{macro} -% { -% \@@_opt_bool_unset:N , -% \@@_opt_bool_gunset:N , -% } -% Unset \meta{option bool}. These functions \emph{define} what means to be -% unset for an option boolean, and it must match what the conditional -% \cs{@@_opt_bool_if_set:N} tests for. The particular definition we are -% employing here has some relevant implications. Setting the boolean -% variable to \cs{scan_stop:} (aka, \cs{relax}) means we can \emph{never} -% test the variable without first testing if it is \emph{set}. -% \cs{@@_opt_bool_if:N} does this conveniently. +% \begin{macro}{\@@_opt_bool_unset:N} +% Unset \meta{option bool}. % \begin{syntax} % \cs{@@_opt_bool_unset:N} \Arg{option bool} -% \cs{@@_opt_bool_gunset:N} \Arg{option bool} % \end{syntax} % \begin{macrocode} \cs_new_protected:Npn \@@_opt_bool_unset:N #1 - { \cs_set_eq:NN #1 \scan_stop: } -\cs_new_protected:Npn \@@_opt_bool_gunset:N #1 - { \cs_gset_eq:NN #1 \scan_stop: } + { + \bool_if_exist:NT #1 + { + % \bool_set_false:N #1 % ? + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \@@_opt_var_set_bool:n {#1} } } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + } + } \cs_generate_variant:Nn \@@_opt_bool_unset:N { c } -\cs_generate_variant:Nn \@@_opt_bool_gunset:N { c } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP,TF]{\@@_opt_bool_if_set:N} +% This conditional \emph{defines} what means to be unset for a boolean +% option. % \begin{syntax} % \cs{@@_opt_bool_if_set:N(TF)} \Arg{option bool} \Arg{true} \Arg{false} % \end{syntax} % \begin{macrocode} \prg_new_conditional:Npnn \@@_opt_bool_if_set:N #1 { F , TF } - { \bool_if_exist:NTF #1 { \prg_return_true: } { \prg_return_false: } } + { + \bool_if_exist:NTF #1 + { + \bool_if_exist:cTF { \@@_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \@@_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } + { \prg_return_false: } + } \prg_generate_conditional_variant:Nnn \@@_opt_bool_if_set:N { c } { F , TF } % \end{macrocode} % \end{macro} % +% \begin{macro} +% { +% \@@_opt_bool_set_true:N , +% \@@_opt_bool_set_false:N , +% \@@_opt_bool_gset_true:N , +% \@@_opt_bool_gset_false:N , +% } +% \begin{syntax} +% \cs{@@_opt_bool_set_true:N} \Arg{option bool} +% \cs{@@_opt_bool_set_false:N} \Arg{option bool} +% \cs{@@_opt_bool_gset_true:N} \Arg{option bool} +% \cs{@@_opt_bool_gset_false:N} \Arg{option bool} +% \end{syntax} +% \begin{macrocode} +\cs_new_protected:Npn \@@_opt_bool_set_true:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_set_true:N #1 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_bool_set_true:N { c } +\cs_new_protected:Npn \@@_opt_bool_set_false:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_set_false:N #1 + \bool_if_exist:cF { \@@_opt_var_set_bool:n {#1} } + { \bool_new:c { \@@_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \@@_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \@@_opt_bool_set_false:N { c } +\cs_new_protected:Npn \@@_opt_bool_gset_true:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_gset_true:N #1 + } +\cs_generate_variant:Nn \@@_opt_bool_gset_true:N { c } +\cs_new_protected:Npn \@@_opt_bool_gset_false:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_gset_false:N #1 + } +\cs_generate_variant:Nn \@@_opt_bool_gset_false:N { c } +% \end{macrocode} +% \end{macro} +% % % \begin{macro}[TF]{\@@_opt_bool_get:NN} % \begin{syntax} @@ -1104,7 +1303,7 @@ % key'' (\texttt{key=} or \texttt{key=\{\}}) from a ``key with no value'' % (\texttt{key}). This distinction is captured internally by the lower-level % key parsing, but must be made explicit in \cs{keys_define:nn} by means of -% the \texttt{.default:x} property of the key. For the technique, by +% the \texttt{.default:o} property of the key. For the technique, by % \contributor{Jonathan P.\ Spratte}, aka `Skillmon', and some discussion % about it, including further insights by \contributor{Phelype Oleinik}, see % \url{https://tex.stackexchange.com/q/614690} and @@ -1118,12 +1317,18 @@ % ``key with no value'' is a handy and expected shorthand for % \texttt{key=true}. Therefore, for reference format option booleans, we use % a third value ``\texttt{unset}'' for this purpose. And similarly for -% ``choice'' options. In the language files the ``unsetting'' behavior is -% less meaningful, since they only change any variable if it is unset to start -% with, so that unsetting an unset variable would be redundant. However, for -% UI symmetry also in the language files keys with no value should not be -% considered ``empty'' and boolean \texttt{unset} values should exist. They -% are just no-op. +% ``choice'' options. +% +% However, ``unsetting'' options is only supported at the general and +% reference type levels, that is, at \cs{zcsetup}, at \cs{zcref}, and at +% \cs{zcRefTypeSetup}. For language-specific options -- in the language files +% or at \cs{zcLanguageSetup} -- there is no unsetting, an option which has +% been set can there only be changed to another value. This for two reasons. +% First, these are low precedence levels, so it is less meaningful to be able +% to unset these options. Second, these settings can only be done in the +% preamble (or the package itself). They are meant to be global. So, do it +% once, do it right, and if you need to locally change something along the +% document, use a higher precedence level. % % % \begin{macro} @@ -1150,30 +1355,36 @@ % % \begin{macro} % { -% \c_@@_rf_opts_tl_not_type_specific_seq , -% \c_@@_rf_opts_tl_maybe_type_specific_seq , -% \c_@@_rf_opts_seq_refbounds_seq , -% \c_@@_rf_opts_bool_maybe_type_specific_seq , -% \c_@@_rf_opts_tl_type_names_seq , -% \c_@@_rf_opts_tl_font_seq , -% \c_@@_rf_opts_tl_typesetup_seq , -% \c_@@_rf_opts_tl_reference_seq , +% \g_@@_rf_opts_tl_not_type_specific_seq , +% \g_@@_rf_opts_tl_maybe_type_specific_seq , +% \g_@@_rf_opts_seq_refbounds_seq , +% \g_@@_rf_opts_bool_maybe_type_specific_seq , +% \g_@@_rf_opts_tl_type_names_seq , +% \g_@@_rf_opts_tl_typesetup_seq , +% \g_@@_rf_opts_tl_reference_seq , % } % Lists of reference format options in ``categories''. Since these % options are set in different scopes, and at different places, storing % the actual lists in centralized variables makes the job not only easier -% later on, but also keeps things consistent. +% later on, but also keeps things consistent. These variables are +% \emph{constants}, but I don't seem to be able to find a way to +% concatenate two constants into a third one without triggering \LaTeX3 +% debug error ``Inconsistent local/global assignment''. And repeating +% things in a new \cs{seq_const_from_clist:Nn} defeats the purpose of +% these variables. % \begin{macrocode} -\seq_const_from_clist:Nn - \c_@@_rf_opts_tl_not_type_specific_seq +\seq_new:N \g_@@_rf_opts_tl_not_type_specific_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_tl_not_type_specific_seq { tpairsep , tlistsep , tlastsep , notesep , } -\seq_const_from_clist:Nn - \c_@@_rf_opts_tl_maybe_type_specific_seq +\seq_new:N \g_@@_rf_opts_tl_maybe_type_specific_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_tl_maybe_type_specific_seq { namesep , pairsep , @@ -1183,8 +1394,9 @@ namefont , reffont , } -\seq_const_from_clist:Nn - \c_@@_rf_opts_seq_refbounds_seq +\seq_new:N \g_@@_rf_opts_seq_refbounds_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_seq_refbounds_seq { refbounds-first , refbounds-first-sg , @@ -1197,8 +1409,9 @@ refbounds-last-pe , refbounds-last-re , } -\seq_const_from_clist:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq +\seq_new:N \g_@@_rf_opts_bool_maybe_type_specific_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_bool_maybe_type_specific_seq { cap , abbrev , @@ -1210,8 +1423,9 @@ % their values queried by \cs{@@_get_rf_opt_tl:nnnN}, but by % \cs{@@_type_name_setup:}. % \begin{macrocode} -\seq_const_from_clist:Nn - \c_@@_rf_opts_tl_type_names_seq +\seq_new:N \g_@@_rf_opts_tl_type_names_seq +\seq_gset_from_clist:Nn + \g_@@_rf_opts_tl_type_names_seq { Name-sg , name-sg , @@ -1225,20 +1439,20 @@ % \end{macrocode} % And, finally, some combined groups of the above variables, for convenience. % \begin{macrocode} -\seq_new:N \c_@@_rf_opts_tl_typesetup_seq -\seq_gconcat:NNN \c_@@_rf_opts_tl_typesetup_seq - \c_@@_rf_opts_tl_maybe_type_specific_seq - \c_@@_rf_opts_tl_type_names_seq -\seq_new:N \c_@@_rf_opts_tl_reference_seq -\seq_gconcat:NNN \c_@@_rf_opts_tl_reference_seq - \c_@@_rf_opts_tl_not_type_specific_seq - \c_@@_rf_opts_tl_maybe_type_specific_seq +\seq_new:N \g_@@_rf_opts_tl_typesetup_seq +\seq_gconcat:NNN \g_@@_rf_opts_tl_typesetup_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq + \g_@@_rf_opts_tl_type_names_seq +\seq_new:N \g_@@_rf_opts_tl_reference_seq +\seq_gconcat:NNN \g_@@_rf_opts_tl_reference_seq + \g_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq % \end{macrocode} % \end{macro} % % -% We set here also the ``derived'' \texttt{refbounds} options, which are the -% same for every option scope. +% We set here also the ``derived'' \texttt{refbounds} options, which are +% (almost) the same for every option scope. % % \begin{macrocode} \clist_map_inline:nn @@ -1258,42 +1472,69 @@ refbounds-first-pb = {##1} , refbounds-first-rb = {##1} , } , - +refbounds-first .default:x = \c_novalue_tl , +refbounds-mid .meta:n = { refbounds-mid = {##1} , refbounds-mid-rb = {##1} , refbounds-mid-re = {##1} , } , - +refbounds-mid .default:x = \c_novalue_tl , +refbounds-last .meta:n = { refbounds-last = {##1} , refbounds-last-pe = {##1} , refbounds-last-re = {##1} , } , - +refbounds-last .default:x = \c_novalue_tl , +refbounds-rb .meta:n = { refbounds-first-rb = {##1} , refbounds-mid-rb = {##1} , } , - +refbounds-rb .default:x = \c_novalue_tl , +refbounds-re .meta:n = { refbounds-mid-re = {##1} , refbounds-last-re = {##1} , } , - +refbounds-re .default:x = \c_novalue_tl , +refbounds .meta:n = { +refbounds-first = {##1} , +refbounds-mid = {##1} , +refbounds-last = {##1} , } , - +refbounds .default:x = \c_novalue_tl , refbounds .meta:n = { +refbounds = {##1} } , - refbounds .default:x = \c_novalue_tl , + } + } +\clist_map_inline:nn + { + reference , + typesetup , + } + { + \keys_define:nn { zref-clever/ #1 } + { + +refbounds-first .default:o = \c_novalue_tl , + +refbounds-mid .default:o = \c_novalue_tl , + +refbounds-last .default:o = \c_novalue_tl , + +refbounds-rb .default:o = \c_novalue_tl , + +refbounds-re .default:o = \c_novalue_tl , + +refbounds .default:o = \c_novalue_tl , + refbounds .default:o = \c_novalue_tl , + } + } +\clist_map_inline:nn + { + langsetup , + langfile , + } + { + \keys_define:nn { zref-clever/ #1 } + { + +refbounds-first .value_required:n = true , + +refbounds-mid .value_required:n = true , + +refbounds-last .value_required:n = true , + +refbounds-rb .value_required:n = true , + +refbounds-re .value_required:n = true , + +refbounds .value_required:n = true , + refbounds .value_required:n = true , } } % \end{macrocode} @@ -1302,6 +1543,30 @@ % \subsection{Languages} % % +% \cs{l_@@_current_language_tl} is an internal alias for \pkg{babel}'s +% \cs{languagename} or \pkg{polyglossia}'s \cs{mainbabelname} and, if none of +% them is loaded, we set it to \texttt{english}. \cs{l_@@_main_language_tl} +% is an internal alias for \pkg{babel}'s \cs{bbl@main@language} or for +% \pkg{polyglossia}'s \cs{mainbabelname}, as the case may be. Note that for +% \pkg{polyglossia} we get \pkg{babel}'s language names, so that we only need +% to handle those internally. \cs{l_@@_ref_language_tl} is the internal +% variable which stores the language in which the reference is to be made. +% +% \begin{macrocode} +\tl_new:N \l_@@_ref_language_tl +\tl_new:N \l_@@_current_language_tl +\tl_new:N \l_@@_main_language_tl +% \end{macrocode} +% +% \begin{macro}{\l_zrefclever_ref_language_tl} +% A public version of \cs{l_@@_ref_language_tl} for use in \pkg{zref-vario}. +% \begin{macrocode} +\tl_new:N \l_zrefclever_ref_language_tl +\tl_set:Nn \l_zrefclever_ref_language_tl { \l_@@_ref_language_tl } +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}[EXP]{\@@_language_varname:n} % Defines, and leaves in the input stream, the csname of the variable used % to store the \meta{base language} (as the value of this variable) for @@ -1413,6 +1678,7 @@ { \@@_language_if_declared:nTF {#2} { + \tl_new:c { \@@_language_varname:n {#1} } \tl_gset:cx { \@@_language_varname:n {#1} } { \tl_use:c { \@@_language_varname:n {#2} } } } @@ -1430,6 +1696,11 @@ { declension .code:n = { + \seq_new:c + { + \@@_opt_varname_language:enn + { \l_@@_setup_language_tl } { declension } { seq } + } \seq_gset_from_clist:cn { \@@_opt_varname_language:enn @@ -1440,6 +1711,11 @@ declension .value_required:n = true , gender .code:n = { + \seq_new:c + { + \@@_opt_varname_language:enn + { \l_@@_setup_language_tl } { gender } { seq } + } \seq_gset_from_clist:cn { \@@_opt_varname_language:enn @@ -1451,6 +1727,11 @@ allcaps .choices:nn = { true , false } { + \bool_new:c + { + \@@_opt_varname_language:enn + { \l_@@_setup_language_tl } { allcaps } { bool } + } \use:c { bool_gset_ \l_keys_choice_tl :c } { \@@_opt_varname_language:enn @@ -1775,7 +2056,7 @@ } , case .value_required:n = true , - gender .default:x = \c_novalue_tl , + gender .value_required:n = true , gender .code:n = { \seq_if_empty:NTF \l_@@_lang_gender_seq @@ -1790,20 +2071,27 @@ { option-only-type-specific } { gender } } { - \tl_if_novalue:nF {#1} + \seq_clear:N \l_tmpa_seq + \clist_map_inline:nn {#1} { - \seq_clear:N \l_tmpa_seq - \clist_map_inline:nn {#1} + \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} + { \seq_put_right:Nn \l_tmpa_seq {##1} } { - \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} - { \seq_put_right:Nn \l_tmpa_seq {##1} } - { - \msg_info:nnxx { zref-clever } - { gender-not-declared } - { \l_@@_setup_language_tl } {##1} - } + \msg_info:nnxx { zref-clever } + { gender-not-declared } + { \l_@@_setup_language_tl } {##1} } - \@@_opt_seq_if_set:cF + } + \@@_opt_seq_if_set:cF + { + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { gender } + { seq } + } + { + \seq_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -1811,42 +2099,37 @@ { gender } { seq } } + \seq_gset_eq:cN { - \seq_gset_eq:cN - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { gender } - { seq } - } - \l_tmpa_seq + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { gender } + { seq } } + \l_tmpa_seq } } } } , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + {#1} { tl } } + {##1} } { \msg_info:nnn { zref-clever } @@ -1856,44 +2139,39 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_tl_maybe_type_specific_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + {#1} { tl } } + {##1} } { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + {#1} { tl } } + {##1} } } , } } \keys_define:nn { zref-clever/langfile } { + endrange .value_required:n = true , endrange .code:n = { \str_case:nnF {#1} @@ -1902,38 +2180,34 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } - { } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangefunc } { tl } } - { } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1948,13 +2222,12 @@ { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { \@@_opt_tl_gset_if_new:cn @@ -1965,14 +2238,13 @@ { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1987,13 +2259,12 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { \@@_opt_tl_gset_if_new:cn @@ -2004,14 +2275,13 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -2026,13 +2296,12 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangeprop } { tl } } - { } } { \@@_opt_tl_gset_if_new:cn @@ -2043,19 +2312,15 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \@@_opt_tl_gset_if_new:cn + \@@_opt_tl_gclear_if_new:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangeprop } { tl } } - { } } } - - { unset } - { } } { \tl_if_empty:nTF {#1} @@ -2109,14 +2374,13 @@ } } } , - endrange .value_required:n = true , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_type_names_seq + \g_@@_rf_opts_tl_type_names_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl @@ -2127,113 +2391,101 @@ { \tl_if_empty:NTF \l_@@_lang_decl_case_tl { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + {#1} { tl } } + {##1} } { - \tl_if_novalue:nF {##1} + \@@_opt_tl_gset_if_new:cn { - \@@_opt_tl_gset_if_new:cn - { - \@@_opt_varname_lang_type:eeen - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { \l_@@_lang_decl_case_tl - #1 } { tl } - } - {##1} + \@@_opt_varname_lang_type:eeen + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { \l_@@_lang_decl_case_tl - #1 } { tl } } + {##1} } } } , } } \seq_map_inline:Nn - \c_@@_rf_opts_seq_refbounds_seq + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nF {##1} + \@@_opt_seq_if_set:cF + { + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } {#1} { seq } + } { - \@@_opt_seq_if_set:cF + \seq_gclear:N \g_tmpa_seq + \@@_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { seq } + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } } { - \seq_gclear:N \g_tmpa_seq - \@@_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } + \@@_opt_seq_gset_eq:cN { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { seq } - } - \g_tmpa_seq - } - { - \msg_info:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } + {#1} { seq } } + \g_tmpa_seq + } + { + \msg_info:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } } { - \tl_if_novalue:nF {##1} + \@@_opt_seq_if_set:cF { - \@@_opt_seq_if_set:cF + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } {#1} { seq } + } + { + \seq_gclear:N \g_tmpa_seq + \@@_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } {#1} { seq } + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } } { - \seq_gclear:N \g_tmpa_seq - \@@_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { seq } - } - \g_tmpa_seq - } + \@@_opt_seq_gset_eq:cN { - \msg_info:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + {#1} { seq } } + \g_tmpa_seq + } + { + \msg_info:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } } @@ -2241,7 +2493,7 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/langfile } { @@ -2257,7 +2509,7 @@ {#1} { bool } } { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -2274,7 +2526,7 @@ {#1} { bool } } { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -2295,7 +2547,7 @@ {#1} { bool } } { - \bool_gset_false:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -2312,7 +2564,7 @@ {#1} { bool } } { - \bool_gset_false:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -2322,7 +2574,6 @@ } } } , - #1 / unset .code:n = { } , #1 .default:n = true , no #1 .meta:n = { #1 = false } , no #1 .value_forbidden:n = true , @@ -2586,12 +2837,12 @@ { { ref } { - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangefunc } { tl } } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2600,13 +2851,13 @@ { stripprefix } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2615,13 +2866,13 @@ { pagecomp } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2630,13 +2881,13 @@ { pagecomp2 } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2670,13 +2921,13 @@ { endrange-property-undefined } {#1} } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn { endrangeprop } { tl } @@ -2964,7 +3215,7 @@ % \subsubsection*{\opt{range} and \opt{rangetopair} options} % % The \opt{rangetopair} option is being handled with other reference format -% option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}. +% option booleans at \cs{g_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_typeset_range_bool @@ -2981,7 +3232,7 @@ % \subsubsection*{\opt{cap} and \opt{capfirst} options} % % The \opt{cap} option is currently being handled with other reference format -% option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}. +% option booleans at \cs{g_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_capfirst_bool @@ -2997,7 +3248,7 @@ % \subsubsection*{\opt{abbrev} and \opt{noabbrevfirst} options} % % The \opt{abbrev} option is currently being handled with other reference -% format option booleans at \cs{c_@@_rf_opts_bool_maybe_type_specific_seq}. +% format option booleans at \cs{g_@@_rf_opts_bool_maybe_type_specific_seq}. % % \begin{macrocode} \bool_new:N \l_@@_noabbrev_first_bool @@ -3125,15 +3376,6 @@ % \subsubsection*{\opt{lang} option} % \phantomsection{}\zlabel{sec:lang-option} % -% \cs{l_@@_current_language_tl} is an internal alias for \pkg{babel}'s -% \cs{languagename} or \pkg{polyglossia}'s \cs{mainbabelname} and, if none of -% them is loaded, we set it to \texttt{english}. \cs{l_@@_main_language_tl} -% is an internal alias for \pkg{babel}'s \cs{bbl@main@language} or for -% \pkg{polyglossia}'s \cs{mainbabelname}, as the case may be. Note that for -% \pkg{polyglossia} we get \pkg{babel}'s language names, so that we only need -% to handle those internally. \cs{l_@@_ref_language_tl} is the internal -% variable which stores the language in which the reference is to be made. -% % The overall setup here seems a little roundabout, but this is actually % required. In the preamble, we (potentially) don't yet have values for the % ``current'' and ``main'' document languages, this must be retrieved at a @@ -3159,11 +3401,8 @@ % \cs{babelprovide}, either directly, ``on the fly'', or with the % \texttt{provide} option, \texttt{do not} get included in \cs{bbl@loaded}. % - +% % \begin{macrocode} -\tl_new:N \l_@@_ref_language_tl -\tl_new:N \l_@@_current_language_tl -\tl_new:N \l_@@_main_language_tl \AddToHook { begindocument } { \@@_if_package_loaded:nTF { babel } @@ -3185,12 +3424,6 @@ } % \end{macrocode} % -% \begin{macro}{\l_zrefclever_ref_language_tl} -% A public version of \cs{l_@@_ref_language_tl} for use in \pkg{zref-vario}. -% \begin{macrocode} -\tl_set:Nn \l_zrefclever_ref_language_tl { \l_@@_ref_language_tl } -% \end{macrocode} -% \end{macro} % % \begin{macrocode} \keys_define:nn { zref-clever/reference } @@ -3481,22 +3714,35 @@ { \@@_if_package_loaded:nTF { zref-check } { - \bool_set_true:N \l_@@_zrefcheck_available_bool - \keys_define:nn { zref-clever/reference } + \IfPackageAtLeastTF { zref-check } { 2021-09-16 } { - check .code:n = + \bool_set_true:N \l_@@_zrefcheck_available_bool + \keys_define:nn { zref-clever/reference } { - \bool_set_true:N \l_@@_zcref_with_check_bool - \keys_set:nn { zref-check / zcheck } {#1} - } , - check .value_required:n = true , + check .code:n = + { + \bool_set_true:N \l_@@_zcref_with_check_bool + \keys_set:nn { zref-check / zcheck } {#1} + } , + check .value_required:n = true , + } + } + { + \bool_set_false:N \l_@@_zrefcheck_available_bool + \keys_define:nn { zref-clever/reference } + { + check .code:n = + { + \msg_warning:nnn { zref-clever } + { zref-check-too-old } { 2021-09-16~v0.2.1 } + } , + } } } { \bool_set_false:N \l_@@_zrefcheck_available_bool \keys_define:nn { zref-clever/reference } { - check .value_forbidden:n = false , check .code:n = { \msg_warning:nn { zref-clever } { missing-zref-check } } , } @@ -3754,11 +4000,11 @@ % % \begin{macrocode} \seq_map_inline:Nn - \c_@@_rf_opts_tl_reference_seq + \g_@@_rf_opts_tl_reference_seq { \keys_define:nn { zref-clever/reference } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -3767,7 +4013,7 @@ { \@@_opt_varname_general:nn {#1} { tl } } } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_general:nn {#1} { tl } } {##1} } @@ -3802,11 +4048,11 @@ } , } \seq_map_inline:Nn - \c_@@_rf_opts_seq_refbounds_seq + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/reference } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -3822,7 +4068,7 @@ { \tl_if_empty_p:n {##1} } { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } } { - \seq_set_eq:cN + \@@_opt_seq_set_eq:cN { \@@_opt_varname_general:nn {#1} { seq } } \l_tmpa_seq } @@ -3836,19 +4082,19 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/reference } { #1 .choice: , #1 / true .code:n = { - \bool_set_true:c + \@@_opt_bool_set_true:c { \@@_opt_varname_general:nn {#1} { bool } } } , #1 / false .code:n = { - \bool_set_false:c + \@@_opt_bool_set_false:c { \@@_opt_varname_general:nn {#1} { bool } } } , #1 / unset .code:n = @@ -3953,7 +4199,7 @@ % % \begin{macrocode} \seq_map_inline:Nn - \c_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/typesetup } { @@ -3965,11 +4211,11 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_tl_typesetup_seq + \g_@@_rf_opts_tl_typesetup_seq { \keys_define:nn { zref-clever/typesetup } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -3981,7 +4227,7 @@ } } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } {#1} { tl } @@ -3999,12 +4245,12 @@ { { ref } { - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4013,13 +4259,13 @@ { stripprefix } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4028,13 +4274,13 @@ { pagecomp } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4043,13 +4289,13 @@ { pagecomp2 } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_clear:c + \@@_opt_tl_clear:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangeprop } { tl } @@ -4083,14 +4329,14 @@ { endrange-property-undefined } {#1} } { - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_set:cn + \@@_opt_tl_set:cn { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } @@ -4131,11 +4377,11 @@ } , } \seq_map_inline:Nn - \c_@@_rf_opts_seq_refbounds_seq + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/typesetup } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -4154,7 +4400,7 @@ { \tl_if_empty_p:n {##1} } { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } } { - \seq_set_eq:cN + \@@_opt_seq_set_eq:cN { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } {#1} { seq } @@ -4171,14 +4417,14 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/typesetup } { #1 .choice: , #1 / true .code:n = { - \bool_set_true:c + \@@_opt_bool_set_true:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } @@ -4187,7 +4433,7 @@ } , #1 / false .code:n = { - \bool_set_false:c + \@@_opt_bool_set_false:c { \@@_opt_varname_type:enn { \l_@@_setup_type_tl } @@ -4300,7 +4546,7 @@ } , case .value_required:n = true , - gender .default:x = \c_novalue_tl , + gender .value_required:n = true , gender .code:n = { \seq_if_empty:NTF \l_@@_lang_gender_seq @@ -4315,69 +4561,46 @@ { option-only-type-specific } { gender } } { - \tl_if_novalue:nTF {#1} + \seq_clear:N \l_tmpa_seq + \clist_map_inline:nn {#1} { - \@@_opt_seq_gunset:c + \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} + { \seq_put_right:Nn \l_tmpa_seq {##1} } { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { gender } - { seq } + \msg_warning:nnxx { zref-clever } + { gender-not-declared } + { \l_@@_setup_language_tl } {##1} } } + \@@_opt_seq_gset_eq:cN { - \seq_clear:N \l_tmpa_seq - \clist_map_inline:nn {#1} - { - \seq_if_in:NnTF \l_@@_lang_gender_seq {##1} - { \seq_put_right:Nn \l_tmpa_seq {##1} } - { - \msg_warning:nnxx { zref-clever } - { gender-not-declared } - { \l_@@_setup_language_tl } {##1} - } - } - \seq_gset_eq:cN - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { gender } - { seq } - } - \l_tmpa_seq + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { gender } + { seq } } + \l_tmpa_seq } } } , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_not_type_specific_seq + \g_@@_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nTF {##1} - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - } + \@@_opt_tl_gset:cn { - \tl_gset:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } {#1} { tl } } + {##1} } { \msg_warning:nnn { zref-clever } @@ -4387,7 +4610,7 @@ } } \seq_map_inline:Nn - \c_@@_rf_opts_tl_maybe_type_specific_seq + \g_@@_rf_opts_tl_maybe_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { @@ -4396,50 +4619,29 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nTF {##1} - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - } + \@@_opt_tl_gset:cn { - \tl_gset:cn - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } {#1} { tl } - } - {##1} + \@@_opt_varname_lang_default:enn + { \l_@@_setup_language_tl } {#1} { tl } } + {##1} } { - \tl_if_novalue:nTF {##1} + \@@_opt_tl_gset:cn { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - } - { - \tl_gset:cn - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - {##1} + \@@_opt_varname_lang_type:eenn + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + {#1} { tl } } + {##1} } } , } } \keys_define:nn { zref-clever/langsetup } { + endrange .value_required:n = true , endrange .code:n = { \str_case:nnF {#1} @@ -4448,13 +4650,13 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4462,14 +4664,14 @@ } } { - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } { endrangefunc } { tl } } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4483,14 +4685,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4498,7 +4700,7 @@ } } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4506,7 +4708,7 @@ { endrangefunc } { tl } } { @@_get_endrange_stripprefix } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4520,14 +4722,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4535,7 +4737,7 @@ } } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4543,7 +4745,7 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomp } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4557,14 +4759,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_gclear:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4572,7 +4774,7 @@ } } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4580,42 +4782,7 @@ { endrangefunc } { tl } } { @@_get_endrange_pagecomptwo } - \tl_gclear:c - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { endrangeprop } { tl } - } - } - } - - { unset } - { - \tl_if_empty:NTF \l_@@_setup_type_tl - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - { endrangefunc } { tl } - } - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - { endrangeprop } { tl } - } - } - { - \@@_opt_tl_gunset:c - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { endrangefunc } { tl } - } - \@@_opt_tl_gunset:c + \@@_opt_tl_gclear:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4640,14 +4807,14 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4656,7 +4823,7 @@ {#1} } { - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4664,7 +4831,7 @@ { endrangefunc } { tl } } { @@_get_endrange_property } - \tl_gset:cn + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4677,7 +4844,6 @@ } } } , - endrange .value_required:n = true , } \keys_define:nn { zref-clever/langsetup } { @@ -4707,7 +4873,7 @@ } , } \seq_map_inline:Nn - \c_@@_rf_opts_tl_type_names_seq + \g_@@_rf_opts_tl_type_names_seq { \keys_define:nn { zref-clever/langsetup } { @@ -4720,130 +4886,96 @@ { option-only-type-specific } {#1} } { - \tl_if_novalue:nTF {##1} + \tl_if_empty:NTF \l_@@_lang_decl_case_tl { - \@@_opt_tl_gunset:c + \@@_opt_tl_gset:cn { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } {#1} { tl } } + {##1} } { - \tl_if_empty:NTF \l_@@_lang_decl_case_tl + \@@_opt_tl_gset:cn { - \tl_gset:cn - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { tl } - } - {##1} - } - { - \tl_gset:cn - { - \@@_opt_varname_lang_type:eeen - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - { \l_@@_lang_decl_case_tl - #1 } - { tl } - } - {##1} + \@@_opt_varname_lang_type:eeen + { \l_@@_setup_language_tl } + { \l_@@_setup_type_tl } + { \l_@@_lang_decl_case_tl - #1 } + { tl } } + {##1} } } } , } } \seq_map_inline:Nn - \c_@@_rf_opts_seq_refbounds_seq + \g_@@_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/langsetup } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l_@@_setup_type_tl { - \tl_if_novalue:nTF {##1} + \seq_gclear:N \g_tmpa_seq + \@@_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } + { + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } + } { - \@@_opt_seq_gunset:c + \@@_opt_seq_gset_eq:cN { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } {#1} { seq } } + \g_tmpa_seq } { - \seq_gclear:N \g_tmpa_seq - \@@_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { seq } - } - \g_tmpa_seq - } - { - \msg_warning:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } - } + \msg_warning:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } { - \tl_if_novalue:nTF {##1} + \seq_gclear:N \g_tmpa_seq + \@@_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } { - \@@_opt_seq_gunset:c + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } + } + { + \@@_opt_seq_gset_eq:cN { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } { \l_@@_setup_type_tl } {#1} { seq } } + \g_tmpa_seq } { - \seq_gclear:N \g_tmpa_seq - \@@_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } {#1} { seq } - } - \g_tmpa_seq - } - { - \msg_warning:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } - } + \msg_warning:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } } , } } \seq_map_inline:Nn - \c_@@_rf_opts_bool_maybe_type_specific_seq + \g_@@_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { @@ -4852,7 +4984,7 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4860,7 +4992,7 @@ } } { - \bool_gset_true:c + \@@_opt_bool_gset_true:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } @@ -4873,28 +5005,7 @@ { \tl_if_empty:NTF \l_@@_setup_type_tl { - \bool_gset_false:c - { - \@@_opt_varname_lang_default:enn - { \l_@@_setup_language_tl } - {#1} { bool } - } - } - { - \bool_gset_false:c - { - \@@_opt_varname_lang_type:eenn - { \l_@@_setup_language_tl } - { \l_@@_setup_type_tl } - {#1} { bool } - } - } - } , - #1 / unset .code:n = - { - \tl_if_empty:NTF \l_@@_setup_type_tl - { - \@@_opt_bool_gunset:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_default:enn { \l_@@_setup_language_tl } @@ -4902,7 +5013,7 @@ } } { - \@@_opt_bool_gunset:c + \@@_opt_bool_gset_false:c { \@@_opt_varname_lang_type:eenn { \l_@@_setup_language_tl } diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty index 072951bb14e..e858e351280 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty @@ -53,7 +53,7 @@ }% \endinput }% -\ProvidesExplPackage {zref-clever} {2022-02-07} {0.2.1-alpha} +\ProvidesExplPackage {zref-clever} {2022-02-11} {0.2.2-alpha} {Clever LaTeX cross-references based on zref} \RequirePackage { zref-base } \RequirePackage { zref-user } @@ -285,6 +285,11 @@ Option~'check'~requested~\msg_line_context:.~ But~package~'zref-check'~is~not~loaded,~can't~run~the~checks. } +\msg_new:nnn { zref-clever } { zref-check-too-old } + { + Option~'check'~requested~\msg_line_context:.~ + But~'zref-check'~newer~than~'#1'~is~required,~can't~run~the~checks. + } \msg_new:nnn { zref-clever } { missing-type } { Reference~type~undefined~for~label~'#1'~\msg_line_context:. } \msg_new:nnn { zref-clever } { missing-property } @@ -357,26 +362,87 @@ \__zrefclever_opt_varname_lang_type:nnnn { eenn , eeen } \cs_new:Npn \__zrefclever_opt_varname_fallback:nn #1#2 { c__zrefclever_opt_fallback_ #1 _ #2 } +\cs_new:Npn \__zrefclever_opt_var_set_bool:n #1 + { \cs_to_str:N #1 _is_set_bool } +\cs_new_protected:Npn \__zrefclever_opt_tl_set:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_set:Nn #1 {#2} + \bool_if_exist:cF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \__zrefclever_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \__zrefclever_opt_tl_set:Nn { cn } +\cs_new_protected:Npn \__zrefclever_opt_tl_clear:N #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_clear:N #1 + \bool_if_exist:cF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \__zrefclever_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \__zrefclever_opt_tl_clear:N { c } +\cs_new_protected:Npn \__zrefclever_opt_tl_gset:Nn #1#2 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } +\cs_generate_variant:Nn \__zrefclever_opt_tl_gset:Nn { cn } +\cs_new_protected:Npn \__zrefclever_opt_tl_gclear:N #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gclear:N #1 + } +\cs_generate_variant:Nn \__zrefclever_opt_tl_gclear:N { c } \cs_new_protected:Npn \__zrefclever_opt_tl_unset:N #1 - { \tl_set_eq:NN #1 \c_novalue_tl } -\cs_new_protected:Npn \__zrefclever_opt_tl_gunset:N #1 - { \tl_gset_eq:NN #1 \c_novalue_tl } + { + \tl_if_exist:NT #1 + { + \tl_clear:N #1 % ? + \bool_if_exist:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \__zrefclever_opt_var_set_bool:n {#1} } } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + } + } \cs_generate_variant:Nn \__zrefclever_opt_tl_unset:N { c } -\cs_generate_variant:Nn \__zrefclever_opt_tl_gunset:N { c } \prg_new_conditional:Npnn \__zrefclever_opt_tl_if_set:N #1 { F , TF } { - \bool_lazy_and:nnTF - { \tl_if_exist_p:N #1 } - { ! \tl_if_novalue_p:n {#1} } - { \prg_return_true: } + \tl_if_exist:NTF #1 + { + \bool_if_exist:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } { \prg_return_false: } } \cs_new_protected:Npn \__zrefclever_opt_tl_gset_if_new:Nn #1#2 { \__zrefclever_opt_tl_if_set:NF #1 - { \tl_gset:Nn #1 {#2} } + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gset:Nn #1 {#2} + } } \cs_generate_variant:Nn \__zrefclever_opt_tl_gset_if_new:Nn { cn } +\cs_new_protected:Npn \__zrefclever_opt_tl_gclear_if_new:N #1 + { + \__zrefclever_opt_tl_if_set:NF #1 + { + \tl_if_exist:NF #1 + { \tl_new:N #1 } + \tl_gclear:N #1 + } + } +\cs_generate_variant:Nn \__zrefclever_opt_tl_gclear_if_new:N { c } \prg_new_protected_conditional:Npnn \__zrefclever_opt_tl_get:NN #1#2 { F } { \__zrefclever_opt_tl_if_set:NTF #1 @@ -392,14 +458,48 @@ { \seq_set_split:Nnn #1 { , } {#2} } \cs_new_protected:Npn \__zrefclever_opt_seq_gset_clist_split:Nn #1#2 { \seq_gset_split:Nnn #1 { , } {#2} } +\cs_new_protected:Npn \__zrefclever_opt_seq_set_eq:NN #1#2 + { + \seq_if_exist:NF #1 + { \seq_new:N #1 } + \seq_set_eq:NN #1 #2 + \bool_if_exist:cF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \__zrefclever_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \__zrefclever_opt_seq_set_eq:NN { cN } +\cs_new_protected:Npn \__zrefclever_opt_seq_gset_eq:NN #1#2 + { + \seq_if_exist:NF #1 + { \seq_new:N #1 } + \seq_gset_eq:NN #1 #2 + } +\cs_generate_variant:Nn \__zrefclever_opt_seq_gset_eq:NN { cN } \cs_new_protected:Npn \__zrefclever_opt_seq_unset:N #1 - { \cs_set_eq:NN #1 \scan_stop: } -\cs_new_protected:Npn \__zrefclever_opt_seq_gunset:N #1 - { \cs_gset_eq:NN #1 \scan_stop: } + { + \seq_if_exist:NT #1 + { + \seq_clear:N #1 % ? + \bool_if_exist:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \__zrefclever_opt_var_set_bool:n {#1} } } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + } + } \cs_generate_variant:Nn \__zrefclever_opt_seq_unset:N { c } -\cs_generate_variant:Nn \__zrefclever_opt_seq_gunset:N { c } \prg_new_conditional:Npnn \__zrefclever_opt_seq_if_set:N #1 { F , TF } - { \seq_if_exist:NTF #1 { \prg_return_true: } { \prg_return_false: } } + { + \seq_if_exist:NTF #1 + { + \bool_if_exist:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } + { \prg_return_false: } + } \prg_generate_conditional_variant:Nnn \__zrefclever_opt_seq_if_set:N { c } { F , TF } \prg_new_protected_conditional:Npnn \__zrefclever_opt_seq_get:NN #1#2 { F } @@ -414,15 +514,66 @@ \prg_generate_conditional_variant:Nnn \__zrefclever_opt_seq_get:NN { cN } { F } \cs_new_protected:Npn \__zrefclever_opt_bool_unset:N #1 - { \cs_set_eq:NN #1 \scan_stop: } -\cs_new_protected:Npn \__zrefclever_opt_bool_gunset:N #1 - { \cs_gset_eq:NN #1 \scan_stop: } + { + \bool_if_exist:NT #1 + { + % \bool_set_false:N #1 % ? + \bool_if_exist:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_set_false:c { \__zrefclever_opt_var_set_bool:n {#1} } } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + } + } \cs_generate_variant:Nn \__zrefclever_opt_bool_unset:N { c } -\cs_generate_variant:Nn \__zrefclever_opt_bool_gunset:N { c } \prg_new_conditional:Npnn \__zrefclever_opt_bool_if_set:N #1 { F , TF } - { \bool_if_exist:NTF #1 { \prg_return_true: } { \prg_return_false: } } + { + \bool_if_exist:NTF #1 + { + \bool_if_exist:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { + \bool_if:cTF { \__zrefclever_opt_var_set_bool:n {#1} } + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_true: } + } + { \prg_return_false: } + } \prg_generate_conditional_variant:Nnn \__zrefclever_opt_bool_if_set:N { c } { F , TF } +\cs_new_protected:Npn \__zrefclever_opt_bool_set_true:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_set_true:N #1 + \bool_if_exist:cF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \__zrefclever_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \__zrefclever_opt_bool_set_true:N { c } +\cs_new_protected:Npn \__zrefclever_opt_bool_set_false:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_set_false:N #1 + \bool_if_exist:cF { \__zrefclever_opt_var_set_bool:n {#1} } + { \bool_new:c { \__zrefclever_opt_var_set_bool:n {#1} } } + \bool_set_true:c { \__zrefclever_opt_var_set_bool:n {#1} } + } +\cs_generate_variant:Nn \__zrefclever_opt_bool_set_false:N { c } +\cs_new_protected:Npn \__zrefclever_opt_bool_gset_true:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_gset_true:N #1 + } +\cs_generate_variant:Nn \__zrefclever_opt_bool_gset_true:N { c } +\cs_new_protected:Npn \__zrefclever_opt_bool_gset_false:N #1 + { + \bool_if_exist:NF #1 + { \bool_new:N #1 } + \bool_gset_false:N #1 + } +\cs_generate_variant:Nn \__zrefclever_opt_bool_gset_false:N { c } \prg_new_protected_conditional:Npnn \__zrefclever_opt_bool_get:NN #1#2 { F } { \__zrefclever_opt_bool_if_set:NTF #1 @@ -447,16 +598,18 @@ \tl_new:N \l__zrefclever_lang_decl_case_tl \seq_new:N \l__zrefclever_lang_declension_seq \seq_new:N \l__zrefclever_lang_gender_seq -\seq_const_from_clist:Nn - \c__zrefclever_rf_opts_tl_not_type_specific_seq +\seq_new:N \g__zrefclever_rf_opts_tl_not_type_specific_seq +\seq_gset_from_clist:Nn + \g__zrefclever_rf_opts_tl_not_type_specific_seq { tpairsep , tlistsep , tlastsep , notesep , } -\seq_const_from_clist:Nn - \c__zrefclever_rf_opts_tl_maybe_type_specific_seq +\seq_new:N \g__zrefclever_rf_opts_tl_maybe_type_specific_seq +\seq_gset_from_clist:Nn + \g__zrefclever_rf_opts_tl_maybe_type_specific_seq { namesep , pairsep , @@ -466,8 +619,9 @@ namefont , reffont , } -\seq_const_from_clist:Nn - \c__zrefclever_rf_opts_seq_refbounds_seq +\seq_new:N \g__zrefclever_rf_opts_seq_refbounds_seq +\seq_gset_from_clist:Nn + \g__zrefclever_rf_opts_seq_refbounds_seq { refbounds-first , refbounds-first-sg , @@ -480,15 +634,17 @@ refbounds-last-pe , refbounds-last-re , } -\seq_const_from_clist:Nn - \c__zrefclever_rf_opts_bool_maybe_type_specific_seq +\seq_new:N \g__zrefclever_rf_opts_bool_maybe_type_specific_seq +\seq_gset_from_clist:Nn + \g__zrefclever_rf_opts_bool_maybe_type_specific_seq { cap , abbrev , rangetopair , } -\seq_const_from_clist:Nn - \c__zrefclever_rf_opts_tl_type_names_seq +\seq_new:N \g__zrefclever_rf_opts_tl_type_names_seq +\seq_gset_from_clist:Nn + \g__zrefclever_rf_opts_tl_type_names_seq { Name-sg , name-sg , @@ -499,14 +655,14 @@ Name-pl-ab , name-pl-ab , } -\seq_new:N \c__zrefclever_rf_opts_tl_typesetup_seq -\seq_gconcat:NNN \c__zrefclever_rf_opts_tl_typesetup_seq - \c__zrefclever_rf_opts_tl_maybe_type_specific_seq - \c__zrefclever_rf_opts_tl_type_names_seq -\seq_new:N \c__zrefclever_rf_opts_tl_reference_seq -\seq_gconcat:NNN \c__zrefclever_rf_opts_tl_reference_seq - \c__zrefclever_rf_opts_tl_not_type_specific_seq - \c__zrefclever_rf_opts_tl_maybe_type_specific_seq +\seq_new:N \g__zrefclever_rf_opts_tl_typesetup_seq +\seq_gconcat:NNN \g__zrefclever_rf_opts_tl_typesetup_seq + \g__zrefclever_rf_opts_tl_maybe_type_specific_seq + \g__zrefclever_rf_opts_tl_type_names_seq +\seq_new:N \g__zrefclever_rf_opts_tl_reference_seq +\seq_gconcat:NNN \g__zrefclever_rf_opts_tl_reference_seq + \g__zrefclever_rf_opts_tl_not_type_specific_seq + \g__zrefclever_rf_opts_tl_maybe_type_specific_seq \clist_map_inline:nn { reference , @@ -524,44 +680,76 @@ refbounds-first-pb = {##1} , refbounds-first-rb = {##1} , } , - +refbounds-first .default:x = \c_novalue_tl , +refbounds-mid .meta:n = { refbounds-mid = {##1} , refbounds-mid-rb = {##1} , refbounds-mid-re = {##1} , } , - +refbounds-mid .default:x = \c_novalue_tl , +refbounds-last .meta:n = { refbounds-last = {##1} , refbounds-last-pe = {##1} , refbounds-last-re = {##1} , } , - +refbounds-last .default:x = \c_novalue_tl , +refbounds-rb .meta:n = { refbounds-first-rb = {##1} , refbounds-mid-rb = {##1} , } , - +refbounds-rb .default:x = \c_novalue_tl , +refbounds-re .meta:n = { refbounds-mid-re = {##1} , refbounds-last-re = {##1} , } , - +refbounds-re .default:x = \c_novalue_tl , +refbounds .meta:n = { +refbounds-first = {##1} , +refbounds-mid = {##1} , +refbounds-last = {##1} , } , - +refbounds .default:x = \c_novalue_tl , refbounds .meta:n = { +refbounds = {##1} } , - refbounds .default:x = \c_novalue_tl , } } +\clist_map_inline:nn + { + reference , + typesetup , + } + { + \keys_define:nn { zref-clever/ #1 } + { + +refbounds-first .default:o = \c_novalue_tl , + +refbounds-mid .default:o = \c_novalue_tl , + +refbounds-last .default:o = \c_novalue_tl , + +refbounds-rb .default:o = \c_novalue_tl , + +refbounds-re .default:o = \c_novalue_tl , + +refbounds .default:o = \c_novalue_tl , + refbounds .default:o = \c_novalue_tl , + } + } +\clist_map_inline:nn + { + langsetup , + langfile , + } + { + \keys_define:nn { zref-clever/ #1 } + { + +refbounds-first .value_required:n = true , + +refbounds-mid .value_required:n = true , + +refbounds-last .value_required:n = true , + +refbounds-rb .value_required:n = true , + +refbounds-re .value_required:n = true , + +refbounds .value_required:n = true , + refbounds .value_required:n = true , + } + } +\tl_new:N \l__zrefclever_ref_language_tl +\tl_new:N \l__zrefclever_current_language_tl +\tl_new:N \l__zrefclever_main_language_tl +\tl_new:N \l_zrefclever_ref_language_tl +\tl_set:Nn \l_zrefclever_ref_language_tl { \l__zrefclever_ref_language_tl } \cs_new:Npn \__zrefclever_language_varname:n #1 { g__zrefclever_declared_language_ #1 _tl } \cs_set_eq:NN \zrefclever_language_varname:n @@ -599,6 +787,7 @@ { \__zrefclever_language_if_declared:nTF {#2} { + \tl_new:c { \__zrefclever_language_varname:n {#1} } \tl_gset:cx { \__zrefclever_language_varname:n {#1} } { \tl_use:c { \__zrefclever_language_varname:n {#2} } } } @@ -610,6 +799,11 @@ { declension .code:n = { + \seq_new:c + { + \__zrefclever_opt_varname_language:enn + { \l__zrefclever_setup_language_tl } { declension } { seq } + } \seq_gset_from_clist:cn { \__zrefclever_opt_varname_language:enn @@ -620,6 +814,11 @@ declension .value_required:n = true , gender .code:n = { + \seq_new:c + { + \__zrefclever_opt_varname_language:enn + { \l__zrefclever_setup_language_tl } { gender } { seq } + } \seq_gset_from_clist:cn { \__zrefclever_opt_varname_language:enn @@ -631,6 +830,11 @@ allcaps .choices:nn = { true , false } { + \bool_new:c + { + \__zrefclever_opt_varname_language:enn + { \l__zrefclever_setup_language_tl } { allcaps } { bool } + } \use:c { bool_gset_ \l_keys_choice_tl :c } { \__zrefclever_opt_varname_language:enn @@ -827,7 +1031,7 @@ } , case .value_required:n = true , - gender .default:x = \c_novalue_tl , + gender .value_required:n = true , gender .code:n = { \seq_if_empty:NTF \l__zrefclever_lang_gender_seq @@ -842,20 +1046,27 @@ { option-only-type-specific } { gender } } { - \tl_if_novalue:nF {#1} + \seq_clear:N \l_tmpa_seq + \clist_map_inline:nn {#1} { - \seq_clear:N \l_tmpa_seq - \clist_map_inline:nn {#1} + \seq_if_in:NnTF \l__zrefclever_lang_gender_seq {##1} + { \seq_put_right:Nn \l_tmpa_seq {##1} } { - \seq_if_in:NnTF \l__zrefclever_lang_gender_seq {##1} - { \seq_put_right:Nn \l_tmpa_seq {##1} } - { - \msg_info:nnxx { zref-clever } - { gender-not-declared } - { \l__zrefclever_setup_language_tl } {##1} - } + \msg_info:nnxx { zref-clever } + { gender-not-declared } + { \l__zrefclever_setup_language_tl } {##1} } - \__zrefclever_opt_seq_if_set:cF + } + \__zrefclever_opt_seq_if_set:cF + { + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + { gender } + { seq } + } + { + \seq_new:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -863,42 +1074,37 @@ { gender } { seq } } + \seq_gset_eq:cN { - \seq_gset_eq:cN - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { gender } - { seq } - } - \l_tmpa_seq + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + { gender } + { seq } } + \l_tmpa_seq } } } } , } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_not_type_specific_seq + \g__zrefclever_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_tl_gset_if_new:cn { - \__zrefclever_opt_tl_gset_if_new:cn - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_default:enn + { \l__zrefclever_setup_language_tl } + {#1} { tl } } + {##1} } { \msg_info:nnn { zref-clever } @@ -908,44 +1114,39 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_maybe_type_specific_seq + \g__zrefclever_rf_opts_tl_maybe_type_specific_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_tl_gset_if_new:cn { - \__zrefclever_opt_tl_gset_if_new:cn - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_default:enn + { \l__zrefclever_setup_language_tl } + {#1} { tl } } + {##1} } { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_tl_gset_if_new:cn { - \__zrefclever_opt_tl_gset_if_new:cn - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + {#1} { tl } } + {##1} } } , } } \keys_define:nn { zref-clever/langfile } { + endrange .value_required:n = true , endrange .code:n = { \str_case:nnF {#1} @@ -954,38 +1155,34 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangefunc } { tl } } - { } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangeprop } { tl } } - { } } { - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } - { } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1000,13 +1197,12 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_stripprefix } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangeprop } { tl } } - { } } { \__zrefclever_opt_tl_gset_if_new:cn @@ -1017,14 +1213,13 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_stripprefix } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1039,13 +1234,12 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomp } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangeprop } { tl } } - { } } { \__zrefclever_opt_tl_gset_if_new:cn @@ -1056,14 +1250,13 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomp } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } } - { } } } @@ -1078,13 +1271,12 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomptwo } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangeprop } { tl } } - { } } { \__zrefclever_opt_tl_gset_if_new:cn @@ -1095,19 +1287,15 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomptwo } - \__zrefclever_opt_tl_gset_if_new:cn + \__zrefclever_opt_tl_gclear_if_new:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } } - { } } } - - { unset } - { } } { \tl_if_empty:nTF {#1} @@ -1161,14 +1349,13 @@ } } } , - endrange .value_required:n = true , } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_type_names_seq + \g__zrefclever_rf_opts_tl_type_names_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl @@ -1179,113 +1366,101 @@ { \tl_if_empty:NTF \l__zrefclever_lang_decl_case_tl { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_tl_gset_if_new:cn { - \__zrefclever_opt_tl_gset_if_new:cn - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + {#1} { tl } } + {##1} } { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_tl_gset_if_new:cn { - \__zrefclever_opt_tl_gset_if_new:cn - { - \__zrefclever_opt_varname_lang_type:eeen - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { \l__zrefclever_lang_decl_case_tl - #1 } { tl } - } - {##1} + \__zrefclever_opt_varname_lang_type:eeen + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + { \l__zrefclever_lang_decl_case_tl - #1 } { tl } } + {##1} } } } , } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_seq_refbounds_seq + \g__zrefclever_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/langfile } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_seq_if_set:cF + { + \__zrefclever_opt_varname_lang_default:enn + { \l__zrefclever_setup_language_tl } {#1} { seq } + } { - \__zrefclever_opt_seq_if_set:cF + \seq_gclear:N \g_tmpa_seq + \__zrefclever_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } {#1} { seq } + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } } { - \seq_gclear:N \g_tmpa_seq - \__zrefclever_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } + \__zrefclever_opt_seq_gset_eq:cN { - \seq_gset_eq:cN - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - {#1} { seq } - } - \g_tmpa_seq - } - { - \msg_info:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } + \__zrefclever_opt_varname_lang_default:enn + { \l__zrefclever_setup_language_tl } + {#1} { seq } } + \g_tmpa_seq + } + { + \msg_info:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } } { - \tl_if_novalue:nF {##1} + \__zrefclever_opt_seq_if_set:cF + { + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } {#1} { seq } + } { - \__zrefclever_opt_seq_if_set:cF + \seq_gclear:N \g_tmpa_seq + \__zrefclever_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } {#1} { seq } + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } } { - \seq_gclear:N \g_tmpa_seq - \__zrefclever_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { seq } - } - \g_tmpa_seq - } + \__zrefclever_opt_seq_gset_eq:cN { - \msg_info:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + {#1} { seq } } + \g_tmpa_seq + } + { + \msg_info:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } } @@ -1293,7 +1468,7 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_bool_maybe_type_specific_seq + \g__zrefclever_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/langfile } { @@ -1309,7 +1484,7 @@ {#1} { bool } } { - \bool_gset_true:c + \__zrefclever_opt_bool_gset_true:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -1326,7 +1501,7 @@ {#1} { bool } } { - \bool_gset_true:c + \__zrefclever_opt_bool_gset_true:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -1347,7 +1522,7 @@ {#1} { bool } } { - \bool_gset_false:c + \__zrefclever_opt_bool_gset_false:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -1364,7 +1539,7 @@ {#1} { bool } } { - \bool_gset_false:c + \__zrefclever_opt_bool_gset_false:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -1374,7 +1549,6 @@ } } } , - #1 / unset .code:n = { } , #1 .default:n = true , no #1 .meta:n = { #1 = false } , no #1 .value_forbidden:n = true , @@ -1501,12 +1675,12 @@ { { ref } { - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_general:nn { endrangefunc } { tl } } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_general:nn { endrangeprop } { tl } @@ -1515,13 +1689,13 @@ { stripprefix } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_general:nn { endrangefunc } { tl } } { __zrefclever_get_endrange_stripprefix } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_general:nn { endrangeprop } { tl } @@ -1530,13 +1704,13 @@ { pagecomp } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_general:nn { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomp } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_general:nn { endrangeprop } { tl } @@ -1545,13 +1719,13 @@ { pagecomp2 } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_general:nn { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomptwo } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_general:nn { endrangeprop } { tl } @@ -1585,13 +1759,13 @@ { endrange-property-undefined } {#1} } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_general:nn { endrangefunc } { tl } } { __zrefclever_get_endrange_property } - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_general:nn { endrangeprop } { tl } @@ -1931,10 +2105,6 @@ { preposinlink } { refbounds } } , } - -\tl_new:N \l__zrefclever_ref_language_tl -\tl_new:N \l__zrefclever_current_language_tl -\tl_new:N \l__zrefclever_main_language_tl \AddToHook { begindocument } { \__zrefclever_if_package_loaded:nTF { babel } @@ -1954,7 +2124,6 @@ } } } -\tl_set:Nn \l_zrefclever_ref_language_tl { \l__zrefclever_ref_language_tl } \keys_define:nn { zref-clever/reference } { lang .code:n = @@ -2160,22 +2329,35 @@ { \__zrefclever_if_package_loaded:nTF { zref-check } { - \bool_set_true:N \l__zrefclever_zrefcheck_available_bool - \keys_define:nn { zref-clever/reference } + \IfPackageAtLeastTF { zref-check } { 2021-09-16 } { - check .code:n = + \bool_set_true:N \l__zrefclever_zrefcheck_available_bool + \keys_define:nn { zref-clever/reference } { - \bool_set_true:N \l__zrefclever_zcref_with_check_bool - \keys_set:nn { zref-check / zcheck } {#1} - } , - check .value_required:n = true , + check .code:n = + { + \bool_set_true:N \l__zrefclever_zcref_with_check_bool + \keys_set:nn { zref-check / zcheck } {#1} + } , + check .value_required:n = true , + } + } + { + \bool_set_false:N \l__zrefclever_zrefcheck_available_bool + \keys_define:nn { zref-clever/reference } + { + check .code:n = + { + \msg_warning:nnn { zref-clever } + { zref-check-too-old } { 2021-09-16~v0.2.1 } + } , + } } } { \bool_set_false:N \l__zrefclever_zrefcheck_available_bool \keys_define:nn { zref-clever/reference } { - check .value_forbidden:n = false , check .code:n = { \msg_warning:nn { zref-clever } { missing-zref-check } } , } @@ -2316,11 +2498,11 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_reference_seq + \g__zrefclever_rf_opts_tl_reference_seq { \keys_define:nn { zref-clever/reference } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -2329,7 +2511,7 @@ { \__zrefclever_opt_varname_general:nn {#1} { tl } } } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_general:nn {#1} { tl } } {##1} } @@ -2364,11 +2546,11 @@ } , } \seq_map_inline:Nn - \c__zrefclever_rf_opts_seq_refbounds_seq + \g__zrefclever_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/reference } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -2384,7 +2566,7 @@ { \tl_if_empty_p:n {##1} } { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } } { - \seq_set_eq:cN + \__zrefclever_opt_seq_set_eq:cN { \__zrefclever_opt_varname_general:nn {#1} { seq } } \l_tmpa_seq } @@ -2398,19 +2580,19 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_bool_maybe_type_specific_seq + \g__zrefclever_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/reference } { #1 .choice: , #1 / true .code:n = { - \bool_set_true:c + \__zrefclever_opt_bool_set_true:c { \__zrefclever_opt_varname_general:nn {#1} { bool } } } , #1 / false .code:n = { - \bool_set_false:c + \__zrefclever_opt_bool_set_false:c { \__zrefclever_opt_varname_general:nn {#1} { bool } } } , #1 / unset .code:n = @@ -2444,7 +2626,7 @@ \tl_clear:N \l__zrefclever_setup_type_tl } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_not_type_specific_seq + \g__zrefclever_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/typesetup } { @@ -2456,11 +2638,11 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_typesetup_seq + \g__zrefclever_rf_opts_tl_typesetup_seq { \keys_define:nn { zref-clever/typesetup } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -2472,7 +2654,7 @@ } } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } {#1} { tl } @@ -2490,12 +2672,12 @@ { { ref } { - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } @@ -2504,13 +2686,13 @@ { stripprefix } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_stripprefix } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } @@ -2519,13 +2701,13 @@ { pagecomp } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomp } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } @@ -2534,13 +2716,13 @@ { pagecomp2 } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomptwo } - \tl_clear:c + \__zrefclever_opt_tl_clear:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangeprop } { tl } @@ -2574,14 +2756,14 @@ { endrange-property-undefined } {#1} } { - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_property } - \tl_set:cn + \__zrefclever_opt_tl_set:cn { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } @@ -2622,11 +2804,11 @@ } , } \seq_map_inline:Nn - \c__zrefclever_rf_opts_seq_refbounds_seq + \g__zrefclever_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/typesetup } { - #1 .default:x = \c_novalue_tl , + #1 .default:o = \c_novalue_tl , #1 .code:n = { \tl_if_novalue:nTF {##1} @@ -2645,7 +2827,7 @@ { \tl_if_empty_p:n {##1} } { \int_compare_p:nNn { \seq_count:N \l_tmpa_seq } = { 4 } } { - \seq_set_eq:cN + \__zrefclever_opt_seq_set_eq:cN { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } {#1} { seq } @@ -2662,14 +2844,14 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_bool_maybe_type_specific_seq + \g__zrefclever_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/typesetup } { #1 .choice: , #1 / true .code:n = { - \bool_set_true:c + \__zrefclever_opt_bool_set_true:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } @@ -2678,7 +2860,7 @@ } , #1 / false .code:n = { - \bool_set_false:c + \__zrefclever_opt_bool_set_false:c { \__zrefclever_opt_varname_type:enn { \l__zrefclever_setup_type_tl } @@ -2761,7 +2943,7 @@ } , case .value_required:n = true , - gender .default:x = \c_novalue_tl , + gender .value_required:n = true , gender .code:n = { \seq_if_empty:NTF \l__zrefclever_lang_gender_seq @@ -2776,69 +2958,46 @@ { option-only-type-specific } { gender } } { - \tl_if_novalue:nTF {#1} + \seq_clear:N \l_tmpa_seq + \clist_map_inline:nn {#1} { - \__zrefclever_opt_seq_gunset:c + \seq_if_in:NnTF \l__zrefclever_lang_gender_seq {##1} + { \seq_put_right:Nn \l_tmpa_seq {##1} } { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { gender } - { seq } + \msg_warning:nnxx { zref-clever } + { gender-not-declared } + { \l__zrefclever_setup_language_tl } {##1} } } + \__zrefclever_opt_seq_gset_eq:cN { - \seq_clear:N \l_tmpa_seq - \clist_map_inline:nn {#1} - { - \seq_if_in:NnTF \l__zrefclever_lang_gender_seq {##1} - { \seq_put_right:Nn \l_tmpa_seq {##1} } - { - \msg_warning:nnxx { zref-clever } - { gender-not-declared } - { \l__zrefclever_setup_language_tl } {##1} - } - } - \seq_gset_eq:cN - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { gender } - { seq } - } - \l_tmpa_seq + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + { gender } + { seq } } + \l_tmpa_seq } } } , } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_not_type_specific_seq + \g__zrefclever_rf_opts_tl_not_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_if_novalue:nTF {##1} + \__zrefclever_opt_tl_gset:cn { - \__zrefclever_opt_tl_gunset:c - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } {#1} { tl } - } - } - { - \tl_gset:cn - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_default:enn + { \l__zrefclever_setup_language_tl } {#1} { tl } } + {##1} } { \msg_warning:nnn { zref-clever } @@ -2848,7 +3007,7 @@ } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_maybe_type_specific_seq + \g__zrefclever_rf_opts_tl_maybe_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { @@ -2857,50 +3016,29 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_if_novalue:nTF {##1} - { - \__zrefclever_opt_tl_gunset:c - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } {#1} { tl } - } - } + \__zrefclever_opt_tl_gset:cn { - \tl_gset:cn - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_default:enn + { \l__zrefclever_setup_language_tl } {#1} { tl } } + {##1} } { - \tl_if_novalue:nTF {##1} - { - \__zrefclever_opt_tl_gunset:c - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { tl } - } - } + \__zrefclever_opt_tl_gset:cn { - \tl_gset:cn - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { tl } - } - {##1} + \__zrefclever_opt_varname_lang_type:eenn + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + {#1} { tl } } + {##1} } } , } } \keys_define:nn { zref-clever/langsetup } { + endrange .value_required:n = true , endrange .code:n = { \str_case:nnF {#1} @@ -2909,13 +3047,13 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangefunc } { tl } } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -2923,14 +3061,14 @@ } } { - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } { endrangefunc } { tl } } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -2944,14 +3082,14 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_stripprefix } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -2959,7 +3097,7 @@ } } { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -2967,7 +3105,7 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_stripprefix } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -2981,14 +3119,14 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomp } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -2996,7 +3134,7 @@ } } { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3004,7 +3142,7 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomp } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3018,14 +3156,14 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomptwo } - \tl_gclear:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -3033,7 +3171,7 @@ } } { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3041,42 +3179,7 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_pagecomptwo } - \tl_gclear:c - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { endrangeprop } { tl } - } - } - } - - { unset } - { - \tl_if_empty:NTF \l__zrefclever_setup_type_tl - { - \__zrefclever_opt_tl_gunset:c - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - { endrangefunc } { tl } - } - \__zrefclever_opt_tl_gunset:c - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - { endrangeprop } { tl } - } - } - { - \__zrefclever_opt_tl_gunset:c - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { endrangefunc } { tl } - } - \__zrefclever_opt_tl_gunset:c + \__zrefclever_opt_tl_gclear:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3101,14 +3204,14 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } { endrangefunc } { tl } } { __zrefclever_get_endrange_property } - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -3117,7 +3220,7 @@ {#1} } { - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3125,7 +3228,7 @@ { endrangefunc } { tl } } { __zrefclever_get_endrange_property } - \tl_gset:cn + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3138,7 +3241,6 @@ } } } , - endrange .value_required:n = true , } \keys_define:nn { zref-clever/langsetup } { @@ -3168,7 +3270,7 @@ } , } \seq_map_inline:Nn - \c__zrefclever_rf_opts_tl_type_names_seq + \g__zrefclever_rf_opts_tl_type_names_seq { \keys_define:nn { zref-clever/langsetup } { @@ -3181,130 +3283,96 @@ { option-only-type-specific } {#1} } { - \tl_if_novalue:nTF {##1} + \tl_if_empty:NTF \l__zrefclever_lang_decl_case_tl { - \__zrefclever_opt_tl_gunset:c + \__zrefclever_opt_tl_gset:cn { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } {#1} { tl } } + {##1} } { - \tl_if_empty:NTF \l__zrefclever_lang_decl_case_tl - { - \tl_gset:cn - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { tl } - } - {##1} - } + \__zrefclever_opt_tl_gset:cn { - \tl_gset:cn - { - \__zrefclever_opt_varname_lang_type:eeen - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - { \l__zrefclever_lang_decl_case_tl - #1 } - { tl } - } - {##1} + \__zrefclever_opt_varname_lang_type:eeen + { \l__zrefclever_setup_language_tl } + { \l__zrefclever_setup_type_tl } + { \l__zrefclever_lang_decl_case_tl - #1 } + { tl } } + {##1} } } } , } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_seq_refbounds_seq + \g__zrefclever_rf_opts_seq_refbounds_seq { \keys_define:nn { zref-clever/langsetup } { - #1 .default:x = \c_novalue_tl , + #1 .value_required:n = true , #1 .code:n = { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \tl_if_novalue:nTF {##1} + \seq_gclear:N \g_tmpa_seq + \__zrefclever_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } + { + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } + } { - \__zrefclever_opt_seq_gunset:c + \__zrefclever_opt_seq_gset_eq:cN { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } {#1} { seq } } + \g_tmpa_seq } { - \seq_gclear:N \g_tmpa_seq - \__zrefclever_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - {#1} { seq } - } - \g_tmpa_seq - } - { - \msg_warning:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } - } + \msg_warning:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } { - \tl_if_novalue:nTF {##1} + \seq_gclear:N \g_tmpa_seq + \__zrefclever_opt_seq_gset_clist_split:Nn + \g_tmpa_seq {##1} + \bool_lazy_or:nnTF + { \tl_if_empty_p:n {##1} } + { + \int_compare_p:nNn + { \seq_count:N \g_tmpa_seq } = { 4 } + } { - \__zrefclever_opt_seq_gunset:c + \__zrefclever_opt_seq_gset_eq:cN { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } { \l__zrefclever_setup_type_tl } {#1} { seq } } + \g_tmpa_seq } { - \seq_gclear:N \g_tmpa_seq - \__zrefclever_opt_seq_gset_clist_split:Nn - \g_tmpa_seq {##1} - \bool_lazy_or:nnTF - { \tl_if_empty_p:n {##1} } - { - \int_compare_p:nNn - { \seq_count:N \g_tmpa_seq } = { 4 } - } - { - \seq_gset_eq:cN - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } {#1} { seq } - } - \g_tmpa_seq - } - { - \msg_warning:nnxx { zref-clever } - { refbounds-must-be-four } - {#1} { \seq_count:N \g_tmpa_seq } - } + \msg_warning:nnxx { zref-clever } + { refbounds-must-be-four } + {#1} { \seq_count:N \g_tmpa_seq } } } } , } } \seq_map_inline:Nn - \c__zrefclever_rf_opts_bool_maybe_type_specific_seq + \g__zrefclever_rf_opts_bool_maybe_type_specific_seq { \keys_define:nn { zref-clever/langsetup } { @@ -3313,7 +3381,7 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \bool_gset_true:c + \__zrefclever_opt_bool_gset_true:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -3321,7 +3389,7 @@ } } { - \bool_gset_true:c + \__zrefclever_opt_bool_gset_true:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } @@ -3334,28 +3402,7 @@ { \tl_if_empty:NTF \l__zrefclever_setup_type_tl { - \bool_gset_false:c - { - \__zrefclever_opt_varname_lang_default:enn - { \l__zrefclever_setup_language_tl } - {#1} { bool } - } - } - { - \bool_gset_false:c - { - \__zrefclever_opt_varname_lang_type:eenn - { \l__zrefclever_setup_language_tl } - { \l__zrefclever_setup_type_tl } - {#1} { bool } - } - } - } , - #1 / unset .code:n = - { - \tl_if_empty:NTF \l__zrefclever_setup_type_tl - { - \__zrefclever_opt_bool_gunset:c + \__zrefclever_opt_bool_gset_false:c { \__zrefclever_opt_varname_lang_default:enn { \l__zrefclever_setup_language_tl } @@ -3363,7 +3410,7 @@ } } { - \__zrefclever_opt_bool_gunset:c + \__zrefclever_opt_bool_gset_false:c { \__zrefclever_opt_varname_lang_type:eenn { \l__zrefclever_setup_language_tl } |