summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-18 23:13:18 +0000
committerKarl Berry <karl@freefriends.org>2011-08-18 23:13:18 +0000
commit6cff5abeab9bf94a6cabb2cbdba9d458c9727b73 (patch)
tree63ae3a16468aeb265f4b95d5eacb1deec963ee64 /Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
parenteae5d19d439ded67f5535d315a8983939733b548 (diff)
l3packages 2607 (17aug11)
git-svn-id: svn://tug.org/texlive/trunk@23597 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty89
1 files changed, 39 insertions, 50 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
index cae62519790..4c6b140fd4a 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 2535 2011-08-10 18:26:57Z joseph $
+\GetIdInfo$Id: xtemplate.dtx 2607 2011-08-17 16:43:25Z joseph $
{L3 Experimental prototype document functions}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\@ifpackagelater { expl3 } { 2011/08/13 }
+\@ifpackagelater { expl3 } { 2011/08/17 }
{ }
{
\PackageError { xtemplate } { Support~package~l3kernel~too~old. }
@@ -102,6 +102,9 @@
\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
{
\prop_get:NnN \g_xtemplate_object_type_prop {#1} \l_xtemplate_tmp_tl
@@ -487,13 +490,10 @@
\xtemplate_store_vars:n { #1 / #2 }
\clist_clear:N \l_xtemplate_restrict_clist
\xtemplate_store_restrictions:n { #1 / #2 }
- \prop_if_empty:NF \l_xtemplate_keytypes_prop
+ \prop_map_inline:Nn \l_xtemplate_keytypes_prop
{
- \prop_map_inline:Nn \l_xtemplate_keytypes_prop
- {
- \msg_error:nnxxx { xtemplate } { key-not-implemented }
- {##1} {#2} {#1}
- }
+ \msg_error:nnxxx { xtemplate } { key-not-implemented }
+ {##1} {#2} {#1}
}
}
\cs_new_protected:Npn \xtemplate_parse_vars_elt:n #1
@@ -502,10 +502,11 @@
{
\tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
+ \prop_get:NoNTF
+ \l_xtemplate_keytypes_prop
+ \l_xtemplate_key_name_tl
+ \l_xtemplate_keytype_tl
{
- \prop_get:NoN \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
@@ -580,7 +581,8 @@
\keyval_parse:NNn
\xtemplate_implement_choice_elt:n \xtemplate_implement_choice_elt:nn
{#1}
- \prop_if_in:NoT \l_xtemplate_values_prop \l_xtemplate_key_name_tl
+ \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
{
@@ -593,8 +595,6 @@
}
\cs_new_protected_nopar:Npn \xtemplate_implement_choices_default:
{
- \prop_get:NoN \l_xtemplate_values_prop \l_xtemplate_key_name_tl
- \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
@@ -630,7 +630,7 @@
}
{
\clist_if_in:NnTF \l_xtemplate_tmp_clist {#1}
- { \clist_remove_element:Nn \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
@@ -689,32 +689,28 @@
{
\tl_set:Nx \l_xtemplate_key_name_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_keytypes_prop \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
{
\clist_if_in:NoF \l_xtemplate_restrict_clist
\l_xtemplate_key_name_tl
- {
- \xtemplate_parse_values_elt_aux:on
- \l_xtemplate_key_name_tl {#2}
- }
+ { \xtemplate_parse_values_elt_aux:n {#2} }
}
- { \xtemplate_parse_values_elt_aux:on \l_xtemplate_key_name_tl {#2} }
+ { \xtemplate_parse_values_elt_aux:n {#2} }
}
{
\msg_error:nnx { xtemplate } { unknown-key }
{ \l_xtemplate_key_name_tl }
}
}
-\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:nn #1#2
+\cs_new_protected:Npn \xtemplate_parse_values_elt_aux:n #1
{
- \clist_put_right:Nn \l_xtemplate_restrict_clist {#1}
- \prop_get:NnN \l_xtemplate_keytypes_prop {#1} \l_xtemplate_tmp_tl
+ \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 } {#2}
+ \use:c { xtemplate_store_value_ \l_xtemplate_keytype_tl :n } {#1}
}
-\cs_generate_variant:Nn \xtemplate_parse_values_elt_aux:nn { o }
\cs_new_protected:Npn \xtemplate_set_template_eq:nn #1#2
{
\xtemplate_recover_defaults:n {#2}
@@ -792,12 +788,10 @@
}
\cs_new_protected:Npn \xtemplate_convert_to_assignments_aux:nn #1#2
{
- \prop_if_in:NnT \l_xtemplate_values_prop {#1}
+ \prop_get:NnNT \l_xtemplate_values_prop {#1} \l_xtemplate_value_tl
{
- \prop_if_in:NnTF \l_xtemplate_vars_prop {#1}
+ \prop_get:NnNTF \l_xtemplate_vars_prop {#1} \l_xtemplate_var_tl
{
- \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}
\str_if_eq:onF \l_xtemplate_keytype_tl { choice }
{
@@ -853,15 +847,11 @@
}
\cs_new_protected_nopar:Npn \xtemplate_assign_choice:
{
- \tl_set:Nx \l_xtemplate_tmp_tl
+ \xtemplate_assign_choice_aux:xF
{ \l_xtemplate_key_name_tl \c_space_tl \l_xtemplate_value_tl }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- { \xtemplate_assign_choice_aux:o \l_xtemplate_tmp_tl }
{
- \tl_set:Nx \l_xtemplate_tmp_tl
+ \xtemplate_assign_choice_aux:xF
{ \l_xtemplate_key_name_tl \c_space_tl unknown }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- { \xtemplate_assign_choice_aux:o \l_xtemplate_tmp_tl }
{
\prop_get:NoN \l_xtemplate_keytypes_prop \l_xtemplate_key_name_tl
\l_xtemplate_tmp_tl
@@ -872,12 +862,15 @@
}
}
}
-\cs_new_protected:Npn \xtemplate_assign_choice_aux:n #1
+\cs_new_protected_nopar:Npn \xtemplate_assign_choice_aux:nF #1
{
- \prop_get:NnN \l_xtemplate_vars_prop {#1} \l_xtemplate_tmp_tl
- \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl
+ \prop_get:NnNTF
+ \l_xtemplate_vars_prop
+ {#1}
+ \l_xtemplate_tmp_tl
+ { \tl_put_right:No \l_xtemplate_assignments_tl \l_xtemplate_tmp_tl }
}
-\cs_generate_variant:Nn \xtemplate_assign_choice_aux:n { o }
+\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
@@ -986,11 +979,10 @@
{
\tl_set:Nx \l_xtemplate_tmp_tl { \tl_to_str:n {#1} }
\tl_remove_all:Nn \l_xtemplate_key_name_tl { ~ }
- \prop_if_in:NoTF \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- {
- \prop_get:NoN \l_xtemplate_vars_prop \l_xtemplate_tmp_tl
- \l_xtemplate_value_tl
- }
+ \prop_get:NoNF
+ \l_xtemplate_vars_prop
+ \l_xtemplate_tmp_tl
+ \l_xtemplate_value_tl
{
\msg_error:nnx { xtemplate } { unknown-attribute }
{ \l_xtemplate_tmp_tl }
@@ -1033,11 +1025,8 @@
{ \prop_put:Nnn \l_xtemplate_collections_prop {#1} {#2} }
\cs_new_protected:Npn \xtemplate_get_collection:n #1
{
- \prop_if_in:NnTF \l_xtemplate_collections_prop {#1}
- {
- \prop_get:NnN \l_xtemplate_collections_prop {#1}
- \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 }