diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex index add24310181..825b8f25176 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex @@ -54,6 +54,7 @@ \seq_new:N \l__xsim_boolean_properties_seq \seq_new:N \l__xsim_unique_properties_seq \seq_new:N \l__xsim_noupdate_properties_seq +\seq_new:N \l__xsim_given_properties_seq \prop_new:N \g__xsim_properties_prop % new property: @@ -131,6 +132,15 @@ { \prg_return_false: } } +% true if property #1 has been set in the /last/ call of +% \xsim_set_properties:nnn +\prg_new_conditional:Npnn \xsim_if_property_given:n #1 {p,T,F,TF} + { + \seq_if_in:NnTF \l__xsim_given_properties_seq {#1} + { \prg_return_true: } + { \prg_return_false: } + } + % #1: property % #2: value \prg_new_conditional:Npnn \xsim_if_property_unique_value:nn #1#2 {p,T,F,TF} @@ -178,8 +188,12 @@ } { \msg_error:nnn {xsim} {unknown-property} {#3} } } -\cs_generate_variant:Nn \xsim_set_property:nnnn {nnxx,nnnV,nV,nVnx,nnnx,xx,xxnx} +\cs_generate_variant:Nn \xsim_set_property:nnnn {nnxx,nnnV,nV,nVnx,nnnx,xx,xxnx,nxnx} +% #1: type +% #2: id +% #3: property +% #4: value \cs_new_protected:Npn \__xsim_set_boolean_property:nnnn #1#2#3#4 { \str_case_e:nnTF { \str_lowercase:n {#4} } @@ -191,6 +205,10 @@ { \__xsim_set_property:nnnn {#1} {#2} {#3} {false} } } +% #1: type +% #2: id +% #3: property +% #4: value \cs_new_protected:Npn \__xsim_set_unique_property:nnnn #1#2#3#4 { \__xsim_set_property:nnnn {#1} {#2} {#3} {#4} @@ -309,6 +327,7 @@ % #3: csv list of properties \cs_new_protected:Npn \xsim_set_properties:nnn #1#2#3 { + \seq_clear:N \l__xsim_given_properties_seq \clist_map_inline:nn {#3} { \seq_set_split:Nnx \l__xsim_tmpa_seq {=} { \tl_trim_spaces:n {##1} } @@ -317,6 +336,8 @@ {#2} { \seq_item:Nn \l__xsim_tmpa_seq {1} } { \seq_item:Nn \l__xsim_tmpa_seq {2} } + \seq_put_right:Nx \l__xsim_given_properties_seq + { \seq_item:Nn \l__xsim_tmpa_seq {1} } } \xsim_property_set_aliases:nn {#1} {#2} } @@ -326,16 +347,15 @@ % #1: type % #2: id % #3: property -\prg_new_protected_conditional:Npnn \xsim_if_property_set:nnn #1#2#3 {T,F,TF} +\prg_new_conditional:Npnn \xsim_if_property_set:nnn #1#2#3 {T,F,TF} { - \prop_if_in:NxTF \g__xsim_properties_prop - { #2 ! #1 ! #3 } + \prop_if_in:NnTF \g__xsim_properties_prop {#2!#1!#3} { \prg_return_true: } { \prg_return_false: } } -\cs_generate_variant:Nn \xsim_if_property_set:nnnTF {nnx,xx,nV} -\cs_generate_variant:Nn \xsim_if_property_set:nnnF {nx,nnx,xx} -\cs_generate_variant:Nn \xsim_if_property_set:nnnT {nnx,xx} +\prg_generate_conditional_variant:Nnn \xsim_if_property_set:nnn + {nx,nnx,xx,nV} + {T,F,TF} % ---------------------------------------------------------------------------- @@ -414,7 +434,7 @@ % #3: property \cs_new:Npn \xsim_get_property:nnn #1#2#3 { \prop_item:Nn \g__xsim_properties_prop { #2 ! #1 ! #3 } } -\cs_generate_variant:Nn \xsim_get_property:nnn {nx,xx,oo,no,nnf,nf,oof,nV} +\cs_generate_variant:Nn \xsim_get_property:nnn {nx,ne,xx,oo,no,nnf,nf,oof,nV} % #1: property % #2: value @@ -482,7 +502,7 @@ \cs_generate_variant:Nn \xsim_if_boolean_property:nnnF {nV} \cs_new_protected:Npn \xsim_save_property:nnnN #1#2#3#4 - { \prop_get:NnN \g__xsim_properties_prop { #2 ! #1 ! #3 } #4 } + { \prop_get:NnN \g__xsim_properties_prop {#2!#1!#3} #4 } \cs_generate_variant:Nn \xsim_save_property:nnnN {nx,xx} \cs_new_protected:Npn \xsim_gsave_property:nnnN #1#2#3#4 @@ -490,7 +510,7 @@ \xsim_save_property:nnnN {#1} {#2} {#3} #4 \tl_gset:NV #4 #4 } -\cs_generate_variant:Nn \xsim_gsave_property:nnnN {nx,xx} +\cs_generate_variant:Nn \xsim_gsave_property:nnnN {nx,xx,nV} % ---------------------------------------------------------------------------- \file_input_stop: |