diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-16 22:35:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-16 22:35:23 +0000 |
commit | b7f762397f5df2d732326713423e31e1bf91b903 (patch) | |
tree | 9dc78e4110734dc949a641156d369ec19ea78d8b /Master/texmf-dist/tex/latex/l3packages/xtemplate | |
parent | 49ffb8774d83e17edf47740577805287eb50fdb2 (diff) |
l3packages 2828 (15sep11)
git-svn-id: svn://tug.org/texlive/trunk@23982 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xtemplate')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index 1eb0de229bb..a5de89e8606 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -51,11 +51,11 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{expl3} -\GetIdInfo$Id: xtemplate.dtx 2729 2011-09-05 19:35:28Z joseph $ +\GetIdInfo$Id: xtemplate.dtx 2828 2011-09-15 20:04:53Z joseph $ {L3 Experimental prototype document functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\@ifpackagelater { expl3 } { 2011/09/05 } +\@ifpackagelater { expl3 } { 2011/09/15 } { } { \PackageError { xtemplate } { Support~package~l3kernel~too~old. } @@ -524,18 +524,12 @@ \l_xtemplate_key_name_tl {#1} } { - \str_if_eq:noTF {#1} { \tl_head:w #1 \q_nil \q_stop } + \tl_if_single:nTF {#1} { - \cs_if_exist:NTF #1 - { - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#1} - } - { - \msg_error:nnx { xtemplate } - { variable-not-declared } - { \token_to_str:N #1 } - } + \cs_if_exist:NF #1 + { \xtemplate_create_variable:N #1 } + \prop_put:Non \l_xtemplate_vars_prop + \l_xtemplate_key_name_tl {#1} } { \tl_if_in:nnTF {#1} { global } @@ -552,17 +546,12 @@ { \tl_if_empty:nTF {#1} { - \str_if_eq:noTF {#2} { \tl_head:w #2 \q_nil \q_stop } + \tl_if_single:nTF {#2} { - \cs_if_exist:NTF #2 - { - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl { #1 global #2 } - } - { - \msg_error:nnx { xtemplate } - { variable-not-declared } { \token_to_str:N #2 } - } + \cs_if_exist:NF #2 + { \xtemplate_create_variable:N #2 } + \prop_put:Non \l_xtemplate_vars_prop + \l_xtemplate_key_name_tl { #1 global #2 } } { \msg_error:nnx { xtemplate } { bad-variable } @@ -574,6 +563,20 @@ { \tl_to_str:n { #1 global #2 } } } } +\cs_new_protected_nopar:Npn \xtemplate_create_variable:N #1 + { + \prg_case_str:onn \l_xtemplate_keytype_tl + { + { boolean } { \bool_new:N #1 } + { function } { \cs_new:Npn #1 { } } + { instance } { \cs_new_protected:Npn #1 { } } + { integer } { \int_new:N #1 } + { length } { \dim_new:N #1 } + { real } { \fp_new:N #1 } + { tokenlist } { \tl_new:N #1 } + } + { \use:c { \l_xtemplate_keytype_tl _ new:N } #1 } + } \cs_new_protected:Npn \xtemplate_implement_choices:n #1 { \clist_set_eq:NN \l_xtemplate_tmp_clist \l_xtemplate_keytype_arg_tl @@ -952,7 +955,6 @@ { \xtemplate_assign_tokenlist_aux:N \tl_gset:Nn } { \xtemplate_assign_tokenlist_aux:N \tl_set:Nn } } -\cs_new_eq:NN \xtemplate_assign_commalist: \xtemplate_assign_tokenlist: \cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist_aux:N #1 { \xtemplate_if_key_value:oT \l_xtemplate_value_tl @@ -963,6 +965,12 @@ { \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 } + } \cs_new_protected_nopar:Npn \xtemplate_assign_variable:N #1 { \xtemplate_if_key_value:oT \l_xtemplate_value_tl @@ -1295,12 +1303,6 @@ No~interface~has~been~declared~for~a~template~ '#2'~of~object~type~'#1'. } -\msg_new:nnnn { xtemplate } { variable-not-declared } - { The~variable~'#1'~has~not~been~declared. } - { - Before~declaring~an~instance,~all~of~the~required~variables~ - used~in~template~keys~must~be~created. - } \msg_new:nnn { xtemplate } { declare-object-type } { Declaring~object~type~'#1'~taking~#2~argument(s)~\msg_line_context:. } \msg_new:nnn { xtemplate } { declare-template-code } |