diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty | 110 |
1 files changed, 61 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index 5da4faae5da..cd69d098f64 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -6,7 +6,7 @@ %% %% xtemplate.dtx (with options: `package') %% -%% Copyright (C) 2011-2016 The LaTeX3 Project +%% Copyright (C) 2011-2017 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of %% the LaTeX Project Public License (LPPL), either version 1.3c of @@ -22,9 +22,9 @@ %% David Carlisle %% (C) Copyright 2004-2010 Frank Mittelbach, %% The LaTeX3 Project -%% (C) Copyright 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/11/14] -\@ifpackagelater{expl3}{2017/11/14} +%% (C) Copyright 2011-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/12/05] +\@ifpackagelater{expl3}{2017/12/05} {} {% \PackageError{xtemplate}{Support package l3kernel too old} @@ -36,7 +36,7 @@ }% \endinput } -\ProvidesExplPackage{xtemplate}{2017/11/14}{} +\ProvidesExplPackage{xtemplate}{2017/12/05}{} {L3 Experimental prototype document functions} \tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } \tl_const:Nn \c__xtemplate_defaults_root_tl { template~defaults~>~ } @@ -46,10 +46,8 @@ \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 } +\seq_const_from_clist:Nn \c__xtemplate_keytypes_arg_seq + { choice , function , instance } \prop_new:N \g__xtemplate_object_type_prop \tl_new:N \l__xtemplate_assignments_tl \tl_new:N \l__xtemplate_collection_tl @@ -181,30 +179,59 @@ } \cs_new_protected:Npn \__xtemplate_recover_defaults:n #1 { - \prop_set_eq:Nc \l__xtemplate_values_prop + \prop_if_exist:cTF { \c__xtemplate_defaults_root_tl #1 } + { + \prop_set_eq:Nc \l__xtemplate_values_prop + { \c__xtemplate_defaults_root_tl #1 } + } + { \prop_clear:N \l__xtemplate_values_prop } } \cs_new_protected:Npn \__xtemplate_recover_keytypes:n #1 { - \prop_set_eq:Nc \l__xtemplate_keytypes_prop + \prop_if_exist:cTF { \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 } + } + { \prop_clear:N \l__xtemplate_keytypes_prop } + \seq_if_exist:cTF { \c__xtemplate_key_order_root_tl #1 } + { + \seq_set_eq:Nc \l__xtemplate_key_order_seq + { \c__xtemplate_key_order_root_tl #1 } + } + { \seq_clear:N \l__xtemplate_key_order_seq } } \cs_new_protected:Npn \__xtemplate_recover_restrictions:n #1 { - \clist_set_eq:Nc \l__xtemplate_restrict_clist + \clist_if_exist:cTF { \c__xtemplate_restrict_root_tl #1 } + { + \clist_set_eq:Nc \l__xtemplate_restrict_clist + { \c__xtemplate_restrict_root_tl #1 } + } + { \clist_clear:N \l__xtemplate_restrict_clist } } \cs_new_protected:Npn \__xtemplate_recover_values:n #1 { - \prop_set_eq:Nc \l__xtemplate_values_prop + \prop_if_exist:cTF { \c__xtemplate_values_root_tl #1 } + { + \prop_set_eq:Nc \l__xtemplate_values_prop + { \c__xtemplate_values_root_tl #1 } + } + { \prop_clear:N \l__xtemplate_values_prop } } \cs_new_protected:Npn \__xtemplate_recover_vars:n #1 { - \prop_set_eq:Nc \l__xtemplate_vars_prop + \prop_if_exist:cTF { \c__xtemplate_vars_root_tl #1 } + { + \prop_set_eq:Nc \l__xtemplate_vars_prop + { \c__xtemplate_vars_root_tl #1 } + } + { \prop_clear:N \l__xtemplate_vars_prop } } \cs_new_protected:Npn \__xtemplate_declare_object_type:nn #1#2 { @@ -1075,34 +1102,24 @@ } \cs_new_protected:Npn \__xtemplate_show:Nnnn #1#2#3#4 { - \__msg_show_pre:nnnnnn { xtemplate } - { \prop_if_empty:NTF #1 { show-no-attribute } { show-attribute } } - {#2} {#3} {#4} { } - \__msg_show_wrap:n - { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } + \msg_show:nnxxxx { xtemplate } { show-attribute } + { \tl_to_str:n {#2} } + { \tl_to_str:n {#3} } + { \tl_to_str:n {#4} } + { \prop_map_function:NN #1 \msg_show_item_unbraced:nn } } \cs_new_protected:Npn \__xtemplate_show_values:nnn #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 - { - \__msg_show_pre:nnnnnn { xtemplate } { show-no-values } - {#1} {#2} {#3} { } - \__msg_show_wrap:n { } - } + \msg_show:nnxxxx { xtemplate } { show-values } + { \tl_to_str:n {#1} } + { \tl_to_str:n {#2} } + { \tl_to_str:n {#3} } { - \prop_pop:NnNF \l__xtemplate_values_prop { from~template } - \l__xtemplate_tmp_tl - { \tl_clear:N \l__xtemplate_tmp_tl } - \__msg_show_pre:nnnnnV { xtemplate } { show-values } - {#1} {#2} {#3} \l__xtemplate_tmp_tl - \__msg_show_wrap:n - { - \prop_map_function:NN \l__xtemplate_values_prop - \__msg_show_item_unbraced:nn - } + \prop_map_function:NN \l__xtemplate_values_prop + \msg_show_item_unbraced:nn } } } @@ -1288,23 +1305,18 @@ Declaring~interface~for~template~'#2'~of~object~type~'#1'~ \msg_line_context:. } -\msg_new:nnn { xtemplate } { show-no-attribute } - { The~template~'#2'~of~object~type~'#1'~has~no~#3 . } \msg_new:nnn { xtemplate } { show-attribute } - { The~template~'#2'~of~object~type~'#1'~has~#3 : } -\msg_new:nnn { xtemplate } { show-no-values } { - The~ \tl_if_empty:nF {#2} {collection~} instance~'#3'~ - \tl_if_empty:nF {#2} { (from~collection~'#2')~ } - of~object~type~'#1'~has~no~values. + The~template~'#2'~of~object~type~'#1'~has~ + \tl_if_empty:nTF {#4} { no~#3. } { #3 : #4 } } \msg_new:nnn { xtemplate } { show-values } { - The~ \tl_if_empty:nF {#2} {collection~} instance~'#3'~ - \tl_if_empty:nF {#2} { (from~collection~'#2')~ } - of~object~type~'#1'~ - \tl_if_empty:nF {#4} { (from~template~'#4')~ } - has~values: + \tl_if_empty:nTF {#2} + { The~instance~'#3'~ } + { The~collection~ instance~'#3'~ (from~collection~'#2')~ } + of~object~type~'#1'~has~ + \tl_if_empty:nTF {#4} { no~values. } { values: #4 } } \cs_new_protected:Npn \DeclareObjectType #1#2 { \__xtemplate_declare_object_type:nn {#1} {#2} } |