diff options
Diffstat (limited to 'macros/latex/contrib/stex/source/stex/stex-features.dtx')
-rw-r--r-- | macros/latex/contrib/stex/source/stex/stex-features.dtx | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/macros/latex/contrib/stex/source/stex/stex-features.dtx b/macros/latex/contrib/stex/source/stex/stex-features.dtx index 3a5c8064b7..d770b76e42 100644 --- a/macros/latex/contrib/stex/source/stex/stex-features.dtx +++ b/macros/latex/contrib/stex/source/stex/stex-features.dtx @@ -10,7 +10,7 @@ % TODO update copyright % %<*driver> -\def\bibfolder#1{../../lib/bib/#1} +\def\libfolder#1{../../lib/#1} \input{../../doc/stex-docheader} \begin{document} @@ -385,6 +385,9 @@ { \l_stex_import_ns_str } { \l_stex_import_archive_str } { \l_stex_import_path_str } { \l_stex_import_name_str } } + \exp_args:Nx \stex_add_import_to_current_module:n{ + \l_stex_import_ns_str ? \l_stex_import_name_str + } \seq_map_inline:Nn \l_@@_copymodule_modules_seq { \seq_map_inline:cn {c_stex_module_##1_constants}{ @@ -594,8 +597,12 @@ \str_clear:N \l_@@_name_str \keys_set:nn { stex / features / structure } { #1 } } - \NewDocumentEnvironment{mathstructure}{m O{}}{ + \begin{mathstructure_inner}{#1}[#2] + \stex_smsmode_do: + \ignorespacesandpars + }{\end{mathstructure_inner}} +\NewDocumentEnvironment{mathstructure_inner}{m O{}}{ \_@@_structure_args:n { #2 } \str_if_empty:NT \l_@@_name_str { \str_set:Nx \l_@@_name_str { #1 } @@ -617,7 +624,6 @@ \exp_args:Nnnx \begin{structural_feature_module}{ structure } { \l_@@_name_str }{} - \stex_smsmode_do: }{ \end{structural_feature_module} \_stex_reset_up_to_module:n \l_stex_last_feature_str @@ -696,7 +702,8 @@ \seq_map_inline:Nn \l_stex_all_modules_seq { \prop_if_exist:cT {c_stex_module_##1_structures} { \prop_map_inline:cn {c_stex_module_##1_structures} { - \str_if_eq:eeT { \l_tmpa_str }{ \str_range:nnn {##1?####1}{-\l_tmpa_int}{-1}}{ + \exp_args:No \str_if_eq:nnT \l_tmpa_str {####1}{ + %\str_if_eq:eeT { \l_tmpa_str }{ \str_range:nnn {##1?####1}{-\l_tmpa_int}{-1}}{ \prop_map_break:n{\seq_map_break:n{ \tl_set:Nn \l_tmpa_tl { \str_set:Nn \l_stex_get_structure_str {##1?####1} @@ -716,6 +723,12 @@ % \begin{macro}{\instantiate} % \begin{macrocode} +\NewDocumentEnvironment{usestructure}{m}{ + \stex_get_structure:n {#1} + \exp_args:Nnx \stex_debug:nn{features}{using~structure:~\l_stex_get_structure_module_str} + \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str +}{} + \keys_define:nn { stex / instantiate } { name .str_set_x:N = \l_@@_name_str } @@ -724,6 +737,37 @@ \keys_set:nn { stex / instantiate } { #1 } } +\NewDocumentEnvironment{extstructure}{m m O{}}{ + \begin{mathstructure_inner}{#1}[#3] + \seq_set_split:Nnn\_@@_extstructure_imports_seq,{#2} + \seq_map_inline:Nn\_@@_extstructure_imports_seq { + \stex_get_structure:n {##1} + \exp_args:Nnx \stex_debug:nn{features}{importing~structure:~\l_stex_get_structure_module_str{}~into~\l_stex_current_module_str} + \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str + \stex_if_smsmode:F { + \stex_annotate_invisible:nnn + {import} {\l_stex_get_structure_module_str} {} + } + \exp_args:Nx \stex_add_import_to_current_module:n { + \l_stex_get_structure_module_str + } + \exp_args:Nx \stex_add_to_current_module:n { + \exp_args:No \stex_activate_module:n \l_stex_get_structure_module_str + } + } + \stex_smsmode_do: + \ignorespacesandpars +}{ + \end{mathstructure_inner} +} + +\NewDocumentEnvironment{extstructure*}{m m O{}}{ + % TODO + \begin{extstructure}{#1}{#2}[#3] +}{ + \end{extstructure} +} + \NewDocumentCommand \instantiate {m O{} m m O{}}{ \begingroup \stex_get_structure:n {#3} @@ -775,7 +819,8 @@ name = \l_tmpa_str , args = \prop_item:cn {l_stex_symdecl_##1_prop}{args} , arity = \prop_item:cn {l_stex_symdecl_##1_prop}{arity} , - assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs} + assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs} , + argnames = {\prop_item:cn {l_stex_symdecl_##1_prop}{argnames}} } \seq_clear:c {l_stex_symdecl_\l_stex_current_module_str?\l_tmpa_str _notations} } @@ -872,7 +917,7 @@ } \cs_new_protected:Nn \_@@_symbolorvar_from_string:n { - \prop_if_exist:cTF {l_stex_variable_#1 _prop}{ + \prop_if_exist:cTF {l_stex_symdecl_var://#1 _prop}{ \bool_set_true:N \l_stex_symbol_or_var_bool \str_set:Nn \l_stex_get_symbol_uri_str { #1 } }{ @@ -935,12 +980,12 @@ \bool_if:NTF \l_stex_symbol_or_var_bool { \exp_args:Nxx \str_if_eq:nnF {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}} - {\prop_item:cn{l_stex_variable_\l_stex_get_symbol_uri_str _prop}{args}}{ + {\prop_item:cn{l_stex_symdecl_var://\l_stex_get_symbol_uri_str _prop}{args}}{ \msg_error:nnxxxx{stex}{error/incompatible} {\l_@@_dom_str} {\prop_item:cn{l_stex_symdecl_\l_@@_dom_str _prop}{args}} {\l_stex_get_symbol_uri_str} - {\prop_item:cn{l_stex_variable_\l_stex_get_symbol_uri_str _prop}{args}} + {\prop_item:cn{l_stex_symdecl_var://\l_stex_get_symbol_uri_str _prop}{args}} } \prop_put:Nxx \l_tmpa_prop {\seq_item:Nn \l_tmpb_seq 1} {\stex_invoke_variable:n {\l_stex_get_symbol_uri_str}} }{ @@ -974,11 +1019,12 @@ } \exp_args:NNx \tl_gput_right:Nn \g_@@_aftergroup_tl { - \prop_set_from_keyval:cn { l_stex_variable_ \l_tmpa_str _prop}{ + \prop_set_from_keyval:cn { l_stex_symdecl_ var://\l_tmpa_str _prop}{ name = \l_tmpa_str , args = \prop_item:cn {l_stex_symdecl_##1_prop}{args} , arity = \prop_item:cn {l_stex_symdecl_##1_prop}{arity} , - assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs} + assocs = \prop_item:cn {l_stex_symdecl_##1_prop}{assocs} , + argnames = {\prop_item:cn {l_stex_symdecl_##1_prop}{argnames}} , } \cs_set_eq:cc {stex_var_notation_\l_tmpa_str _cs} {g_@@_tmpa_\l_tmpa_str _cs} |