diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/knowledge/knowledge.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/knowledge/knowledge.sty | 119 |
1 files changed, 66 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty index dff9e0a83a7..6838bb84372 100644 --- a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty +++ b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty @@ -23,7 +23,7 @@ %% LaTeX version 1999/12/01 or later. %% \usepackage{expl3} -\ProvidesExplPackage{knowledge}{2017/10/18}{1.07}{} +\ProvidesExplPackage{knowledge}{2018/02/17}{1.10}{} %%%%%%%%%% \RequirePackage{l3keys2e} \RequirePackage{etoolbox} @@ -109,7 +109,6 @@ \makeatother \cs_new:Nn\if_true:TF{#1} \cs_new:Nn\if_false:TF{#2} -\cs_generate_variant:Nn\int_compare:nNnTF{cNnTF} \cs_generate_variant:Nn\use:nn{nx} \cs_new:Npn\cs_apply_inline:nn#1 {\cs_set:Npn\g_tmpa_cs:##1{#1} @@ -138,15 +137,6 @@ \cs_new:Npn\cs_apply_inline:nnnnnnnnnn#1 {\cs_set:Npn\g_tmpa_cs:##1##2##3##4##5##6##7##8##9{#1} \g_tmpa_cs:} -\cs_generate_variant:Nn\cs_apply_inline:nn{nc} -\cs_generate_variant:Nn\cs_apply_inline:nnn{ncc} -\cs_generate_variant:Nn\cs_apply_inline:nnnn{nccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnn{ncccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnn{nccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnn{ncccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnn{nccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnn{ncccccccc} -\cs_generate_variant:Nn\cs_apply_inline:nnnnnnnnnn{nccccccccc} \AtBeginDocument{\KAuxActivate} \NewDocumentCommand\KAuxActivate{}{ @@ -617,21 +607,21 @@ {\file_if_exist:nT{#1} {\group_begin: \bool_set_false:N\l_tmpa_bool - \ior_open:Nn\g_tmpa_ior{#1} - \iow_open:Nn\g_tmpa_iow{#2} + \ior_open:Nn\klg_tmpa_ior{#1} + \iow_open:Nn\klg_tmpa_iow{#2} \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \exp_args:NNV \iow_now:Nn - \g_tmpa_iow + \klg_tmpa_iow \l_tmpa_tl} } - \ior_close:N\g_tmpa_ior - \iow_close:N\g_tmpa_iow + \ior_close:N\klg_tmpa_ior + \iow_close:N\klg_tmpa_iow \group_end:}} \cs_new_protected_with_variants:Nnn\kl_compare_files:Nnn{NnV,NVn,NVV} @@ -646,22 +636,22 @@ \file_if_exist:nT{#3} {\bool_set_false:N\l_tmpb_bool}} \bool_if:NF\l_tmpa_bool{ - \ior_open:Nn\g_tmpa_ior{#2} - \ior_open:Nn\g_tmpb_ior{#3} + \ior_open:Nn\klg_tmpa_ior{#2} + \ior_open:Nn\klg_tmpb_ior{#3} % \bool_do_until:Nn\l_tmpa_bool{ - \ior_if_eof:NTF\g_tmpa_ior + \ior_if_eof:NTF\klg_tmpa_ior {\bool_set_true:N\l_tmpa_bool - \ior_if_eof:NF\g_tmpb_ior + \ior_if_eof:NF\klg_tmpb_ior {\bool_set_false:N\l_tmp_bool}} - {\ior_if_eof:NTF\g_tmpb_ior + {\ior_if_eof:NTF\klg_tmpb_ior {\bool_set_true:N\l_tmpa_bool \bool_set_false:N\l_tmp_bool} {\ior_get_str:NN - \g_tmpa_ior + \klg_tmpa_ior \l_tmpa_tl \ior_get_str:NN - \g_tmpb_ior + \klg_tmpb_ior \l_tmpb_tl \tl_if_eq:NNF \l_tmpa_tl\l_tmpb_tl @@ -669,21 +659,20 @@ \bool_set_false:N\l_tmpb_bool} }} } - \ior_close:N\g_tmpa_ior - \ior_close:N\g_tmpb_ior} + \ior_close:N\klg_tmpa_ior + \ior_close:N\klg_tmpb_ior} \bool_if:NTF\l_tmpb_bool {\group_end:\bool_set_true:N#1} {\group_end:\bool_set_false:N#1} } \cs_new_protected:Nn\kl_tl_to_file:nn - {\iow_open:Nn\g_tmpa_iow{#1} - \iow_now:Nn\g_tmpa_iow{#2} - \iow_close:N\g_tmpa_iow} -\ior_new:N\g_tmpa_ior -\ior_new:N\g_tmpb_ior -\iow_new:N\g_tmpa_iow -\iow_new:N\g_tmpb_iow + {\iow_open:Nn\klg_tmpa_iow{#1} + \iow_now:Nn\klg_tmpa_iow{#2} + \iow_close:N\klg_tmpa_iow} +\ior_new:N\klg_tmpa_ior +\ior_new:N\klg_tmpb_ior +\iow_new:N\klg_tmpa_iow \cs_generate_variant:Nn\cs_gset_eq:NN{cN,cc} \NewDocumentCommand\OverloadCommand{mmm} {\exp_args:Nc\cs_gset_eq:NN{SUPER\cs_to_str:N#1}#1 @@ -781,6 +770,8 @@ {\msg_warning:nnn{knowledge}{knowledge~warning}{#1}} \cs_new:Nn\knowledge_error:n {\msg_error:nnn{knowledge}{knowledge~error}{#1}} +\cs_new:Npn\knowledge_werror:Nn#1 + {\bool_if:NTF#1\knowledge_error:n\knowledge_warning:n} \msg_new:nnnn{knowledge}{knowledge~info}{#1}{#2} \msg_new:nnnn{knowledge}{knowledge~warning}{#1}{#2} \msg_new:nnnn{knowledge}{knowledge~error}{#1}{#2} @@ -899,6 +890,9 @@ \cs_new:Nn\knowledge_option_bool_new:n {\bool_new:c{knowledge_option_#1_bool} \exp_args:Nnc\knowledge_option_bool_new:nN{#1}{knowledge_option_#1_bool}} +\bool_new:N\knowledge_warningstrict_bool +\bool_set_false:N\knowledge_warningstrict_bool +\KnowledgeConfigureBooleanOption[\knowledge_warningstrict_bool]{strict} \bool_new:N\knowledge_configuration_quotation_bool \KnowledgeConfigureBooleanOptionTF[\knowledge_configuration_quotation_bool]{quotation}{\klactivatequotation}{\kldeactivatequotation} \KnowledgeConfigureTrigger{protect~quotation}{\kl_protect_environment_quotation:n{#1}} @@ -1749,10 +1743,10 @@ %% \keys_define:nn { knowledge~directives } { namespace .code:n = { \tl_set:Nn\knowledge_knowledge_namespace_tl{#1} }, - force .choice:, - force / false .code:n = {\bool_set_false:N\knowledge_knowledge_force_bool}, - force / true .code:n = {\bool_set_true:N\knowledge_knowledge_force_bool}, - force .default:n = false, + append .choice:, + append / false .code:n = {\bool_set_false:N\knowledge_knowledge_append_bool}, + append / true .code:n = {\bool_set_true:N\knowledge_knowledge_append_bool}, + append .default:n = false, clear .choice:, clear / false .code:n = {\bool_set_false:N\knowledge_knowledge_clear_bool}, clear / true .code:n = {\bool_set_true:N\knowledge_knowledge_clear_bool}, @@ -1784,7 +1778,11 @@ \knowledge_at:N\ktuple_if_exist:NTF {\bool_if:NTF\knowledge_knowledgestyle_bool {\knowledge_at:N\ktuple_gclear:N} - {\knowledge_warning:n{knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + {\bool_if:NF\knowledge_knowledge_append_bool + {\bool_if:NF\knowledge_knowledge_clear_bool + \knowledge_werror:Nn\knowledge_warningstrict_bool + {knowledge~'#3'~(namespace=#1,~scope=#2)~is~redefined.}}} + } {\knowledge_at:N\ktuple_new:N} \keys_set:nn { knowledgenow~directives } { #4 } } @@ -1801,27 +1799,37 @@ \cs_generate_variant:Nn\knowledge_set_now:nnnn{nnVn} \NewDocumentCommand\knowledge{} {\KAuxWriteLocation\__knowledge_knowledge} -\NewDocumentCommand\__knowledge_knowledge{m >{\SplitList{|}}o m } +\NewDocumentCommand\__knowledge_knowledge{t! t+ m >{\SplitList{|}}o m } { \kl_hide_begin: \group_begin: + % + \IfBooleanTF{#1}{% + \bool_set_false:N\knowledge_knowledge_append_bool + \bool_set_true:N\knowledge_knowledge_clear_bool + }% + \IfBooleanTF{#2}{% + \bool_set_true:N\knowledge_knowledge_append_bool + \bool_set_false:N\knowledge_knowledge_clear_bool + }% + % \tl_set_eq:NN\knowledge_namespace_tl \knowledge_default_namespace_tl % \bool_gset_false:N\knowledge_knowledge_is_synonym_bool % \use:x{ - \exp_not:n{\knowledge_knowledge_process:nn{#1}} - {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#3}}} + \exp_not:n{\knowledge_knowledge_process:nn{#3}} + {\exp_not:V\knowledge_knowledgedefault_tl,\exp_not:n{#5}}} % \bool_if:NF\knowledge_knowledge_is_synonym_bool - {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#1} + {\tl_gset:Nn\knowledge_knowledge_synonym_tl{#3} \tl_gset_eq:NN\knowledge_knowledge_synonyminstance_tl \knowledge_knowledge_instance_tl} % - \IfNoValueTF{#2}{}{ + \IfNoValueTF{#4}{}{ \cs_set:Nn\l_tmpa_cs:n {\exp_args:Nnx\knowledge_knowledge_process:nn{##1}{synonym}} - \ProcessList{#2}\l_tmpa_cs:n + \ProcessList{#4}\l_tmpa_cs:n } % \group_end: @@ -1847,19 +1855,17 @@ \bool_new:N\knowledge_knowledge_alsonow_bool \bool_new:N\knowledge_knowledge_is_synonym_bool \bool_new:N\knowledge_knowledge_autoref_bool +\bool_new:N\knowledge_knowledge_clear_bool +\bool_new:N\knowledge_knowledge_append_bool \tl_clear_new:N\knowledge_knowledge_synonym_tl \tl_clear_new:N\knowledge_knowledge_synonyminstance_tl -\tl_clear_new:N\knowledge_knowledge_clear_bool -\tl_clear_new:N\knowledge_knowledge_force_bool \tl_clear_new:N\knowledge_knowledge_export_bool \tl_clear_new:N\knowledge_knowledge_key_tl \tl_clear_new:N\knowledge_knowledge_namespace_tl \tl_clear_new:N\knowledge_knowledge_instance_tl \tl_clear_new:N\knowledge_knowledge_directives_tl \cs_new:Nn\knowledge_knowledge_process:nn -{ \bool_set_false:N\knowledge_knowledge_clear_bool - \bool_set_false:N\knowledge_knowledge_force_bool - \bool_set_false:N\knowledge_knowledge_export_bool +{ \bool_set_false:N\knowledge_knowledge_export_bool \bool_set_false:N\knowledge_knowledge_autoref_bool \bool_set_false:N\knowledge_knowledge_now_bool \bool_set_false:N\knowledge_knowledge_alsonow_bool @@ -1877,6 +1883,11 @@ {\bool_set_true:N\knowledge_knowledge_now_bool} {} % + \bool_if:NT\knowledge_knowledge_clear_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{clear,}} + \bool_if:NT\knowledge_knowledge_append_bool + {\tl_put_left:Nn\knowledge_knowledge_directives_tl{force,}} + % \bool_if:nTF{\knowledge_knowledge_now_bool} {\use:x{ \exp_not:N\knowledge_new_now:nnnn @@ -2387,7 +2398,7 @@ \NewKnowledgeParamBool*{autoref~link}\kl_autoreflink_bool \NewKnowledgeParamBool*{invisible}\kl_invisible_bool \NewKnowledgeParamBool*{italic}\kl_italic_bool -\NewKnowledgeParamBool*{sc}\kl_sc_bool +\NewKnowledgeParamBool*{smallcaps}\kl_smallcaps_bool \NewKnowledgeParamBool*{md}\kl_md_bool \NewKnowledgeParamBool*{up}\kl_up_bool \NewKnowledgeParamBool*{boldface}\kl_boldface_bool @@ -2547,7 +2558,7 @@ \knowledge_kl_display_generic_cond:Nn\kl_boldface_bool\kl_bf:n \knowledge_kl_display_generic_cond:Nn\kl_up_bool\kl_up:n \knowledge_kl_display_generic_cond:Nn\kl_italic_bool\kl_it:n - \knowledge_kl_display_generic_cond:Nn\kl_sc_bool\kl_sc:n + \knowledge_kl_display_generic_cond:Nn\kl_smallcaps_bool\kl_smallcaps:n \knowledge_kl_display_generic_cond:Nn\kl_typewriter_bool\kl_tt:n % if math \knowledge_kl_display_generic_cond:Nn\kl_mathop_bool\mathop @@ -2626,6 +2637,8 @@ \cs_new:Npn\kl_md:n{\mode_if_math:TF\mathmd\textmd} \cs_new:Npn\kl_sc:n{\mode_if_math:TF\mathsc\textsc} \cs_new:Npn\kl_it:n{\mode_if_math:TF\mathit\textit} +\cs_new:Npn\mathscerror#1{\knowledge_error:n{`smallcaps'~only~allowed~in~math~mode.}} +\cs_new:Npn\kl_smallcaps:n{\mode_if_math:TF\mathscerror\textsc} \cs_new:Npn\kl_tt:n{\mode_if_math:TF\mathtt\texttt} \cs_new:Npn\kl_bf:n{\mode_if_math:TF\mathbf\textbf} \cs_new:Npn\kl_underline:n{\mode_if_math:TF\use:n\underline} @@ -2972,7 +2985,7 @@ default style={intro,autoref target}, unknown style= intro unknown, unknown style cont= intro unknown cont, - style directive=intro style + style directive= intro style } \knowledgenewvariant\phantomintro{ namespace=default, |