summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/code/xsim.templates.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/xsim/code/xsim.templates.code.tex')
-rw-r--r--macros/latex/contrib/xsim/code/xsim.templates.code.tex20
1 files changed, 15 insertions, 5 deletions
diff --git a/macros/latex/contrib/xsim/code/xsim.templates.code.tex b/macros/latex/contrib/xsim/code/xsim.templates.code.tex
index 7644074be7..35bd173bba 100644
--- a/macros/latex/contrib/xsim/code/xsim.templates.code.tex
+++ b/macros/latex/contrib/xsim/code/xsim.templates.code.tex
@@ -36,11 +36,21 @@
I~ am~ using~ the~ template~ `#3'~ (template~ type~ `#1')~ instead.
}
+\msg_new:nnn {xsim} {template-type-exists}
+ { The~ template~ type~ `#1'~ already~ exists~ \msg_line_context: }
+
+% ----------------------------------------------------------------------------
+\seq_new:N \l__xsim_template_types_seq
+
% #1: template type
\cs_new_protected:Npn \xsim_new_template_type:n #1
{
- \xsim_verbose:n { Declaring~ new~ template~ type~ `#1'. }
- \prop_new:c {l__xsim_#1_template_prop}
+ \seq_if_in:NnTF \l__xsim_template_types_seq {#1}
+ { \msg_error:nnn {xsim} {template-type-exists} {#1} }
+ {
+ \xsim_verbose:n { Declaring~ new~ template~ type~ `#1'. }
+ \seq_put_right:Nn \l__xsim_template_types_seq {#1}
+ }
}
% #1: template type
@@ -50,12 +60,12 @@
{
\xsim_verbose:n { Defining~ new~ template~ `#2'~ of~ type~ `#1'. }
\tl_new:c {l__xsim_template_#1_#2_setup_tl}
- \prop_put:cnn {l__xsim_#1_template_prop} {#2} {#3}
+ \xsim_attribute_set:nnn {template::#1} {#2} {#3}
}
\prg_new_conditional:Npnn \xsim_if_template_exist:nn #1#2 {T,F,TF}
{
- \prop_if_in:cnTF {l__xsim_#1_template_prop} {#2}
+ \xsim_attribute_if_set:nnTF {template::#1} {#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -63,7 +73,7 @@
% #1: template type
% #2: template name
\cs_new_protected:Npn \__xsim_get_template:nn #1#2
- { \prop_item:cn {l__xsim_#1_template_prop} {#2} }
+ { \xsim_attribute_get:nn {template::#1} {#2} }
% ----------------------------------------------------------------------------