diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 17:15:15 +0000 |
commit | dadf86ec2d90ed4529037604a8dcea9f660045b8 (patch) | |
tree | 819b3708bda1e2a087ebd5fb0f0f55ebe0b4d157 /Master/texmf-dist/tex/latex/l3packages/xtemplate | |
parent | 134349701bddf7cbbacf6030c6b9f9838aff96fa (diff) |
l3packages 3990 (17jul12)
git-svn-id: svn://tug.org/texlive/trunk@27109 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 | 1156 |
1 files changed, 578 insertions, 578 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index be5aca383b4..bda0b918cce 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -50,191 +50,191 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2012/04/23] -\@ifpackagelater{expl3}{2012/04/23} +\RequirePackage{expl3}[2012/07/16] +\@ifpackagelater{expl3}{2012/07/16} {} - { + {% \PackageError{xtemplate}{Support package l3kernel too old.} - { + {% Please install an up to date version of l3kernel using your TeX package manager or from CTAN.\\ \\ - Loading xtemplate will abort! - } + Loading xtemplate will abort!% + }% \endinput } -\GetIdInfo$Id: xtemplate.dtx 3570 2012-04-23 13:24:55Z joseph $ +\GetIdInfo$Id: xtemplate.dtx 3990 2012-07-16 07:46:03Z joseph $ {L3 Experimental prototype document functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\tl_const:Nn \c_xtemplate_code_root_tl { template~code~>~ } -\tl_const:Nn \c_xtemplate_defaults_root_tl { template~defaults~>~ } -\tl_const:Nn \c_xtemplate_instances_root_tl { template~instance~>~ } -\tl_const:Nn \c_xtemplate_keytypes_root_tl { template~key~types~>~ } -\tl_const:Nn \c_xtemplate_key_order_root_tl { template~key~order~>~ } -\tl_const:Nn \c_xtemplate_restrict_root_tl { template~restrictions~>~ } -\tl_const:Nn \c_xtemplate_values_root_tl { template~values~>~ } -\tl_const:Nn \c_xtemplate_vars_root_tl { template~vars~>~ } -\seq_new:N \c_xtemplate_keytypes_arg_seq -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { choice } -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { function } -\seq_put_right:Nn \c_xtemplate_keytypes_arg_seq { instance } -\prop_new:N \g_xtemplate_object_type_prop -\tl_new:N \l_xtemplate_assignments_tl -\tl_new:N \l_xtemplate_collection_tl -\prop_new:N \l_xtemplate_collections_prop -\tl_new:N \l_xtemplate_default_tl -\bool_new:N \l_xtemplate_error_bool -\bool_new:N \l_xtemplate_global_bool -\bool_new:N \l_xtemplate_restrict_bool -\clist_new:N \l_xtemplate_restrict_clist -\tl_new:N \l_xtemplate_key_name_tl -\tl_new:N \l_xtemplate_keytype_tl -\tl_new:N \l_xtemplate_keytype_arg_tl -\tl_new:N \l_xtemplate_value_tl -\tl_new:N \l_xtemplate_var_tl -\prop_new:N \l_xtemplate_keytypes_prop -\seq_new:N \l_xtemplate_key_order_seq -\prop_new:N \l_xtemplate_values_prop -\prop_new:N \l_xtemplate_vars_prop -\clist_new:N \l_xtemplate_tmp_clist -\dim_new:N \l_xtemplate_tmp_dim -\int_new:N \l_xtemplate_tmp_int -\muskip_new:N \l_xtemplate_tmp_muskip -\skip_new:N \l_xtemplate_tmp_skip -\tl_new:N \l_xtemplate_tmp_tl +\tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } +\tl_const:Nn \c__xtemplate_defaults_root_tl { template~defaults~>~ } +\tl_const:Nn \c__xtemplate_instances_root_tl { template~instance~>~ } +\tl_const:Nn \c__xtemplate_keytypes_root_tl { template~key~types~>~ } +\tl_const:Nn \c__xtemplate_key_order_root_tl { template~key~order~>~ } +\tl_const:Nn \c__xtemplate_restrict_root_tl { template~restrictions~>~ } +\tl_const:Nn \c__xtemplate_values_root_tl { template~values~>~ } +\tl_const:Nn \c__xtemplate_vars_root_tl { template~vars~>~ } +\seq_new:N \c__xtemplate_keytypes_arg_seq +\seq_put_right:Nn \c__xtemplate_keytypes_arg_seq { choice } +\seq_put_right:Nn \c__xtemplate_keytypes_arg_seq { function } +\seq_put_right:Nn \c__xtemplate_keytypes_arg_seq { instance } +\prop_new:N \g__xtemplate_object_type_prop +\tl_new:N \l__xtemplate_assignments_tl +\tl_new:N \l__xtemplate_collection_tl +\prop_new:N \l__xtemplate_collections_prop +\tl_new:N \l__xtemplate_default_tl +\bool_new:N \l__xtemplate_error_bool +\bool_new:N \l__xtemplate_global_bool +\bool_new:N \l__xtemplate_restrict_bool +\clist_new:N \l__xtemplate_restrict_clist +\tl_new:N \l__xtemplate_key_name_tl +\tl_new:N \l__xtemplate_keytype_tl +\tl_new:N \l__xtemplate_keytype_arg_tl +\tl_new:N \l__xtemplate_value_tl +\tl_new:N \l__xtemplate_var_tl +\prop_new:N \l__xtemplate_keytypes_prop +\seq_new:N \l__xtemplate_key_order_seq +\prop_new:N \l__xtemplate_values_prop +\prop_new:N \l__xtemplate_vars_prop +\clist_new:N \l__xtemplate_tmp_clist +\dim_new:N \l__xtemplate_tmp_dim +\int_new:N \l__xtemplate_tmp_int +\muskip_new:N \l__xtemplate_tmp_muskip +\skip_new:N \l__xtemplate_tmp_skip +\tl_new:N \l__xtemplate_tmp_tl \cs_generate_variant:Nn \prop_get:NnNTF { No } \cs_generate_variant:Nn \prop_get:NnNT { No } \cs_generate_variant:Nn \prop_get:NnNF { No } -\cs_new_protected:Npn \xtemplate_execute_if_arg_agree:nnT #1#2#3 +\cs_new_protected:Npn \__xtemplate_execute_if_arg_agree:nnT #1#2#3 { - \prop_get:NnN \g_xtemplate_object_type_prop {#1} \l_xtemplate_tmp_tl - \int_compare:nNnTF {#2} = \l_xtemplate_tmp_tl + \prop_get:NnN \g__xtemplate_object_type_prop {#1} \l__xtemplate_tmp_tl + \int_compare:nNnTF {#2} = \l__xtemplate_tmp_tl {#3} { \msg_error:nnxxx { xtemplate } - { argument-number-mismatch } {#1} { \l_xtemplate_tmp_tl } {#2} + { argument-number-mismatch } {#1} { \l__xtemplate_tmp_tl } {#2} } } -\cs_new_protected:Npn \xtemplate_execute_if_code_exist:nnT #1#2#3 +\cs_new_protected:Npn \__xtemplate_execute_if_code_exist:nnT #1#2#3 { - \cs_if_exist:cTF { \c_xtemplate_code_root_tl #1 / #2 } + \cs_if_exist:cTF { \c__xtemplate_code_root_tl #1 / #2 } {#3} { \msg_error:nnxx { xtemplate } { no-template-code } {#1} {#2} } } -\cs_new_protected:Npn \xtemplate_execute_if_keytype_exist:nT #1#2 +\cs_new_protected:Npn \__xtemplate_execute_if_keytype_exist:nT #1#2 { - \cs_if_exist:cTF { xtemplate_store_value_ #1 :n } + \cs_if_exist:cTF { __xtemplate_store_value_ #1 :n } {#2} { \msg_error:nnx { xtemplate } { unknown-keytype } {#1} } } -\cs_generate_variant:Nn \xtemplate_execute_if_keytype_exist:nT { o } -\cs_new_protected:Npn \xtemplate_execute_if_type_exist:nT #1#2 +\cs_generate_variant:Nn \__xtemplate_execute_if_keytype_exist:nT { o } +\cs_new_protected:Npn \__xtemplate_execute_if_type_exist:nT #1#2 { - \prop_if_in:NnTF \g_xtemplate_object_type_prop {#1} + \prop_if_in:NnTF \g__xtemplate_object_type_prop {#1} {#2} { \msg_error:nnx { xtemplate } { unknown-object-type } {#1} } } -\cs_new_protected:Npn \xtemplate_if_keys_exist:nnT #1#2#3 +\cs_new_protected:Npn \__xtemplate_if_keys_exist:nnT #1#2#3 { - \cs_if_exist:cTF { \c_xtemplate_keytypes_root_tl #1 / #2 } + \cs_if_exist:cTF { \c__xtemplate_keytypes_root_tl #1 / #2 } {#3} { \msg_error:nnxx { xtemplate } { unknown-template } {#1} {#2} } } -\prg_new_conditional:Npnn \xtemplate_if_key_value:n #1 { T } +\prg_new_conditional:Npnn \__xtemplate_if_key_value:n #1 { T } { \str_if_eq:noTF { \KeyValue } { \tl_head:w #1 \q_nil \q_stop } {\prg_return_true: } { \prg_return_false: } } -\cs_generate_variant:Nn \xtemplate_if_key_value:nT { o } -\prg_new_conditional:Npnn \xtemplate_if_eval_now:n #1 { TF } +\cs_generate_variant:Nn \__xtemplate_if_key_value:nT { 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 } { \prg_return_true: } { \prg_return_false: } } -\prg_new_conditional:Npnn \xtemplate_if_instance_exist:nnn #1#2#3 +\prg_new_conditional:Npnn \__xtemplate_if_instance_exist:nnn #1#2#3 { T, F, TF } { - \cs_if_exist:cTF { \c_xtemplate_instances_root_tl #1 / #2 / #3 } + \cs_if_exist:cTF { \c__xtemplate_instances_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } -\prg_new_conditional:Npnn \xtemplate_if_use_template:n #1 { TF } +\prg_new_conditional:Npnn \__xtemplate_if_use_template:n #1 { TF } { \str_if_eq:noTF { \UseTemplate } { \tl_head:w #1 \q_nil \q_stop } { \prg_return_true: } { \prg_return_false: } } -\cs_new_protected:Npn \xtemplate_store_defaults:n #1 +\cs_new_protected:Npn \__xtemplate_store_defaults:n #1 { - \prop_gclear_new:c { \c_xtemplate_defaults_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_defaults_root_tl #1 } - \l_xtemplate_values_prop + \prop_gclear_new:c { \c__xtemplate_defaults_root_tl #1 } + \prop_gset_eq:cN { \c__xtemplate_defaults_root_tl #1 } + \l__xtemplate_values_prop } -\cs_new_protected:Npn \xtemplate_store_keytypes:n #1 +\cs_new_protected:Npn \__xtemplate_store_keytypes:n #1 { - \prop_gclear_new:c { \c_xtemplate_keytypes_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_keytypes_root_tl #1 } - \l_xtemplate_keytypes_prop - \seq_gclear_new:c { \c_xtemplate_key_order_root_tl #1 } - \seq_gset_eq:cN { \c_xtemplate_key_order_root_tl #1 } - \l_xtemplate_key_order_seq + \prop_gclear_new:c { \c__xtemplate_keytypes_root_tl #1 } + \prop_gset_eq:cN { \c__xtemplate_keytypes_root_tl #1 } + \l__xtemplate_keytypes_prop + \seq_gclear_new:c { \c__xtemplate_key_order_root_tl #1 } + \seq_gset_eq:cN { \c__xtemplate_key_order_root_tl #1 } + \l__xtemplate_key_order_seq } -\cs_new_protected:Npn \xtemplate_store_values:n #1 +\cs_new_protected:Npn \__xtemplate_store_values:n #1 { - \prop_clear_new:c { \c_xtemplate_values_root_tl #1 } - \prop_set_eq:cN { \c_xtemplate_values_root_tl #1 } - \l_xtemplate_values_prop + \prop_clear_new:c { \c__xtemplate_values_root_tl #1 } + \prop_set_eq:cN { \c__xtemplate_values_root_tl #1 } + \l__xtemplate_values_prop } -\cs_new_protected:Npn \xtemplate_store_restrictions:n #1 +\cs_new_protected:Npn \__xtemplate_store_restrictions:n #1 { - \clist_gclear_new:c { \c_xtemplate_restrict_root_tl #1 } - \clist_gset_eq:cN { \c_xtemplate_restrict_root_tl #1 } - \l_xtemplate_restrict_clist + \clist_gclear_new:c { \c__xtemplate_restrict_root_tl #1 } + \clist_gset_eq:cN { \c__xtemplate_restrict_root_tl #1 } + \l__xtemplate_restrict_clist } -\cs_new_protected:Npn \xtemplate_store_vars:n #1 +\cs_new_protected:Npn \__xtemplate_store_vars:n #1 { - \prop_gclear_new:c { \c_xtemplate_vars_root_tl #1 } - \prop_gset_eq:cN { \c_xtemplate_vars_root_tl #1 } - \l_xtemplate_vars_prop + \prop_gclear_new:c { \c__xtemplate_vars_root_tl #1 } + \prop_gset_eq:cN { \c__xtemplate_vars_root_tl #1 } + \l__xtemplate_vars_prop } -\cs_new_protected:Npn \xtemplate_recover_defaults:n #1 +\cs_new_protected:Npn \__xtemplate_recover_defaults:n #1 { - \prop_set_eq:Nc \l_xtemplate_values_prop - { \c_xtemplate_defaults_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_values_prop + { \c__xtemplate_defaults_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_keytypes:n #1 +\cs_new_protected:Npn \__xtemplate_recover_keytypes:n #1 { - \prop_set_eq:Nc \l_xtemplate_keytypes_prop - { \c_xtemplate_keytypes_root_tl #1 } - \seq_set_eq:Nc \l_xtemplate_key_order_seq - { \c_xtemplate_key_order_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_keytypes_prop + { \c__xtemplate_keytypes_root_tl #1 } + \seq_set_eq:Nc \l__xtemplate_key_order_seq + { \c__xtemplate_key_order_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_restrictions:n #1 +\cs_new_protected:Npn \__xtemplate_recover_restrictions:n #1 { - \clist_set_eq:Nc \l_xtemplate_restrict_clist - { \c_xtemplate_restrict_root_tl #1 } + \clist_set_eq:Nc \l__xtemplate_restrict_clist + { \c__xtemplate_restrict_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_values:n #1 +\cs_new_protected:Npn \__xtemplate_recover_values:n #1 { - \prop_set_eq:Nc \l_xtemplate_values_prop - { \c_xtemplate_values_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_values_prop + { \c__xtemplate_values_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_recover_vars:n #1 +\cs_new_protected:Npn \__xtemplate_recover_vars:n #1 { - \prop_set_eq:Nc \l_xtemplate_vars_prop - { \c_xtemplate_vars_root_tl #1 } + \prop_set_eq:Nc \l__xtemplate_vars_prop + { \c__xtemplate_vars_root_tl #1 } } -\cs_new_protected:Npn \xtemplate_declare_object_type:nn #1#2 +\cs_new_protected:Npn \__xtemplate_declare_object_type:nn #1#2 { - \int_set:Nn \l_xtemplate_tmp_int {#2} + \int_set:Nn \l__xtemplate_tmp_int {#2} \bool_if:nTF { \int_compare_p:nNn {#2} > \c_nine || @@ -242,88 +242,88 @@ } { \msg_error:nnxx { xtemplate } { bad-number-of-arguments } - {#1} { \exp_not:V \l_xtemplate_tmp_int } + {#1} { \exp_not:V \l__xtemplate_tmp_int } } { \msg_info:nnxx { xtemplate } { declare-object-type } {#1} {#2} - \prop_gput:NnV \g_xtemplate_object_type_prop {#1} - \l_xtemplate_tmp_int + \prop_gput:NnV \g__xtemplate_object_type_prop {#1} + \l__xtemplate_tmp_int } } -\cs_new_protected:Npn \xtemplate_declare_template_keys:nnnn #1#2#3#4 +\cs_new_protected:Npn \__xtemplate_declare_template_keys:nnnn #1#2#3#4 { - \xtemplate_execute_if_type_exist:nT {#1} + \__xtemplate_execute_if_type_exist:nT {#1} { - \xtemplate_execute_if_arg_agree:nnT {#1} {#3} + \__xtemplate_execute_if_arg_agree:nnT {#1} {#3} { - \prop_clear:N \l_xtemplate_values_prop - \prop_clear:N \l_xtemplate_keytypes_prop - \seq_clear:N \l_xtemplate_key_order_seq + \prop_clear:N \l__xtemplate_values_prop + \prop_clear:N \l__xtemplate_keytypes_prop + \seq_clear:N \l__xtemplate_key_order_seq \keyval_parse:NNn - \xtemplate_parse_keys_elt:n \xtemplate_parse_keys_elt:nn {#4} - \xtemplate_store_defaults:n { #1 / #2 } - \xtemplate_store_keytypes:n { #1 / #2 } + \__xtemplate_parse_keys_elt:n \__xtemplate_parse_keys_elt:nn {#4} + \__xtemplate_store_defaults:n { #1 / #2 } + \__xtemplate_store_keytypes:n { #1 / #2 } } } } -\cs_new_protected:Npn \xtemplate_parse_keys_elt:n #1 +\cs_new_protected:Npn \__xtemplate_parse_keys_elt:n #1 { - \xtemplate_split_keytype:n {#1} - \bool_if:NF \l_xtemplate_error_bool + \__xtemplate_split_keytype:n {#1} + \bool_if:NF \l__xtemplate_error_bool { - \xtemplate_execute_if_keytype_exist:oT \l_xtemplate_keytype_tl + \__xtemplate_execute_if_keytype_exist:oT \l__xtemplate_keytype_tl { - \seq_map_function:NN \c_xtemplate_keytypes_arg_seq - \xtemplate_parse_keys_elt_aux:n - \bool_if:NF \l_xtemplate_error_bool + \seq_map_function:NN \c__xtemplate_keytypes_arg_seq + \__xtemplate_parse_keys_elt_aux:n + \bool_if:NF \l__xtemplate_error_bool { - \seq_if_in:NoTF \l_xtemplate_key_order_seq - \l_xtemplate_key_name_tl + \seq_if_in:NoTF \l__xtemplate_key_order_seq + \l__xtemplate_key_name_tl { \msg_error:nnx { xtemplate } { duplicate-key-interface } - { \l_xtemplate_key_name_tl } + { \l__xtemplate_key_name_tl } } - { \xtemplate_parse_keys_elt_aux: } + { \__xtemplate_parse_keys_elt_aux: } } } } } -\cs_new_protected_nopar:Npn \xtemplate_parse_keys_elt_aux:n #1 +\cs_new_protected_nopar:Npn \__xtemplate_parse_keys_elt_aux:n #1 { - \str_if_eq:onT \l_xtemplate_keytype_tl {#1} + \str_if_eq:onT \l__xtemplate_keytype_tl {#1} { - \tl_if_empty:NT \l_xtemplate_keytype_arg_tl + \tl_if_empty:NT \l__xtemplate_keytype_arg_tl { \msg_error:nnx { xtemplate } { keytype-requires-argument } {#1} - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l__xtemplate_error_bool \seq_map_break: } } } -\cs_new_nopar:Npn \xtemplate_parse_keys_elt_aux: +\cs_new_nopar:Npn \__xtemplate_parse_keys_elt_aux: { - \tl_set:Nx \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_tmp_tl { - \l_xtemplate_keytype_tl - \tl_if_empty:NF \l_xtemplate_keytype_arg_tl - { { \l_xtemplate_keytype_arg_tl } } + \l__xtemplate_keytype_tl + \tl_if_empty:NF \l__xtemplate_keytype_arg_tl + { { \l__xtemplate_keytype_arg_tl } } } - \prop_put:Noo \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \seq_put_right:No \l_xtemplate_key_order_seq \l_xtemplate_key_name_tl - \str_if_eq:onT \l_xtemplate_keytype_tl { choice } + \prop_put:Noo \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \seq_put_right:No \l__xtemplate_key_order_seq \l__xtemplate_key_name_tl + \str_if_eq:onT \l__xtemplate_keytype_tl { choice } { - \clist_if_in:NnT \l_xtemplate_keytype_arg_tl { unknown } + \clist_if_in:NnT \l__xtemplate_keytype_arg_tl { unknown } { \msg_error:nn { xtemplate } { choice-unknown-reserved } } } } -\cs_new_protected:Npn \xtemplate_parse_keys_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_keys_elt:nn #1#2 { - \xtemplate_parse_keys_elt:n {#1} - \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#2} + \__xtemplate_parse_keys_elt:n {#1} + \use:c { __xtemplate_store_value_ \l__xtemplate_keytype_tl :n } {#2} } \group_begin: \char_set_lccode:nn { `\@ } { `\: } @@ -331,209 +331,209 @@ \tl_to_lowercase:n { \group_end: - \cs_new_protected:Npn \xtemplate_split_keytype:n #1 + \cs_new_protected:Npn \__xtemplate_split_keytype:n #1 { - \bool_set_false:N \l_xtemplate_error_bool - \tl_set:Nn \l_xtemplate_tmp_tl {#1} - \tl_remove_all:Nn \l_xtemplate_tmp_tl { ~ } - \tl_replace_all:Nnn \l_xtemplate_tmp_tl { : } { @ } - \tl_if_in:onTF \l_xtemplate_tmp_tl { @ } + \bool_set_false:N \l__xtemplate_error_bool + \tl_set:Nn \l__xtemplate_tmp_tl {#1} + \tl_remove_all:Nn \l__xtemplate_tmp_tl { ~ } + \tl_replace_all:Nnn \l__xtemplate_tmp_tl { : } { @ } + \tl_if_in:onTF \l__xtemplate_tmp_tl { @ } { - \tl_clear:N \l_xtemplate_key_name_tl - \exp_after:wN \xtemplate_split_keytype_aux:w - \l_xtemplate_tmp_tl \q_stop + \tl_clear:N \l__xtemplate_key_name_tl + \exp_after:wN \__xtemplate_split_keytype_aux:w + \l__xtemplate_tmp_tl \q_stop } { - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l__xtemplate_error_bool \msg_error:nnx { xtemplate } { missing-keytype } {#1} } } - \cs_new_protected:Npn \xtemplate_split_keytype_aux:w #1 @ #2 \q_stop + \cs_new_protected:Npn \__xtemplate_split_keytype_aux:w #1 @ #2 \q_stop { - \tl_put_right:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_put_right:Nx \l__xtemplate_key_name_tl { \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { @ } { - \tl_put_right:Nn \l_xtemplate_key_name_tl { @ } - \xtemplate_split_keytype_aux:w #2 \q_stop + \tl_put_right:Nn \l__xtemplate_key_name_tl { @ } + \__xtemplate_split_keytype_aux:w #2 \q_stop } { - \tl_if_empty:NTF \l_xtemplate_key_name_tl + \tl_if_empty:NTF \l__xtemplate_key_name_tl { \msg_error:nnx { xtemplate } { empty-key-name } { @ #2 } } - { \xtemplate_split_keytype_arg:n {#2} } + { \__xtemplate_split_keytype_arg:n {#2} } } } } -\cs_new_protected:Npn \xtemplate_split_keytype_arg:n #1 +\cs_new_protected:Npn \__xtemplate_split_keytype_arg:n #1 { - \tl_set:Nn \l_xtemplate_keytype_tl {#1} - \tl_clear:N \l_xtemplate_keytype_arg_tl - \cs_set_protected_nopar:Npn \xtemplate_split_keytype_arg_aux:n ##1 + \tl_set:Nn \l__xtemplate_keytype_tl {#1} + \tl_clear:N \l__xtemplate_keytype_arg_tl + \cs_set_protected_nopar:Npn \__xtemplate_split_keytype_arg_aux:n ##1 { \tl_if_in:nnT {#1} {##1} { - \cs_set:Npn \xtemplate_split_keytype_arg_aux:w + \cs_set:Npn \__xtemplate_split_keytype_arg_aux:w ####1 ##1 ####2 \q_stop { \tl_if_empty:nT {####1} { - \tl_set:Nn \l_xtemplate_keytype_tl {##1} - \tl_set:Nn \l_xtemplate_keytype_arg_tl {####2} + \tl_set:Nn \l__xtemplate_keytype_tl {##1} + \tl_set:Nn \l__xtemplate_keytype_arg_tl {####2} \seq_map_break: } } - \xtemplate_split_keytype_arg_aux:w #1 \q_stop + \__xtemplate_split_keytype_arg_aux:w #1 \q_stop } } - \seq_map_function:NN \c_xtemplate_keytypes_arg_seq - \xtemplate_split_keytype_arg_aux:n + \seq_map_function:NN \c__xtemplate_keytypes_arg_seq + \__xtemplate_split_keytype_arg_aux:n } -\cs_generate_variant:Nn \xtemplate_split_keytype_arg:n { o } -\cs_new_nopar:Npn \xtemplate_split_keytype_arg_aux:n #1 { } -\cs_new_nopar:Npn \xtemplate_split_keytype_arg_aux:w #1 \q_stop { } -\cs_new_protected:Npn \xtemplate_store_value_boolean:n #1 +\cs_generate_variant:Nn \__xtemplate_split_keytype_arg:n { o } +\cs_new_nopar:Npn \__xtemplate_split_keytype_arg_aux:n #1 { } +\cs_new_nopar:Npn \__xtemplate_split_keytype_arg_aux:w #1 \q_stop { } +\cs_new_protected:Npn \__xtemplate_store_value_boolean:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { \bool_if:cTF { c_ #1 _bool } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl { true } } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl { false } } } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_code:n #1 - { \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} } -\cs_new_eq:NN \xtemplate_store_value_choice:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_commalist:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_function:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_instance:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_real:n \xtemplate_store_value_code:n -\cs_new_eq:NN \xtemplate_store_value_tokenlist:n \xtemplate_store_value_code:n -\cs_new_protected:Npn \xtemplate_store_value_integer:n #1 - { - \xtemplate_if_eval_now:nTF {#1} +\cs_new_protected:Npn \__xtemplate_store_value_code:n #1 + { \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } +\cs_new_eq:NN \__xtemplate_store_value_choice:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_commalist:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_function:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_instance:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_real:n \__xtemplate_store_value_code:n +\cs_new_eq:NN \__xtemplate_store_value_tokenlist:n \__xtemplate_store_value_code:n +\cs_new_protected:Npn \__xtemplate_store_value_integer:n #1 + { + \__xtemplate_if_eval_now:nTF {#1} { - \int_set:Nn \l_xtemplate_tmp_int {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_int - \l_xtemplate_tmp_int + \int_set:Nn \l__xtemplate_tmp_int {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_int + \l__xtemplate_tmp_int } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_length:n #1 +\cs_new_protected:Npn \__xtemplate_store_value_length:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { - \dim_set:Nn \l_xtemplate_tmp_dim {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_dim + \dim_set:Nn \l__xtemplate_tmp_dim {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_dim } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_muskip:n #1 +\cs_new_protected:Npn \__xtemplate_store_value_muskip:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { - \muskip_set:Nn \l_xtemplate_tmp_muskip {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_muskip + \muskip_set:Nn \l__xtemplate_tmp_muskip {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_muskip } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_store_value_skip:n #1 +\cs_new_protected:Npn \__xtemplate_store_value_skip:n #1 { - \xtemplate_if_eval_now:nTF {#1} + \__xtemplate_if_eval_now:nTF {#1} { - \skip_set:Nn \l_xtemplate_tmp_skip {#1} - \prop_put:NVV \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_skip + \skip_set:Nn \l__xtemplate_tmp_skip {#1} + \prop_put:NVV \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_skip } { - \prop_put:Non \l_xtemplate_values_prop \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_values_prop \l__xtemplate_key_name_tl {#1} } } -\cs_new_protected:Npn \xtemplate_declare_template_code:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_declare_template_code:nnnnn #1#2#3#4#5 { - \xtemplate_execute_if_type_exist:nT {#1} + \__xtemplate_execute_if_type_exist:nT {#1} { - \xtemplate_execute_if_arg_agree:nnT {#1}{#3} + \__xtemplate_execute_if_arg_agree:nnT {#1}{#3} { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_store_key_implementation:nnn {#1} {#2} {#4} + \__xtemplate_store_key_implementation:nnn {#1} {#2} {#4} \cs_generate_from_arg_count:cNnn - { \c_xtemplate_code_root_tl #1 / #2 } + { \c__xtemplate_code_root_tl #1 / #2 } \cs_gset_protected:Npn {#3} {#5} } } } } -\cs_new_protected:Npn \xtemplate_store_key_implementation:nnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_store_key_implementation:nnn #1#2#3 { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_keytypes:n { #1 / #2 } - \prop_clear:N \l_xtemplate_vars_prop + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_keytypes:n { #1 / #2 } + \prop_clear:N \l__xtemplate_vars_prop \keyval_parse:NNn - \xtemplate_parse_vars_elt:n \xtemplate_parse_vars_elt:nn {#3} - \xtemplate_store_vars:n { #1 / #2 } - \clist_clear:N \l_xtemplate_restrict_clist - \xtemplate_store_restrictions:n { #1 / #2 } - \prop_map_inline:Nn \l_xtemplate_keytypes_prop + \__xtemplate_parse_vars_elt:n \__xtemplate_parse_vars_elt:nn {#3} + \__xtemplate_store_vars:n { #1 / #2 } + \clist_clear:N \l__xtemplate_restrict_clist + \__xtemplate_store_restrictions:n { #1 / #2 } + \prop_map_inline:Nn \l__xtemplate_keytypes_prop { \msg_error:nnxxx { xtemplate } { key-not-implemented } {##1} {#2} {#1} } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt:n #1 +\cs_new_protected:Npn \__xtemplate_parse_vars_elt:n #1 { \msg_error:nnx { xtemplate } { key-no-variable } {#1} } -\cs_new_protected:Npn \xtemplate_parse_vars_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_vars_elt:nn #1#2 { - \tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } + \tl_set:Nx \l__xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ } \prop_get:NoNTF - \l_xtemplate_keytypes_prop - \l_xtemplate_key_name_tl - \l_xtemplate_keytype_tl + \l__xtemplate_keytypes_prop + \l__xtemplate_key_name_tl + \l__xtemplate_keytype_tl { - \xtemplate_split_keytype_arg:o \l_xtemplate_keytype_tl - \xtemplate_parse_vars_elt_aux:n {#2} - \prop_del:NV \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_keytype_tl + \__xtemplate_parse_vars_elt_aux:n {#2} + \prop_remove:NV \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl } { \msg_error:nnx { xtemplate } { unknown-key } {#1} } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt_aux:n #1 +\cs_new_protected:Npn \__xtemplate_parse_vars_elt_aux:n #1 { - \str_if_eq:onTF \l_xtemplate_keytype_tl { choice } - { \xtemplate_implement_choices:n {#1} } + \str_if_eq:onTF \l__xtemplate_keytype_tl { choice } + { \__xtemplate_implement_choices:n {#1} } { - \str_if_eq:onTF \l_xtemplate_keytype_tl { code } + \str_if_eq:onTF \l__xtemplate_keytype_tl { code } { - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#1} + \prop_put:Non \l__xtemplate_vars_prop + \l__xtemplate_key_name_tl {#1} } { \tl_if_single:nTF {#1} { \cs_if_exist:NF #1 - { \xtemplate_create_variable:N #1 } - \prop_put:Non \l_xtemplate_vars_prop - \l_xtemplate_key_name_tl {#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 } - { \xtemplate_parse_vars_elt_aux:w #1 \q_stop } + { \__xtemplate_parse_vars_elt_aux:w #1 \q_stop } { \msg_error:nnx { xtemplate } { bad-variable } { \tl_to_str:n {#1} } @@ -542,16 +542,16 @@ } } } -\cs_new_protected:Npn \xtemplate_parse_vars_elt_aux:w #1 global #2 \q_stop +\cs_new_protected:Npn \__xtemplate_parse_vars_elt_aux:w #1 global #2 \q_stop { \tl_if_empty:nTF {#1} { \tl_if_single:nTF {#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 } + { \__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 } @@ -563,9 +563,9 @@ { \tl_to_str:n { #1 global #2 } } } } -\cs_new_protected_nopar:Npn \xtemplate_create_variable:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_create_variable:N #1 { - \prg_case_str:onn \l_xtemplate_keytype_tl + \str_case:onn \l__xtemplate_keytype_tl { { boolean } { \bool_new:N #1 } { commalist } { \clist_new:N #1 } @@ -576,196 +576,196 @@ { real } { \fp_new:N #1 } { tokenlist } { \tl_new:N #1 } } - { \use:c { \l_xtemplate_keytype_tl _ new:N } #1 } + { \use:c { \l__xtemplate_keytype_tl _ new:N } #1 } } -\cs_new_protected:Npn \xtemplate_implement_choices:n #1 +\cs_new_protected:Npn \__xtemplate_implement_choices:n #1 { - \clist_set_eq:NN \l_xtemplate_tmp_clist \l_xtemplate_keytype_arg_tl - \prop_put:Non \l_xtemplate_vars_prop \l_xtemplate_key_name_tl { } + \clist_set_eq:NN \l__xtemplate_tmp_clist \l__xtemplate_keytype_arg_tl + \prop_put:Non \l__xtemplate_vars_prop \l__xtemplate_key_name_tl { } \keyval_parse:NNn - \xtemplate_implement_choice_elt:n \xtemplate_implement_choice_elt:nn + \__xtemplate_implement_choice_elt:n \__xtemplate_implement_choice_elt:nn {#1} - \prop_get:NoNT \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - { \xtemplate_implement_choices_default: } - \clist_if_empty:NF \l_xtemplate_tmp_clist + \prop_get:NoNT \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + { \__xtemplate_implement_choices_default: } + \clist_if_empty:NF \l__xtemplate_tmp_clist { - \clist_map_inline:Nn \l_xtemplate_tmp_clist + \clist_map_inline:Nn \l__xtemplate_tmp_clist { \msg_error:nnx { xtemplate } { choice-not-implemented } {##1} } } } -\cs_new_protected_nopar:Npn \xtemplate_implement_choices_default: +\cs_new_protected_nopar:Npn \__xtemplate_implement_choices_default: { - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl } - \prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_tmp_tl + { \l__xtemplate_key_name_tl \c_space_tl \l__xtemplate_tmp_tl } + \prop_if_in:NoF \l__xtemplate_vars_prop \l__xtemplate_tmp_tl { - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_tmp_tl } - \prop_if_in:NoF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_tmp_tl + { \l__xtemplate_key_name_tl \c_space_tl \l__xtemplate_tmp_tl } + \prop_if_in:NoF \l__xtemplate_vars_prop \l__xtemplate_tmp_tl { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl - \prop_get:NoN \l_xtemplate_values_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_values_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-default-choice } - { \l_xtemplate_key_name_tl } { \l_xtemplate_key_name_tl } - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } { \l__xtemplate_key_name_tl } + { \l__xtemplate_keytype_arg_tl } } } } -\cs_new_protected:Npn \xtemplate_implement_choice_elt:n #1 +\cs_new_protected:Npn \__xtemplate_implement_choice_elt:n #1 { - \clist_if_empty:NTF \l_xtemplate_tmp_clist + \clist_if_empty:NTF \l__xtemplate_tmp_clist { \str_if_eq:nnF {#1} { unknown } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } {#1} - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } {#1} + { \l__xtemplate_keytype_arg_tl } } } { - \clist_if_in:NnTF \l_xtemplate_tmp_clist {#1} - { \clist_remove_all:Nn \l_xtemplate_tmp_clist {#1} } + \clist_if_in:NnTF \l__xtemplate_tmp_clist {#1} + { \clist_remove_all:Nn \l__xtemplate_tmp_clist {#1} } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } {#1} - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } {#1} + { \l__xtemplate_keytype_arg_tl } } } } -\cs_new_protected:Npn \xtemplate_implement_choice_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_implement_choice_elt:nn #1#2 { - \xtemplate_implement_choice_elt:n {#1} - \tl_set:Nx \l_xtemplate_tmp_tl - { \l_xtemplate_key_name_tl \c_space_tl #1 } - \prop_put:Non \l_xtemplate_vars_prop \l_xtemplate_tmp_tl {#2} + \__xtemplate_implement_choice_elt:n {#1} + \tl_set:Nx \l__xtemplate_tmp_tl + { \l__xtemplate_key_name_tl \c_space_tl #1 } + \prop_put:Non \l__xtemplate_vars_prop \l__xtemplate_tmp_tl {#2} } -\cs_new_protected:Npn \xtemplate_declare_restricted:nnnn #1#2#3#4 +\cs_new_protected:Npn \__xtemplate_declare_restricted:nnnn #1#2#3#4 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_set_template_eq:nn { #1 / #3 } { #1 / #2 } - \bool_set_true:N \l_xtemplate_restrict_bool - \xtemplate_edit_defaults_aux:nnn {#1} {#3} {#4} + \__xtemplate_set_template_eq:nn { #1 / #3 } { #1 / #2 } + \bool_set_true:N \l__xtemplate_restrict_bool + \__xtemplate_edit_defaults_aux:nnn {#1} {#3} {#4} } } -\cs_new_protected:Npn \xtemplate_edit_defaults:nnn +\cs_new_protected:Npn \__xtemplate_edit_defaults:nnn { - \bool_set_false:N \l_xtemplate_restrict_bool - \xtemplate_edit_defaults_aux:nnn + \bool_set_false:N \l__xtemplate_restrict_bool + \__xtemplate_edit_defaults_aux:nnn } -\cs_new_protected:Npn \xtemplate_edit_defaults_aux:nnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_edit_defaults_aux:nnn #1#2#3 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_restrictions:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_store_defaults:n { #1 / #2 } - \xtemplate_store_restrictions:n { #1 / #2 } + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_restrictions:n { #1 / #2 } + \__xtemplate_parse_values:nn { #1 / #2 } {#3} + \__xtemplate_store_defaults:n { #1 / #2 } + \__xtemplate_store_restrictions:n { #1 / #2 } } } -\cs_new_protected:Npn \xtemplate_parse_values:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_values:nn #1#2 { - \xtemplate_recover_keytypes:n {#1} - \clist_clear:N \l_xtemplate_restrict_clist + \__xtemplate_recover_keytypes:n {#1} + \clist_clear:N \l__xtemplate_restrict_clist \keyval_parse:NNn - \xtemplate_parse_values_elt:n \xtemplate_parse_values_elt:nn {#2} + \__xtemplate_parse_values_elt:n \__xtemplate_parse_values_elt:nn {#2} } -\cs_new_protected:Npn \xtemplate_parse_values_elt:n #1 +\cs_new_protected:Npn \__xtemplate_parse_values_elt:n #1 { - \bool_set_true:N \l_xtemplate_error_bool + \bool_set_true:N \l__xtemplate_error_bool \msg_error:nnx { xtemplate } { key-no-value } {#1} } -\cs_new_protected:Npn \xtemplate_parse_values_elt:nn #1#2 +\cs_new_protected:Npn \__xtemplate_parse_values_elt:nn #1#2 { - \tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } - \prop_get:NoNTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl + \tl_set:Nx \l__xtemplate_key_name_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ } + \prop_get:NoNTF \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl { - \bool_if:NTF \l_xtemplate_restrict_bool + \bool_if:NTF \l__xtemplate_restrict_bool { - \clist_if_in:NoF \l_xtemplate_restrict_clist - \l_xtemplate_key_name_tl - { \xtemplate_parse_values_elt_aux:n {#2} } + \clist_if_in:NoF \l__xtemplate_restrict_clist + \l__xtemplate_key_name_tl + { \__xtemplate_parse_values_elt_aux:n {#2} } } - { \xtemplate_parse_values_elt_aux:n {#2} } + { \__xtemplate_parse_values_elt_aux:n {#2} } } { \msg_error:nnx { xtemplate } { unknown-key } - { \l_xtemplate_key_name_tl } + { \l__xtemplate_key_name_tl } } } -\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:n #1 +\cs_new_protected:Npn \__xtemplate_parse_values_elt_aux:n #1 { - \clist_put_right:No \l_xtemplate_restrict_clist \l_xtemplate_key_name_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl - \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#1} + \clist_put_right:No \l__xtemplate_restrict_clist \l__xtemplate_key_name_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl + \use:c { __xtemplate_store_value_ \l__xtemplate_keytype_tl :n } {#1} } -\cs_new_protected:Npn \xtemplate_set_template_eq:nn #1#2 +\cs_new_protected:Npn \__xtemplate_set_template_eq:nn #1#2 { - \xtemplate_recover_defaults:n {#2} - \xtemplate_store_defaults:n {#1} - \xtemplate_recover_keytypes:n {#2} - \xtemplate_store_keytypes:n {#1} - \xtemplate_recover_vars:n {#2} - \xtemplate_store_vars:n {#1} - \cs_gset_eq:cc { \c_xtemplate_code_root_tl #1 } - { \c_xtemplate_code_root_tl #2 } + \__xtemplate_recover_defaults:n {#2} + \__xtemplate_store_defaults:n {#1} + \__xtemplate_recover_keytypes:n {#2} + \__xtemplate_store_keytypes:n {#1} + \__xtemplate_recover_vars:n {#2} + \__xtemplate_store_vars:n {#1} + \cs_gset_eq:cc { \c__xtemplate_code_root_tl #1 } + { \c__xtemplate_code_root_tl #2 } } -\cs_new_protected:Npn \xtemplate_declare_instance:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_declare_instance:nnnnn #1#2#3#4#5 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \__xtemplate_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_declare_instance_aux:nnnnn {#1} {#2} {#3} {#4} {#5} + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_declare_instance_aux:nnnnn {#1} {#2} {#3} {#4} {#5} } } -\cs_new_protected:Npn \xtemplate_declare_instance_aux:nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_declare_instance_aux:nnnnn #1#2#3#4#5 { - \bool_set_false:N \l_xtemplate_error_bool - \xtemplate_parse_values:nn { #1 / #2 } {#5} - \bool_if:NF \l_xtemplate_error_bool + \bool_set_false:N \l__xtemplate_error_bool + \__xtemplate_parse_values:nn { #1 / #2 } {#5} + \bool_if:NF \l__xtemplate_error_bool { - \prop_put:Nnn \l_xtemplate_values_prop { from~template } {#2} - \xtemplate_store_values:n { #1 / #3 / #4 } - \xtemplate_convert_to_assignments: - \cs_set_protected:cpx { \c_xtemplate_instances_root_tl #1 / #3 / #4 } + \prop_put:Nnn \l__xtemplate_values_prop { from~template } {#2} + \__xtemplate_store_values:n { #1 / #3 / #4 } + \__xtemplate_convert_to_assignments: + \cs_set_protected:cpx { \c__xtemplate_instances_root_tl #1 / #3 / #4 } { - \exp_not:N \xtemplate_assignments_push:n - { \exp_not:o \l_xtemplate_assignments_tl } - \exp_not:c { \c_xtemplate_code_root_tl #1 / #2 } + \exp_not:N \__xtemplate_assignments_push:n + { \exp_not:o \l__xtemplate_assignments_tl } + \exp_not:c { \c__xtemplate_code_root_tl #1 / #2 } } - \xtemplate_if_instance_exist:nnnF {#1} { } {#4} + \__xtemplate_if_instance_exist:nnnF {#1} { } {#4} { \cs_set_eq:cc - { \c_xtemplate_instances_root_tl #1 / / #4 } - { \c_xtemplate_instances_root_tl #1 / #3 / #4 } + { \c__xtemplate_instances_root_tl #1 / / #4 } + { \c__xtemplate_instances_root_tl #1 / #3 / #4 } } } } -\cs_new_protected:Npn \xtemplate_edit_instance:nnnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_edit_instance:nnnn #1#2#3 { - \xtemplate_if_instance_exist:nnnTF {#1} {#2} {#3} + \__xtemplate_if_instance_exist:nnnTF {#1} {#2} {#3} { - \xtemplate_recover_values:n { #1 / #2 / #3 } - \prop_get:NnN \l_xtemplate_values_prop { from~template } - \l_xtemplate_tmp_tl - \xtemplate_edit_instance_aux:nonnn {#1} \l_xtemplate_tmp_tl + \__xtemplate_recover_values:n { #1 / #2 / #3 } + \prop_get:NnN \l__xtemplate_values_prop { from~template } + \l__xtemplate_tmp_tl + \__xtemplate_edit_instance_aux:nonnn {#1} \l__xtemplate_tmp_tl {#2} {#3} } { @@ -773,331 +773,331 @@ {#1} {#3} } } -\cs_new_protected:Npn \xtemplate_edit_instance_aux:nnnnn #1#2 +\cs_new_protected:Npn \__xtemplate_edit_instance_aux:nnnnn #1#2 { - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_declare_instance_aux:nnnnn {#1} {#2} + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_declare_instance_aux:nnnnn {#1} {#2} } -\cs_generate_variant:Nn \xtemplate_edit_instance_aux:nnnnn { no } -\cs_new_protected_nopar:Npn \xtemplate_convert_to_assignments: +\cs_generate_variant:Nn \__xtemplate_edit_instance_aux:nnnnn { no } +\cs_new_protected_nopar:Npn \__xtemplate_convert_to_assignments: { - \tl_clear:N \l_xtemplate_assignments_tl - \seq_map_function:NN \l_xtemplate_key_order_seq - \xtemplate_convert_to_assignments_aux:n + \tl_clear:N \l__xtemplate_assignments_tl + \seq_map_function:NN \l__xtemplate_key_order_seq + \__xtemplate_convert_to_assignments_aux:n } -\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:n #1 +\cs_new_protected:Npn \__xtemplate_convert_to_assignments_aux:n #1 { - \prop_get:NnN \l_xtemplate_keytypes_prop {#1} \l_xtemplate_tmp_tl - \xtemplate_convert_to_assignments_aux:no {#1} \l_xtemplate_tmp_tl + \prop_get:NnN \l__xtemplate_keytypes_prop {#1} \l__xtemplate_tmp_tl + \__xtemplate_convert_to_assignments_aux:no {#1} \l__xtemplate_tmp_tl } -\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:nn #1#2 +\cs_new_protected:Npn \__xtemplate_convert_to_assignments_aux:nn #1#2 { - \prop_get:NnNT \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl + \prop_get:NnNT \l__xtemplate_values_prop {#1} \l__xtemplate_value_tl { - \prop_get:NnNTF \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl + \prop_get:NnNTF \l__xtemplate_vars_prop {#1} \l__xtemplate_var_tl { - \xtemplate_split_keytype_arg:n {#2} - \str_if_eq:onF \l_xtemplate_keytype_tl { choice } + \__xtemplate_split_keytype_arg:n {#2} + \str_if_eq:onF \l__xtemplate_keytype_tl { choice } { - \str_if_eq:onF \l_xtemplate_keytype_tl { code } - { \xtemplate_find_global: } + \str_if_eq:onF \l__xtemplate_keytype_tl { code } + { \__xtemplate_find_global: } } - \tl_set:Nn \l_xtemplate_key_name_tl {#1} - \use:c { xtemplate_assign_ \l_xtemplate_keytype_tl : } + \tl_set:Nn \l__xtemplate_key_name_tl {#1} + \use:c { __xtemplate_assign_ \l__xtemplate_keytype_tl : } } { \msg_error:nnx { xtemplate } { unknown-attribute } {#1} } } } -\cs_generate_variant:Nn \xtemplate_convert_to_assignments_aux:nn { no } -\cs_new_protected_nopar:Npn \xtemplate_find_global: +\cs_generate_variant:Nn \__xtemplate_convert_to_assignments_aux:nn { no } +\cs_new_protected_nopar:Npn \__xtemplate_find_global: { - \bool_set_false:N \l_xtemplate_global_bool - \tl_if_in:onT \l_xtemplate_var_tl { global } + \bool_set_false:N \l__xtemplate_global_bool + \tl_if_in:onT \l__xtemplate_var_tl { global } { - \exp_after:wN \xtemplate_find_global_aux:w \l_xtemplate_var_tl \q_stop + \exp_after:wN \__xtemplate_find_global_aux:w \l__xtemplate_var_tl \q_stop } } -\cs_new_protected:Npn \xtemplate_find_global_aux:w #1 global #2 \q_stop +\cs_new_protected:Npn \__xtemplate_find_global_aux:w #1 global #2 \q_stop { - \tl_set:Nn \l_xtemplate_var_tl {#2} - \bool_set_true:N \l_xtemplate_global_bool + \tl_set:Nn \l__xtemplate_var_tl {#2} + \bool_set_true:N \l__xtemplate_global_bool } -\cs_new_protected:Npn \xtemplate_use_template:nnn #1#2#3 +\cs_new_protected:Npn \__xtemplate_use_template:nnn #1#2#3 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \__xtemplate_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_parse_values:nn { #1 / #2 } {#3} - \xtemplate_convert_to_assignments: - \use:c { \c_xtemplate_code_root_tl #1 / #2 } + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_parse_values:nn { #1 / #2 } {#3} + \__xtemplate_convert_to_assignments: + \use:c { \c__xtemplate_code_root_tl #1 / #2 } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_boolean: +\cs_new_protected_nopar:Npn \__xtemplate_assign_boolean: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_boolean_aux:n { bool_gset } } - { \xtemplate_assign_boolean_aux:n { bool_set } } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_boolean_aux:n { bool_gset } } + { \__xtemplate_assign_boolean_aux:n { bool_set } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_boolean_aux:n #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_boolean_aux:n #1 { - \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:oT \l__xtemplate_value_tl + { \__xtemplate_key_to_value: } + \tl_put_left:Nx \l__xtemplate_assignments_tl { - \exp_not:c { #1 _ \l_xtemplate_value_tl :N } - \exp_not:o \l_xtemplate_var_tl + \exp_not:c { #1 _ \l__xtemplate_value_tl :N } + \exp_not:o \l__xtemplate_var_tl } } -\cs_new_protected_nopar:Npn \xtemplate_assign_choice: +\cs_new_protected_nopar:Npn \__xtemplate_assign_choice: { - \xtemplate_assign_choice_aux:xF - { \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_value_tl } + \__xtemplate_assign_choice_aux:xF + { \l__xtemplate_key_name_tl \c_space_tl \l__xtemplate_value_tl } { - \xtemplate_assign_choice_aux:xF - { \l_xtemplate_key_name_tl \c_space_tl unknown } + \__xtemplate_assign_choice_aux:xF + { \l__xtemplate_key_name_tl \c_space_tl unknown } { - \prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl - \l_xtemplate_tmp_tl - \xtemplate_split_keytype_arg:o \l_xtemplate_tmp_tl + \prop_get:NoN \l__xtemplate_keytypes_prop \l__xtemplate_key_name_tl + \l__xtemplate_tmp_tl + \__xtemplate_split_keytype_arg:o \l__xtemplate_tmp_tl \msg_error:nnxxx { xtemplate } { unknown-choice } - { \l_xtemplate_key_name_tl } { \l_xtemplate_value_tl } - { \l_xtemplate_keytype_arg_tl } + { \l__xtemplate_key_name_tl } { \l__xtemplate_value_tl } + { \l__xtemplate_keytype_arg_tl } } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_choice_aux:nF #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_choice_aux:nF #1 { \prop_get:NnNTF - \l_xtemplate_vars_prop + \l__xtemplate_vars_prop {#1} - \l_xtemplate_tmp_tl - { \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl } + \l__xtemplate_tmp_tl + { \tl_put_right:No \l__xtemplate_assignments_tl \l__xtemplate_tmp_tl } } -\cs_generate_variant:Nn \xtemplate_assign_choice_aux:nF { x } -\cs_new_protected_nopar:Npn \xtemplate_assign_code: +\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_left:Nx \l__xtemplate_assignments_tl { - \cs_set_protected:Npn \xtemplate_assign_code:n \exp_not:n {##1} - { \exp_not:o \l_xtemplate_var_tl } - \xtemplate_assign_code:n { \exp_not:o \l_xtemplate_value_tl } + \cs_set_protected:Npn \__xtemplate_assign_code:n \exp_not:n {##1} + { \exp_not:o \l__xtemplate_var_tl } + \__xtemplate_assign_code:n { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected:Npn \xtemplate_assign_code:n #1 { } -\cs_new_protected_nopar:Npn \xtemplate_assign_function: +\cs_new_protected:Npn \__xtemplate_assign_code:n #1 { } +\cs_new_protected_nopar:Npn \__xtemplate_assign_function: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_function_aux:N \cs_gset:Npn } - { \xtemplate_assign_function_aux:N \cs_set:Npn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_function_aux:N \cs_gset:Npn } + { \__xtemplate_assign_function_aux:N \cs_set:Npn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_function_aux:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_function_aux:N #1 { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l__xtemplate_assignments_tl { \cs_generate_from_arg_count:NNnn - \exp_not:o \l_xtemplate_var_tl + \exp_not:o \l__xtemplate_var_tl \exp_not:N #1 - { \exp_not:o \l_xtemplate_keytype_arg_tl } - { \exp_not:o \l_xtemplate_value_tl } + { \exp_not:o \l__xtemplate_keytype_arg_tl } + { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_instance: +\cs_new_protected_nopar:Npn \__xtemplate_assign_instance: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_instance_aux:N \cs_gset_protected:Npn } - { \xtemplate_assign_instance_aux:N \cs_set_protected:Npn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_instance_aux:N \cs_gset_protected:Npn } + { \__xtemplate_assign_instance_aux:N \cs_set_protected:Npn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_instance_aux:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_instance_aux:N #1 { - \tl_put_left:Nx \l_xtemplate_assignments_tl + \tl_put_left:Nx \l__xtemplate_assignments_tl { - \exp_not:N #1 \exp_not:o \l_xtemplate_var_tl + \exp_not:N #1 \exp_not:o \l__xtemplate_var_tl { - \xtemplate_use_instance:nn - { \exp_not:o \l_xtemplate_keytype_arg_tl } - { \exp_not:o \l_xtemplate_value_tl } + \__xtemplate_use_instance:nn + { \exp_not:o \l__xtemplate_keytype_arg_tl } + { \exp_not:o \l__xtemplate_value_tl } } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_integer: +\cs_new_protected_nopar:Npn \__xtemplate_assign_integer: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \int_gset:Nn } - { \xtemplate_assign_variable:N \int_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \int_gset:Nn } + { \__xtemplate_assign_variable:N \int_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_length: +\cs_new_protected_nopar:Npn \__xtemplate_assign_length: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \dim_gset:Nn } - { \xtemplate_assign_variable:N \dim_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \dim_gset:Nn } + { \__xtemplate_assign_variable:N \dim_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_muskip: +\cs_new_protected_nopar:Npn \__xtemplate_assign_muskip: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \muskip_gset:Nn } - { \xtemplate_assign_variable:N \muskip_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \muskip_gset:Nn } + { \__xtemplate_assign_variable:N \muskip_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_real: +\cs_new_protected_nopar:Npn \__xtemplate_assign_real: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \fp_gset:Nn } - { \xtemplate_assign_variable:N \fp_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \fp_gset:Nn } + { \__xtemplate_assign_variable:N \fp_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_skip: +\cs_new_protected_nopar:Npn \__xtemplate_assign_skip: { - \bool_if:NTF \l_xtemplate_global_bool - { \xtemplate_assign_variable:N \skip_gset:Nn } - { \xtemplate_assign_variable:N \skip_set:Nn } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_variable:N \skip_gset:Nn } + { \__xtemplate_assign_variable:N \skip_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist: +\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 } + \bool_if:NTF \l__xtemplate_global_bool + { \__xtemplate_assign_tokenlist_aux:N \tl_gset:Nn } + { \__xtemplate_assign_tokenlist_aux:N \tl_set:Nn } } -\cs_new_protected_nopar:Npn \xtemplate_assign_tokenlist_aux:N #1 +\cs_new_protected_nopar:Npn \__xtemplate_assign_tokenlist_aux:N #1 { - \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:oT \l__xtemplate_value_tl + { \__xtemplate_key_to_value: } + \tl_put_left:Nx \l__xtemplate_assignments_tl { - #1 \exp_not:o \l_xtemplate_var_tl - { \exp_not:o \l_xtemplate_value_tl } + #1 \exp_not:o \l__xtemplate_var_tl + { \exp_not:o \l__xtemplate_value_tl } } } -\cs_new_protected_nopar:Npn \xtemplate_assign_commalist: +\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 } + \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 +\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 + \__xtemplate_if_key_value:oT \l__xtemplate_value_tl + { \__xtemplate_key_to_value: } + \tl_put_left:Nx \l__xtemplate_assignments_tl { - #1 \exp_not:o \l_xtemplate_var_tl - { \exp_not:o \l_xtemplate_value_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 +\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 { - \tl_set:Nx \l_xtemplate_tmp_tl { \tl_to_str:n {#1} } - \tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ } + \tl_set:Nx \l__xtemplate_tmp_tl { \tl_to_str:n {#1} } + \tl_remove_all:Nn \l__xtemplate_key_name_tl { ~ } \prop_get:NoNF - \l_xtemplate_vars_prop - \l_xtemplate_tmp_tl - \l_xtemplate_value_tl + \l__xtemplate_vars_prop + \l__xtemplate_tmp_tl + \l__xtemplate_value_tl { \msg_error:nnx { xtemplate } { unknown-attribute } - { \l_xtemplate_tmp_tl } + { \l__xtemplate_tmp_tl } } } -\cs_new_protected:Npn \xtemplate_use_instance:nn #1#2 +\cs_new_protected:Npn \__xtemplate_use_instance:nn #1#2 { - \xtemplate_if_use_template:nTF {#2} - { \xtemplate_use_instance_aux:nNnnn {#1} #2 } - { \xtemplate_use_instance_aux:nn {#1} {#2} } + \__xtemplate_if_use_template:nTF {#2} + { \__xtemplate_use_instance_aux:nNnnn {#1} #2 } + { \__xtemplate_use_instance_aux:nn {#1} {#2} } } -\cs_new_protected:Npn \xtemplate_use_instance_aux:nNnnn #1#2#3#4#5 +\cs_new_protected:Npn \__xtemplate_use_instance_aux:nNnnn #1#2#3#4#5 { \str_if_eq:nnTF {#1} {#3} - { \xtemplate_use_template:nnn {#3} {#4} {#5} } + { \__xtemplate_use_template:nnn {#3} {#4} {#5} } { \msg_error:nnxx { xtemplate } { type-mismatch } {#1} {#3} } } -\cs_new_protected:Npn \xtemplate_use_instance_aux:nn #1#2 +\cs_new_protected:Npn \__xtemplate_use_instance_aux:nn #1#2 { - \xtemplate_get_collection:n {#1} - \xtemplate_if_instance_exist:nnnTF - {#1} { \l_xtemplate_collection_tl } {#2} + \__xtemplate_get_collection:n {#1} + \__xtemplate_if_instance_exist:nnnTF + {#1} { \l__xtemplate_collection_tl } {#2} { \use:c { - \c_xtemplate_instances_root_tl #1 / - \l_xtemplate_collection_tl / #2 + \c__xtemplate_instances_root_tl #1 / + \l__xtemplate_collection_tl / #2 } } { - \xtemplate_if_instance_exist:nnnTF {#1} { } {#2} - { \use:c { \c_xtemplate_instances_root_tl #1 / / #2 } } + \__xtemplate_if_instance_exist:nnnTF {#1} { } {#2} + { \use:c { \c__xtemplate_instances_root_tl #1 / / #2 } } { \msg_error:nnxx { xtemplate } { unknown-instance } {#1} {#2} } } } -\cs_new_protected:Npn \xtemplate_use_collection:nn #1#2 - { \prop_put:Nnn \l_xtemplate_collections_prop {#1} {#2} } -\cs_new_protected:Npn \xtemplate_get_collection:n #1 +\cs_new_protected:Npn \__xtemplate_use_collection:nn #1#2 + { \prop_put:Nnn \l__xtemplate_collections_prop {#1} {#2} } +\cs_new_protected:Npn \__xtemplate_get_collection:n #1 { - \prop_get:NnNF \l_xtemplate_collections_prop {#1} - \l_xtemplate_collection_tl - { \tl_clear:N \l_xtemplate_collection_tl } + \prop_get:NnNF \l__xtemplate_collections_prop {#1} + \l__xtemplate_collection_tl + { \tl_clear:N \l__xtemplate_collection_tl } } -\cs_new_nopar:Npn \xtemplate_assignments_pop: { \l_xtemplate_assignments_tl } -\cs_new_protected:Npn \xtemplate_assignments_push:n #1 - { \tl_set:Nn \l_xtemplate_assignments_tl {#1} } -\cs_new_protected_nopar:Npn \xtemplate_show_code:nn #1#2 - { \cs_show:c { \c_xtemplate_code_root_tl #1 / #2 } } -\cs_new_protected_nopar:Npn \xtemplate_show_defaults:nn #1#2 +\cs_new_nopar:Npn \__xtemplate_assignments_pop: { \l__xtemplate_assignments_tl } +\cs_new_protected:Npn \__xtemplate_assignments_push:n #1 + { \tl_set:Nn \l__xtemplate_assignments_tl {#1} } +\cs_new_protected_nopar:Npn \__xtemplate_show_code:nn #1#2 + { \cs_show:c { \c__xtemplate_code_root_tl #1 / #2 } } +\cs_new_protected_nopar:Npn \__xtemplate_show_defaults:nn #1#2 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_defaults:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_values_prop + \__xtemplate_recover_defaults:n { #1 / #2 } + \__xtemplate_show:Nnnn \l__xtemplate_values_prop {#1} {#2} { default~values } } } -\cs_new_protected_nopar:Npn \xtemplate_show_keytypes:nn #1#2 +\cs_new_protected_nopar:Npn \__xtemplate_show_keytypes:nn #1#2 { - \xtemplate_if_keys_exist:nnT {#1} {#2} + \__xtemplate_if_keys_exist:nnT {#1} {#2} { - \xtemplate_recover_keytypes:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_keytypes_prop + \__xtemplate_recover_keytypes:n { #1 / #2 } + \__xtemplate_show:Nnnn \l__xtemplate_keytypes_prop {#1} {#2} { interface } } } -\cs_new_protected_nopar:Npn \xtemplate_show_vars:nn #1#2 +\cs_new_protected_nopar:Npn \__xtemplate_show_vars:nn #1#2 { - \xtemplate_execute_if_code_exist:nnT {#1} {#2} + \__xtemplate_execute_if_code_exist:nnT {#1} {#2} { - \xtemplate_recover_vars:n { #1 / #2 } - \xtemplate_show:Nnnn \l_xtemplate_vars_prop + \__xtemplate_recover_vars:n { #1 / #2 } + \__xtemplate_show:Nnnn \l__xtemplate_vars_prop {#1} {#2} { variable~mapping } } } -\cs_new_protected_nopar:Npn \xtemplate_show:Nnnn #1#2#3#4 +\cs_new_protected_nopar:Npn \__xtemplate_show:Nnnn #1#2#3#4 { - \msg_aux_use:nnxxxx { xtemplate } + \__msg_term:nnnnn { xtemplate } { \prop_if_empty:NTF #1 { show-no-attribute } { show-attribute } } - {#2} {#3} {#4} { } - \msg_aux_show:x - { \prop_map_function:NN #1 \msg_aux_show_unbraced:nn } + {#2} {#3} {#4} + \__msg_show_variable:x + { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } -\cs_new_protected_nopar:Npn \xtemplate_show_values:nnn #1#2#3 +\cs_new_protected_nopar:Npn \__xtemplate_show_values:nnn #1#2#3 { - \xtemplate_if_instance_exist:nnnT {#1} {#2} {#3} + \__xtemplate_if_instance_exist:nnnT {#1} {#2} {#3} { - \xtemplate_recover_values:n { #1 / #2 / #3 } - \prop_if_empty:NTF \l_xtemplate_values_prop + \__xtemplate_recover_values:n { #1 / #2 / #3 } + \prop_if_empty:NTF \l__xtemplate_values_prop { - \msg_aux_use:nnxxxx { xtemplate } { show-no-values } - {#1} {#2} {#3} { } - \msg_aux_show:x { } + \__msg_term:nnnnn { xtemplate } { show-no-values } + {#1} {#2} {#3} + \__msg_show_variable:x { } } { - \prop_pop:NnN \l_xtemplate_values_prop { from~template } - \l_xtemplate_tmp_tl - \msg_aux_use:nnxxxx { xtemplate } { show-values } - {#1} {#2} {#3} { \l_xtemplate_tmp_tl } - \msg_aux_show:x + \prop_pop:NnN \l__xtemplate_values_prop { from~template } + \l__xtemplate_tmp_tl + \__msg_term:nnnnnV { xtemplate } { show-values } + {#1} {#2} {#3} \l__xtemplate_tmp_tl + \__msg_show_variable:x { - \prop_map_function:NN \l_xtemplate_values_prop - \msg_aux_show_unbraced:nn + \prop_map_function:NN \l__xtemplate_values_prop + \__msg_show_item_unbraced:nn } } } @@ -1299,55 +1299,55 @@ The~ \tl_if_empty:nF {#2} {collection~} instance~'#3'~ \tl_if_empty:nF {#2} { (from~collection~'#2')~ } of~object~type~'#1'~ - \quark_if_no_value:NF #4 { (from~template~'#4')~ } + \str_if_eq:nnF { \q_no_value } {#4} { (from~template~'#4')~ } has~values: } \cs_new_protected_nopar:Npn \DeclareObjectType #1#2 - { \xtemplate_declare_object_type:nn {#1} {#2} } + { \__xtemplate_declare_object_type:nn {#1} {#2} } \cs_new_protected:Npn \DeclareTemplateInterface #1#2#3#4 - { \xtemplate_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } + { \__xtemplate_declare_template_keys:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \DeclareTemplateCode #1#2#3#4#5 - { \xtemplate_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } + { \__xtemplate_declare_template_code:nnnnn {#1} {#2} {#3} {#4} {#5} } \cs_new_protected:Npn \DeclareRestrictedTemplate #1#2#3#4 - { \xtemplate_declare_restricted:nnnn {#1} {#2} {#3} {#4} } + { \__xtemplate_declare_restricted:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \DeclareInstance #1#2#3#4 - { \xtemplate_declare_instance:nnnnn {#1} {#3} { } {#2} {#4} } + { \__xtemplate_declare_instance:nnnnn {#1} {#3} { } {#2} {#4} } \cs_new_protected:Npn \DeclareCollectionInstance #1#2#3#4#5 - { \xtemplate_declare_instance:nnnnn {#2} {#4} {#1} {#3} {#5} } + { \__xtemplate_declare_instance:nnnnn {#2} {#4} {#1} {#3} {#5} } \cs_new_protected:Npn \EditTemplateDefaults #1#2#3 - { \xtemplate_edit_defaults:nnn {#1} {#2} {#3} } + { \__xtemplate_edit_defaults:nnn {#1} {#2} {#3} } \cs_new_protected:Npn \EditInstance #1#2#3 - { \xtemplate_edit_instance:nnnn {#1} { } {#2} {#3} } + { \__xtemplate_edit_instance:nnnn {#1} { } {#2} {#3} } \cs_new_protected:Npn \EditCollectionInstance #1#2#3#4 - { \xtemplate_edit_instance:nnnn {#2} {#1} {#3} {#4} } + { \__xtemplate_edit_instance:nnnn {#2} {#1} {#3} {#4} } \cs_new_protected_nopar:Npn \UseTemplate #1#2#3 - { \xtemplate_use_template:nnn {#1} {#2} {#3} } + { \__xtemplate_use_template:nnn {#1} {#2} {#3} } \cs_new_protected_nopar:Npn \UseInstance #1#2 - { \xtemplate_use_instance:nn {#1} {#2} } + { \__xtemplate_use_instance:nn {#1} {#2} } \cs_new_protected_nopar:Npn \UseCollection #1#2 - { \xtemplate_use_collection:nn {#1} {#2} } + { \__xtemplate_use_collection:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateCode #1#2 - { \xtemplate_show_code:nn {#1} {#2} } + { \__xtemplate_show_code:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateDefaults #1#2 - { \xtemplate_show_defaults:nn {#1} {#2} } + { \__xtemplate_show_defaults:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateInterface #1#2 - { \xtemplate_show_keytypes:nn {#1} {#2} } + { \__xtemplate_show_keytypes:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowTemplateVariables #1#2 - { \xtemplate_show_vars:nn {#1} {#2} } + { \__xtemplate_show_vars:nn {#1} {#2} } \cs_new_protected_nopar:Npn \ShowInstanceValues #1#2 - { \xtemplate_show_values:nnn {#1} { } {#2} } + { \__xtemplate_show_values:nnn {#1} { } {#2} } \cs_new_protected_nopar:Npn \ShowCollectionInstanceValues #1#2#3 - { \xtemplate_show_values:nnn {#1} {#2} {#3} } + { \__xtemplate_show_values:nnn {#1} {#2} {#3} } \cs_new_nopar:Npn \IfInstanceExistTF #1#2 - { \xtemplate_if_instance_exist:nnnTF {#1} { } {#2} } + { \__xtemplate_if_instance_exist:nnnTF {#1} { } {#2} } \cs_new_nopar:Npn \IfInstanceExistT #1#2 - { \xtemplate_if_instance_exist:nnnT {#1} { } {#2} } + { \__xtemplate_if_instance_exist:nnnT {#1} { } {#2} } \cs_new_nopar:Npn \IfInstanceExistF #1#2 - { \xtemplate_if_instance_exist:nnnF {#1} { } {#2} } + { \__xtemplate_if_instance_exist:nnnF {#1} { } {#2} } \cs_new_protected:Npn \EvaluateNow #1 {#1} \cs_new_protected:Npn \KeyValue #1 {#1} \cs_new_protected_nopar:Npn \AssignTemplateKeys - { \xtemplate_assignments_pop: } + { \__xtemplate_assignments_pop: } \cs_new_eq:NN \ShowTemplateKeytypes \ShowTemplateInterface %% %% |