summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty68
1 files changed, 44 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
index 0ed7ef8e49e..c2fa5195eba 100644
--- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
+++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
@@ -50,8 +50,8 @@
%%
%% -----------------------------------------------------------------------
%%
-\RequirePackage{expl3}[2012/09/29]
-\@ifpackagelater{expl3}{2012/09/29}
+\RequirePackage{expl3}[2012/11/21]
+\@ifpackagelater{expl3}{2012/11/21}
{}
{%
\PackageError{xtemplate}{Support package l3kernel too old.}
@@ -62,7 +62,7 @@
}%
\endinput
}
-\GetIdInfo$Id: xtemplate.dtx 4249 2012-09-29 22:17:28Z joseph $
+\GetIdInfo$Id: xtemplate.dtx 4332 2012-11-21 21:40:31Z joseph $
{L3 Experimental prototype document functions}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -146,13 +146,15 @@
{#1} {#2}
}
}
-\prg_new_conditional:Npnn \__xtemplate_if_key_value:n #1 { T }
+\prg_new_conditional:Npnn \__xtemplate_if_key_value:n #1 { T , F , TF }
{
\str_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_nil \q_stop }
- {\prg_return_true: }
+ { \prg_return_true: }
{ \prg_return_false: }
}
-\cs_generate_variant:Nn \__xtemplate_if_key_value:nT { o }
+\cs_generate_variant:Nn \__xtemplate_if_key_value:nT { o }
+\cs_generate_variant:Nn \__xtemplate_if_key_value:nF { o }
+\cs_generate_variant:Nn \__xtemplate_if_key_value:nTF { o }
\prg_new_conditional:Npnn \__xtemplate_if_eval_now:n #1 { TF }
{
\str_if_eq:noTF { \EvaluateNow } { \tl_head:w #1 \q_nil \q_stop }
@@ -843,7 +845,7 @@
{
\__xtemplate_if_key_value:oT \l__xtemplate_value_tl
{ \__xtemplate_key_to_value: }
- \tl_put_left:Nx \l__xtemplate_assignments_tl
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
{
\exp_not:c { #1 _ \l__xtemplate_value_tl :N }
\exp_not:o \l__xtemplate_var_tl
@@ -877,7 +879,7 @@
\cs_generate_variant:Nn \__xtemplate_assign_choice_aux:nF { x }
\cs_new_protected_nopar:Npn \__xtemplate_assign_code:
{
- \tl_put_left:Nx \l__xtemplate_assignments_tl
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
{
\cs_set_protected:Npn \__xtemplate_assign_code:n \exp_not:n {##1}
{ \exp_not:o \l__xtemplate_var_tl }
@@ -893,7 +895,7 @@
}
\cs_new_protected_nopar:Npn \__xtemplate_assign_function_aux:N #1
{
- \tl_put_left:Nx \l__xtemplate_assignments_tl
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
{
\cs_generate_from_arg_count:NNnn
\exp_not:o \l__xtemplate_var_tl
@@ -910,7 +912,7 @@
}
\cs_new_protected_nopar:Npn \__xtemplate_assign_instance_aux:N #1
{
- \tl_put_left:Nx \l__xtemplate_assignments_tl
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
{
\exp_not:N #1 \exp_not:o \l__xtemplate_var_tl
{
@@ -953,50 +955,68 @@
\cs_new_protected_nopar:Npn \__xtemplate_assign_tokenlist:
{
\bool_if:NTF \l__xtemplate_global_bool
- { \__xtemplate_assign_tokenlist_aux:N \tl_gset:Nn }
- { \__xtemplate_assign_tokenlist_aux:N \tl_set:Nn }
+ { \__xtemplate_assign_tokenlist_aux:NN \tl_gset:NV \tl_gset:Nn }
+ { \__xtemplate_assign_tokenlist_aux:NN \tl_set:NV \tl_set:Nn }
}
-\cs_new_protected_nopar:Npn \__xtemplate_assign_tokenlist_aux:N #1
+\cs_new_protected_nopar:Npn \__xtemplate_assign_tokenlist_aux:NN #1#2
{
- \__xtemplate_if_key_value:oT \l__xtemplate_value_tl
- { \__xtemplate_key_to_value: }
- \tl_put_left:Nx \l__xtemplate_assignments_tl
+ \__xtemplate_if_key_value:oTF \l__xtemplate_value_tl
{
- #1 \exp_not:o \l__xtemplate_var_tl
- { \exp_not:o \l__xtemplate_value_tl }
+ \__xtemplate_key_to_value:
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
+ {
+ #1 \exp_not:o \l__xtemplate_var_tl
+ \exp_not:o \l__xtemplate_value_tl
+ }
+ }
+ {
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
+ {
+ #2 \exp_not:o \l__xtemplate_var_tl
+ { \exp_not:o \l__xtemplate_value_tl }
+ }
}
}
\cs_new_protected_nopar:Npn \__xtemplate_assign_commalist:
{
\bool_if:NTF \l__xtemplate_global_bool
- { \__xtemplate_assign_tokenlist_aux:N \clist_gset:Nn }
- { \__xtemplate_assign_tokenlist_aux:N \clist_set:Nn }
+ { \__xtemplate_assign_tokenlist_aux:NN \clist_gset:NV \clist_gset:Nn }
+ { \__xtemplate_assign_tokenlist_aux:NN \clist_set:NV \clist_set:Nn }
}
\cs_new_protected_nopar:Npn \__xtemplate_assign_variable:N #1
{
\__xtemplate_if_key_value:oT \l__xtemplate_value_tl
{ \__xtemplate_key_to_value: }
- \tl_put_left:Nx \l__xtemplate_assignments_tl
+ \tl_put_right:Nx \l__xtemplate_assignments_tl
{
#1 \exp_not:o \l__xtemplate_var_tl
{ \exp_not:o \l__xtemplate_value_tl }
}
}
\cs_new_protected_nopar:Npn \__xtemplate_key_to_value:
- { \exp_after:wN \__xtemplate_key_to_value_aux:w \l__xtemplate_value_tl }
-\cs_new_protected:Npn \__xtemplate_key_to_value_aux:w \KeyValue #1
+ { \exp_after:wN \__xtemplate_key_to_value_auxi:w \l__xtemplate_value_tl }
+\cs_new_protected:Npn \__xtemplate_key_to_value_auxi:w \KeyValue #1
{
\tl_set:Nx \l__xtemplate_tmp_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ }
- \prop_get:NoNF
+ \prop_get:NoNTF
\l__xtemplate_vars_prop
\l__xtemplate_tmp_tl
\l__xtemplate_value_tl
{
+ \exp_after:wN \__xtemplate_key_to_value_auxii:w \l__xtemplate_value_tl
+ \q_mark global \q_nil \q_stop
+ }
+ {
\msg_error:nnx { xtemplate } { unknown-attribute }
{ \l__xtemplate_tmp_tl }
}
}
+\cs_new_protected:Npn \__xtemplate_key_to_value_auxii:w #1 global #2#3 \q_stop
+ {
+ \quark_if_nil:NF #2
+ { \tl_set:Nn \l__xtemplate_value_tl {#2} }
+ }
\cs_new_protected:Npn \__xtemplate_use_instance:nn #1#2
{
\__xtemplate_if_use_template:nTF {#2}