[latex3-commits] [git/LaTeX3-latex3-latex3] main: Slight simplification (9228cc12c)
Joseph Wright
joseph.wright at morningstar2.co.uk
Wed May 25 22:57:39 CEST 2022
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/9228cc12c59c4e09336666b62d314709395fd668
>---------------------------------------------------------------
commit 9228cc12c59c4e09336666b62d314709395fd668
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Wed May 25 21:57:39 2022 +0100
Slight simplification
>---------------------------------------------------------------
9228cc12c59c4e09336666b62d314709395fd668
l3packages/xtemplate/xtemplate.dtx | 53 ++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/l3packages/xtemplate/xtemplate.dtx b/l3packages/xtemplate/xtemplate.dtx
index fe407442b..bac365009 100644
--- a/l3packages/xtemplate/xtemplate.dtx
+++ b/l3packages/xtemplate/xtemplate.dtx
@@ -1616,6 +1616,7 @@
% \begin{macro}{\@@_parse_vars_elt_aux:nn}
% \begin{macro}{\@@_parse_vars_elt_aux:nw}
% \begin{macro}{\@@_parse_vars_elt_aux:nnn}
+% \begin{macro}{\@@_parse_vars_elt_key:nn}
% Split off any leading \texttt{global} and they look for the way to
% implement.
% \begin{macrocode}
@@ -1644,11 +1645,10 @@
{ choice } { \@@_implement_choices:n {#3} }
{ code }
{
- \keys_define:nx { template / #1 }
+ \@@_parse_vars_elt_key:nn {#1}
{
- \l_@@_key_name_tl
- .cs_ \str_if_eq:nnT {#1} { global } { g }
- set_protected:Np = \exp_not:N #3
+ .cs_ \str_if_eq:nnT {#1} { global } { g }
+ set_protected:Np = \exp_not:N #3
}
\prop_put:Non \l_@@_vars_prop
\l_@@_key_name_tl {#2#3}
@@ -1657,30 +1657,28 @@
{
\cs_if_exist:NF #3
{ \cs_new:Npn #3 { } }
- \keys_define:nx { template / #1 }
+ \@@_parse_vars_elt_key:nn {#1}
{
- \l_@@_key_name_tl
- .code:n =
- {
- \exp_not:c
- { cs_ \str_if_eq:nnT {#1} { global } { g } seq_eq:NN }
- \exp_not:N #3 ####1
- }
+ .code:n =
+ {
+ \exp_not:c
+ { cs_ \str_if_eq:nnT {#1} { global } { g } seq_eq:NN }
+ \exp_not:N #3 ####1
+ }
}
\prop_put:Non \l_@@_vars_prop
\l_@@_key_name_tl {#2#3}
}
{ instance }
{
- \keys_define:nx { template / #1 }
+ \@@_parse_vars_elt_key:nn {#1}
{
- \l_@@_key_name_tl
- .code:n =
- {
- \exp_not:c
- { cs_ \str_if_eq:nnT {#1} { global } { g } set:Npn }
- \exp_not:N #3 { \UseInstance {####1} }
- }
+ .code:n =
+ {
+ \exp_not:c
+ { cs_ \str_if_eq:nnT {#1} { global } { g } set:Npn }
+ \exp_not:N #3 { \UseInstance {####1} }
+ }
}
\prop_put:Non \l_@@_vars_prop
\l_@@_key_name_tl {#2#3}
@@ -1691,12 +1689,11 @@
{
\cs_if_exist:NF #3
{ \use:c { \@@_map_var_type: _new:N } #3 }
- \keys_define:nx { template / #1 }
+ \@@_parse_vars_elt_key:nn {#1}
{
- \l_@@_key_name_tl
- . \@@_map_var_type:
- _ \str_if_eq:nnT {#1} { global } { g } set:N
- = \exp_not:N #3
+ . \@@_map_var_type:
+ _ \str_if_eq:nnT {#1} { global } { g } set:N
+ = \exp_not:N #3
}
\prop_put:Non \l_@@_vars_prop
\l_@@_key_name_tl {#2#3}
@@ -1704,10 +1701,16 @@
{ \msg_error:nnx { xtemplate } { bad-variable } { #2#3 } }
}
}
+\cs_new_protected:Npn \@@_parse_vars_elt_key:nn #1#2
+ {
+ \keys_define:nx { template / #1 }
+ { \l_@@_key_name_tl #2 }
+ }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}[EXP]{\@@_map_var_type:}
% Turn a \enquote{friendly} variable type into an \texttt{expl3} one.
More information about the latex3-commits
mailing list.