diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-27 23:22:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-27 23:22:46 +0000 |
commit | 19b673bcbee6071004a25ead706b82caf7f20a0e (patch) | |
tree | 27aff46bec780c821d223328505100e491a2ec5f /Master/texmf-dist/source/latex/xpackages | |
parent | b9bcd911e43416c608c7b9a5662f9994422bfeb5 (diff) |
xpackages update
git-svn-id: svn://tug.org/texlive/trunk@19922 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/xpackages')
7 files changed, 368 insertions, 66 deletions
diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex new file mode 100644 index 00000000000..5684ce7a90f --- /dev/null +++ b/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex @@ -0,0 +1,77 @@ +% \iffalse +%% (C) Copyright 2000-2004 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: template-test.tex 1628 2009-10-25 09:54:34Z mittelba $ +%% +% \fi +% +\RequirePackage{template} + +\DeclareTemplateType{xxx}{0} + +\DeclareTemplate{xxx}{test}{0} + { + xkey=n \xkey, + key =i {yyy} \value + } + { + \DoParameterAssignments + \show\xkey + \show\value + \value + } + +\DeclareTemplateType{yyy}{0} + +\DeclareTemplate{yyy}{foo}{0} + { + keya =L \foo + } + { + \DoParameterAssignments + \show\foo + } + + +\DeclareInstance{xxx}{bar}{test} + { + xkey = \UseTemplate{yyy}{foo}{ keya = 20pt }, + key = \UseTemplate{yyy}{foo}{ keya = 10pt } + } + +\ShowInstance{xxx}{bar} + +\UseInstance{xxx}{bar} + +\stop diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex b/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex new file mode 100644 index 00000000000..489e9f2304a --- /dev/null +++ b/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex @@ -0,0 +1,110 @@ +% \iffalse +%% (C) Copyright 2000-2004 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: template-test2.tex 585 2006-12-12 17:31:48Z morten $ +%% +% \fi +% + + +\RequirePackage{template} +\RequirePackage{trace} + +\DeclareTemplateType{xxx}{0} + +\def\MultiSelection{\MultiSelectionError} +%\def\foo{bar} + +%\traceon + +\DeclareTemplate{xxx}{test}{0} + { + xkey=n [\foo] \xkey, + ykey=n [\DelayEvaluation\foo] \ykey, + zkey=n \zkey, + last=n [last] \lastkey, + set =i {xxx} \xxx + } + { + \DoParameterAssignments + \typeout{abc} + } +\ShowTemplate{xxx}{test} + + +\DeclareInstance{xxx}{bar}{test} + { + zkey = foo, + xkey = baz, + } + +\DeclareInstance{xxx}{baz}{test} + { + last = first, + set = \UseTemplate{xxx}{test}{zkey=rrr}, + zkey = foo + } + + +\ShowInstance{xxx}{bar} +\ShowInstance{xxx}{baz} + +\DeclareTemplateType{yyy}{0} + +\DeclareTemplate{yyy}{foo}{0} + { + keya =L \foo + } + { + \DoParameterAssignments + \show\foo + } + + +\DeclareInstance{xxx}{bar}{test} + { + xkey = \UseTemplate{yyy}{foo}{ keya = 20pt }, + key = \UseTemplate{yyy}{foo}{ keya = 10pt } + } + +\ShowInstance{xxx}{bar} + +\UseInstance{xxx}{bar} + +\stop + +%%% Local Variables: +%%% mode: plain-tex +%%% TeX-master: t +%%% End: diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex new file mode 100644 index 00000000000..d981888d450 --- /dev/null +++ b/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex @@ -0,0 +1,80 @@ +% \iffalse +%% (C) Copyright 2000-2004 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: tprestrict-test.tex 1628 2009-10-25 09:54:34Z mittelba $ +%% +% \fi +% + +\makeatletter +\RequirePackage{template} +\IgnoreWhiteSpace + +\newcount\ca +\newdimen\da + + +\DeclareTemplateType{type}{0} + +\DeclareTemplate{type}{Ta}{0}{ + one =l [2in] \da, + two =c [5] \ca} + {\DoParameterAssignments\typeout{\da=\the\da,\@spaces \ca=\the\ca}} + +\ShowTemplate{type}{Ta} + +\typeout{1^^J==} +\UseTemplate{type}{Ta}{} + +\typeout{2^^J==} +\UseTemplate{type}{Ta}{one=44pt, two=7} + + +\DeclareRestrictedTemplate{type}{Tb}{Ta}{one=33pt} + +\ShowTemplate{type}{Tb} + +\typeout{RESTRICT^^J3^^J==} + +\DeclareInstance{type}{foo}{Tb}{two=9} + +\ShowInstance{type}{foo} + +\UseInstance{type}{foo} + +\typeout{4^^J==} +\UseTemplate{type}{Tb}{two=7} + +\stop + diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx b/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx index f1d6ebf872d..564907d4acb 100644 --- a/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx @@ -3,7 +3,7 @@ %% David Carlisle %% (C) Copyright 2004-2008 Frank Mittelbach, %% LaTeX3 Project -%% (C) Copyright 2009 LaTeX3 Project +%% (C) Copyright 2009-2010 LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -41,7 +41,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: xparse.dtx 1927 2010-05-23 11:00:21Z joseph $ +\GetIdInfo$Id: xparse.dtx 2037 2010-09-20 21:22:45Z joseph $ {Generic document command parser} %\iffalse %<*driver> @@ -640,10 +640,6 @@ % letters in the argument specification). %\end{variable} % -%\begin{variable}{\q_xparse_stop} -% A private delimiting quark: needed by the expandable function system. -%\end{variable} -% %\subsection{Internal functions} % %\begin{function}{ @@ -1077,14 +1073,6 @@ \int_new:N \l_xparse_total_args_int % \end{macrocode} %\end{macro} -% -%\begin{macro}{\q_xparse_stop} -% A private quark, used for delimiting arguments when making -% expandable functions. -% \begin{macrocode} -\quark_new:N \q_xparse_stop -% \end{macrocode} -%\end{macro} % %\subsection{Turning the argument specifier into grabbers} % @@ -1579,7 +1567,7 @@ % Tests for \cs{NoValue}. % \begin{macrocode} \prg_new_conditional:Nnn \xparse_if_no_value:n { TF,T,F } { - \tl_if_eq:nnTF {#1} { \NoValue } { + \str_if_eq:nnTF {#1} { \NoValue } { \prg_return_true: }{ \prg_return_false: @@ -1801,7 +1789,7 @@ %\begin{macro}[aux]{\xparse_grab_D_nested:NNnNn} %\begin{macro}{\_l_xparse_nesting_a_tl} %\begin{macro}{\_l_xparse_nesting_b_tl} -%\begin{macro}{\_q_xparse} +%\begin{macro}{\q_xparse} % Catching nested optional arguments means more work. The aim here is % to collect up each pair of optional tokens without \TeX\ helping out, % and without counting anything. The code above will already have @@ -1816,23 +1804,23 @@ % \begin{macrocode} \tl_new:N \_l_xparse_nesting_a_tl \tl_new:N \_l_xparse_nesting_b_tl -\quark_new:N \_q_xparse +\quark_new:N \q_xparse \cs_new_protected:Npn \xparse_grab_D_nested:NNNnn #1#2#3#4#5 { \tl_clear:N \_l_xparse_nesting_a_tl \tl_clear:N \_l_xparse_nesting_b_tl - #5 \xparse_grab_arg:w ##1 #1 ##2 \_q_xparse ##3 #2 + #5 \xparse_grab_arg:w ##1 #1 ##2 \q_xparse ##3 #2 { \tl_put_right:Nn \_l_xparse_nesting_a_tl { ##1 #1 } \tl_put_right:Nn \_l_xparse_nesting_b_tl { #2 ##3 } \tl_if_in:nnTF {##2} {#1} - { \xparse_grab_arg:w ##2 \_q_xparse } + { \xparse_grab_arg:w ##2 \q_xparse } { \tl_if_in:NnTF \_l_xparse_nesting_b_tl {#1} { \tl_set_eq:NN \l_xparse_tmp_tl \_l_xparse_nesting_b_tl \tl_clear:N \_l_xparse_nesting_b_tl \exp_last_unbraced:NV \xparse_grab_arg:w - \l_xparse_tmp_tl \_q_xparse + \l_xparse_tmp_tl \q_xparse } { \tl_put_right:Nn \_l_xparse_nesting_a_tl {##2} @@ -1843,7 +1831,7 @@ } } } - \xparse_grab_arg:w #3 \_q_xparse + \xparse_grab_arg:w #3 \q_xparse } % \end{macrocode} %\end{macro} @@ -2131,10 +2119,10 @@ \tl_replace_all_in:Nnn \_l_xparse_split_argument_tl { @ } {#2} } \cs_set_protected:Npn \_xparse_split_argument_aux_i:w - ##1 \q_nil ##2 #2 ##3 \q_stop + ##1 \q_mark ##2 #2 ##3 \q_stop { \tl_put_right:Nn \ProcessedArgument { {##2} } - ##1 \q_nil ##3 \q_stop + ##1 \q_mark ##3 \q_stop } \cs_set_protected:Npn \_xparse_split_argument_aux_iii:w ##1 #2 ##2 \q_stop @@ -2150,7 +2138,7 @@ \prg_replicate:nn { #1 + 1 } { \_xparse_split_argument_aux_i:w } \_xparse_split_argument_aux_ii:w - \exp_not:N \q_nil + \exp_not:N \q_mark \exp_not:V \_l_xparse_split_argument_tl \prg_replicate:nn {#1} { \exp_not:n {#2} \NoValue } \exp_not:n { #2 \q_stop } @@ -2160,7 +2148,7 @@ \group_end: \cs_set_protected:Npn \_xparse_split_argument_aux_i:w { } \cs_set_protected:Npn \_xparse_split_argument_aux_ii:w - #1 \q_nil #2 \q_stop + #1 \q_mark #2 \q_stop { \tl_if_empty:nF {#2} { \_xparse_split_argument_aux_iii:w #2 \q_stop } @@ -2220,7 +2208,7 @@ % The trick here is to pass each grabbed argument along a chain of % auxiliary functions. Each one ultimately calls the next in the chain, % so that all of the arguments are passed along delimited using -% \cs{q_xparse_stop}. At the end of the chain, the marker is removed +% \cs{q_xparse}. At the end of the chain, the marker is removed % so that the user-supplied code can be passed the correct number % of arguments. All of this is done by expansion! % @@ -2244,28 +2232,27 @@ % case, the second auxiliary function is called. It finds the closing % delimiter and so the optional argument (if any). The function then % calls the next one in the chain, passing along the argument(s) -% grabbed thus-far using \cs{q_xparse_stop} as a marker. +% grabbed thus-far using \cs{q_xparse} as a marker. % \begin{macrocode} \cs_new:Npn \xparse_exp_add_type_D:w #1#2#3 { \tl_set:Nx \l_xparse_tmp_tl { \exp_after:wN \token_to_str:N \l_xparse_function_tl \int_use:N \l_xparse_total_args_int } - \xparse_exp_set:cpx { \l_xparse_tmp_tl } ##1 \q_xparse_stop ##2 { + \xparse_exp_set:cpx { \l_xparse_tmp_tl } ##1 \q_xparse ##2 { \exp_not:N \tl_if_head_eq_charcode:nNTF {##2} #1 { \exp_not:c { \l_xparse_tmp_tl aux } - ##1 \exp_not:N \q_xparse_stop + ##1 \exp_not:N \q_xparse }{ \exp_not:c { \l_xparse_tmp_tl aux } - ##1 \exp_not:N \q_xparse_stop #3 #2 {##2} + ##1 \exp_not:N \q_xparse #3 #2 {##2} } } - \xparse_exp_set:cpx { \l_xparse_tmp_tl aux} - ##1 \q_xparse_stop ##2 #2 { + \xparse_exp_set:cpx { \l_xparse_tmp_tl aux} ##1 \q_xparse ##2 #2 { \exp_not:c { \exp_after:wN \token_to_str:N \l_xparse_function_tl \intexpr_eval:n { \l_xparse_total_args_int + 1 } - } ##1 {##2} \exp_not:N \q_xparse_stop + } ##1 {##2} \exp_not:N \q_xparse } \xparse_exp_prepare_function:N } @@ -2283,12 +2270,12 @@ \xparse_exp_set:cpx { \exp_after:wN \token_to_str:N \l_xparse_function_tl \int_use:N \l_xparse_total_args_int - } ##1 \q_xparse_stop ##2## { + } ##1 \q_xparse ##2## { \exp_not:c { \exp_after:wN \token_to_str:N \l_xparse_function_tl \intexpr_eval:n { \l_xparse_total_args_int + 1 } } - ##1 {##2} \exp_not:N \q_xparse_stop + ##1 {##2} \exp_not:N \q_xparse } \xparse_exp_prepare_function:N } @@ -2297,12 +2284,12 @@ \xparse_exp_set:cpx { \exp_after:wN \token_to_str:N \l_xparse_function_tl \int_use:N \l_xparse_total_args_int - } ##1 \q_xparse_stop ##2 { + } ##1 \q_xparse ##2 { \exp_not:c { \exp_after:wN \token_to_str:N \l_xparse_function_tl \intexpr_eval:n { \l_xparse_total_args_int + 1 } } - ##1 {##2} \exp_not:N \q_xparse_stop + ##1 {##2} \exp_not:N \q_xparse } \xparse_exp_prepare_function:N } @@ -2325,13 +2312,13 @@ \xparse_exp_set:cpx { \exp_after:wN \token_to_str:N \l_xparse_function_tl \int_use:N \l_xparse_total_args_int - } ##1 \q_xparse_stop ##2 { + } ##1 \q_xparse ##2 { \exp_not:N \tl_if_head_eq_charcode:nNTF {##2} #1 { \exp_not:c { \l_xparse_tmp_tl } - ##1 \exp_not:n { { \BooleanTrue } \q_xparse_stop } + ##1 \exp_not:n { { \BooleanTrue } \q_xparse } }{ \exp_not:c { \l_xparse_tmp_tl } - ##1 \exp_not:n { { \BooleanFalse } \q_xparse_stop {##2} } + ##1 \exp_not:n { { \BooleanFalse } \q_xparse {##2} } } } \xparse_exp_prepare_function:N @@ -2349,12 +2336,12 @@ \xparse_exp_set:cpx { \exp_after:wN \token_to_str:N \l_xparse_function_tl \int_use:N \l_xparse_total_args_int - } ##1 \q_xparse_stop ##2 #1 { + } ##1 \q_xparse ##2 #1 { \exp_not:c { \exp_after:wN \token_to_str:N \l_xparse_function_tl \intexpr_eval:n { \l_xparse_total_args_int + 1 } } - ##1 {##2} \exp_not:N \q_xparse_stop + ##1 {##2} \exp_not:N \q_xparse } \xparse_exp_prepare_function:N } @@ -2430,11 +2417,11 @@ } \cs_new:Npn \xparse_exp_declare_cmd_mixed_aux:Nn #1#2 { \cs_set_nopar:Npx #1 { - \exp_not:c { \token_to_str:N #1 1 } x \exp_not:N \q_xparse_stop + \exp_not:c { \token_to_str:N #1 1 } x \exp_not:N \q_xparse } \cs_set_nopar:cpx { \token_to_str:N #1 \intexpr_eval:n { \l_xparse_total_args_int + 1 } - } x ##1 \q_xparse_stop { + } x ##1 \q_xparse { \exp_not:c { \token_to_str:N #1 } ##1 } \cs_generate_from_arg_count:cNnn @@ -2506,7 +2493,7 @@ } \cs_new:Npn \xparse_exp_prepare_function_long:N #1 { \quark_if_nil:NF #1 { - \tl_if_eq:nnTF {#1} { + } { + \str_if_eq:nnTF {#1} { + } { \xparse_exp_prepare_function_short:N }{ \msg_kernel_error:nn { xparse } { expandable-inconsistent-long } @@ -2590,7 +2577,7 @@ } { The~arguments~for~an~expandable~command~must~either~all~be \\ - short~or~all~be~long.~You~have~tried~to mix~the~two~types. + short~or~all~be~long.~You~have~tried~to~mix~the~two~types. } \msg_kernel_new:nnnn { xparse } { grouped-in-expandable } {% @@ -2684,7 +2671,9 @@ } \cs_new_protected:Npn \RenewDocumentCommand #1#2#3 { \cs_if_exist:NTF #1 { - \xparse_declare_cmd:Nnn #1 {#2} {#3} + \xparse_declare_cmd_aux:Nnn #1 {#2} {#3} + \msg_kernel_info:nnxx { xparse } { redefine-command } + { \token_to_str:N #1 } { \exp_not:n {#2} } }{ \msg_kernel_error:nnx { xparse } { command-not-yet-defined } { \token_to_str:N #1 } diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx b/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx index d6f317c1072..297291a3d7f 100644 --- a/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx @@ -38,7 +38,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: xtemplate.dtx 1896 2010-04-14 17:40:38Z joseph $ +\GetIdInfo$Id: xtemplate.dtx 2037 2010-09-20 21:22:45Z joseph $ {Prototype document functions} %\iffalse %<*driver> @@ -1576,10 +1576,10 @@ %\begin{macro}{\xtemplate_if_key_value:nT} %\begin{macro}{\xtemplate_if_key_value:VT} % Tests for the first token in a string being \cs{KeyValue}, where -% \cs{DelayEvaluation} is not important. +% \cs{EvaluateNow} is not important. % \begin{macrocode} \prg_set_conditional:Nnn \xtemplate_if_key_value:n { T } { - \tl_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_nil } { + \str_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_stop } { \prg_return_true: }{ \prg_return_false: @@ -1594,7 +1594,7 @@ % Tests for the first token in a string being \cs{EvaluateNow}. % \begin{macrocode} \prg_new_conditional:Nnn \xtemplate_if_eval_now:n { TF } { - \tl_if_eq:noTF { \EvaluateNow } { \tl_head:w #1 \q_nil } { + \str_if_eq:noTF { \EvaluateNow } { \tl_head:w #1 \q_stop } { \prg_return_true: }{ \prg_return_false: @@ -1620,7 +1620,7 @@ % Tests for the first token in a string being \cs{UseTemplate}. % \begin{macrocode} \prg_new_conditional:Nnn \xtemplate_if_use_template:n { TF } { - \tl_if_eq:noTF { \UseTemplate } { \tl_head:w #1 \q_nil } { + \str_if_eq:noTF { \UseTemplate } { \tl_head:w #1 \q_stop } { \prg_return_true: }{ \prg_return_false: @@ -1840,7 +1840,7 @@ } } \cs_new_nopar:Npn \xtemplate_parse_keys_elt_aux:n #1 { - \tl_if_eq:VnT \l_xtemplate_keytype_tl {#1} { + \str_if_eq:VnT \l_xtemplate_keytype_tl {#1} { \tl_if_empty:NT \l_xtemplate_keytype_arg_tl { \msg_kernel_error:nnx { xtemplate } { keytype-requires-argument } {#1} @@ -1857,7 +1857,7 @@ \prop_put:NVV \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl \l_xtemplate_tmp_tl \seq_put_right:NV \l_xtemplate_key_seq \l_xtemplate_key_name_tl - \tl_if_eq:VnT \l_xtemplate_keytype_tl { choice } { + \str_if_eq:VnT \l_xtemplate_keytype_tl { choice } { \clist_if_in:NnT \l_xtemplate_keytype_arg_tl { unknown } { \msg_kernel_error:nn { xtemplate } { choice-unknown-reserved } } @@ -1877,7 +1877,7 @@ % \begin{macrocode} \cs_new:Npn \xtemplate_parse_keys_elt:nn #1#2 { \xtemplate_parse_keys_elt:n {#1} - \tl_if_eq:VnTF \l_xtemplate_keytype_tl { choice } { + \str_if_eq:VnTF \l_xtemplate_keytype_tl { choice } { \xtemplate_store_value_choice_name:n {#2} }{ \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#2} @@ -2225,16 +2225,16 @@ % there are a few related checks to make. % \begin{macrocode} \cs_new:Npn \xtemplate_parse_vars_elt_aux:n #1 { - \tl_if_eq:VnTF \l_xtemplate_keytype_tl { choice } + \str_if_eq:VnTF \l_xtemplate_keytype_tl { choice } { \xtemplate_implement_choices:n {#1} } { - \tl_if_eq:VnTF \l_xtemplate_keytype_tl { code } + \str_if_eq:VnTF \l_xtemplate_keytype_tl { code } { \prop_put:NVn \l_xtemplate_vars_prop \l_xtemplate_key_name_tl {#1} } { - \tl_if_eq:noTF {#1} { \tl_head:w #1 \q_nil } + \str_if_eq:noTF {#1} { \tl_head:w #1 \q_stop } { \cs_if_exist:NTF #1 { @@ -2249,7 +2249,7 @@ } { \tl_if_in:nnTF {#1} { global } - { \xtemplate_parse_vars_elt_aux:w #1 \q_nil } + { \xtemplate_parse_vars_elt_aux:w #1 \q_stop } { \msg_kernel_error:nnx { xtemplate } { bad-variable } { \exp_not:n {#1} } @@ -2258,10 +2258,10 @@ } } } -\cs_new:Npn \xtemplate_parse_vars_elt_aux:w #1 global #2 \q_nil { +\cs_new:Npn \xtemplate_parse_vars_elt_aux:w #1 global #2 \q_stop { \tl_if_empty:nTF {#1} { - \tl_if_eq:noTF {#2} { \tl_head:w #2 \q_nil } + \str_if_eq:noTF {#2} { \tl_head:w #2 \q_stop } { \cs_if_exist:NTF #2 { @@ -2328,7 +2328,7 @@ % \begin{macrocode} \cs_new:Npn \xtemplate_implement_choice_elt:n #1 { \clist_if_empty:NTF \l_xtemplate_tmp_clist { - \tl_if_eq:nnF {#1} { unknown } { + \str_if_eq:nnF {#1} { unknown } { \prop_get:NVN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl \l_xtemplate_tmp_tl \xtemplate_split_keytype_arg:V \l_xtemplate_tmp_tl @@ -2596,8 +2596,8 @@ \prop_get:NnN \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl \prop_get:NnN \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl \xtemplate_split_keytype_arg:n {#2} - \tl_if_eq:VnF \l_xtemplate_keytype_tl { choice } { - \tl_if_eq:VnF \l_xtemplate_keytype_tl { code } { + \str_if_eq:VnF \l_xtemplate_keytype_tl { choice } { + \str_if_eq:VnF \l_xtemplate_keytype_tl { code } { \xtemplate_find_global: } } @@ -2885,7 +2885,7 @@ } } \cs_new:Npn \xtemplate_use_instance_aux:nNnnn #1#2#3#4#5 { - \tl_if_eq:nnTF {#1} {#3} { + \str_if_eq:nnTF {#1} {#3} { \xtemplate_use_template:nnn {#3} {#4} {#5} }{ \msg_kernel_error:nnxx { xtemplate } { type-mismatch } {#1} {#3} diff --git a/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex b/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex new file mode 100644 index 00000000000..a00531e0741 --- /dev/null +++ b/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex @@ -0,0 +1,46 @@ +% !TEX encoding = ISO-8859-1 +% !TEX program = pdflatex +% +% This file demonstrates the use of the l3keys2e module to allow +% LaTeX3 keyvals (created using l3keys) to be used as LaTeX2e +% package or class options. +% + +% First, create a class +\begin{filecontents}{l3keys2e-class.cls} + \LoadClass{article} + \RequirePackage{l3keys2e} + \ProvidesExplClass{l3keys2e-class}{0000/00/00}{0.0}{test} + \keys_define:nn { test1 } { + option1 .code:n = {\wlog{You~gave~`#1'~for~option1}} + } + \ProcessKeysOptions { test1 } +\end{filecontents} + +% Load the class with some options. +% The class itself recognises `option1', leaving `option2' and +% `option3' as global optons which are not yet used. +\documentclass[option1=check,option2=more stuff,option3=unused] + {l3keys2e-class} + +%Now create a package +\begin{filecontents}{l3keys2e-package.sty} + \RequirePackage{l3keys2e} + \ProvidesExplPackage{l3keys2e-package}{0000/00/00}{0.0}{test} + \keys_define:nn { test2 } { + option1 .code:n = {\wlog{You~gave~`#1'~for~option1~(again)}}, + option2 .code:n = {\wlog{You~gave~`#1'~for~option2}}, + option4 .code:n = {\wlog{You~gave~`#1'~for~option4}}, + } + \ProcessKeysOptions { test2 } +\end{filecontents} + +% Load the package. +\usepackage[option4={extra stuff},option5=undefined!] + {l3keys2e-package} + +\begin{document} +% The log should show that option3 is an unused global option, and that +% option5 is not known by the l3keys2e-demo package. Everything else +% should simply be listed in the log. +\end{document} diff --git a/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e.dtx b/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e.dtx index 0120127f93e..43eec9ceff8 100644 --- a/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e.dtx @@ -222,7 +222,7 @@ \keys_if_exist:nnF {#1} { unknown } { \keys_define:nn {#1} { unknown .code:n = { - \msg_warning:nnxx { Option~Processing } { unknown-option } + \msg_error:nnxx { Option~Processing } { unknown-option } { \l_keys_key_tl } { \@currname } } } |