summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-05-17 20:25:25 +0000
committerKarl Berry <karl@freefriends.org>2018-05-17 20:25:25 +0000
commit7e9227dfbf310d133bca2331f978d17b65320433 (patch)
tree2a0ab91ce5f4386cf392abe441daee7606face4f /Master/texmf-dist/tex/latex
parent0ecf5cacb77a8ffb9204f7532bf5d93b44fe5e29 (diff)
knowledge (17may18)
git-svn-id: svn://tug.org/texlive/trunk@47739 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/knowledge/knowledge.sty70
1 files changed, 47 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/knowledge/knowledge.sty b/Master/texmf-dist/tex/latex/knowledge/knowledge.sty
index 6838bb84372..e575f417c54 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}{2018/02/17}{1.10}{}
+\ProvidesExplPackage{knowledge}{2018/05/17}{1.11}{}
%%%%%%%%%%
\RequirePackage{l3keys2e}
\RequirePackage{etoolbox}
@@ -612,7 +612,7 @@
\bool_do_until:Nn\l_tmpa_bool{
\ior_if_eof:NTF\klg_tmpa_ior
{\bool_set_true:N\l_tmpa_bool}
- {\ior_get_str:NN
+ {\ior_str_get:NN
\klg_tmpa_ior
\l_tmpa_tl
\exp_args:NNV
@@ -647,10 +647,10 @@
{\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
+ {\ior_str_get:NN
\klg_tmpa_ior
\l_tmpa_tl
- \ior_get_str:NN
+ \ior_str_get:NN
\klg_tmpb_ior
\l_tmpb_tl
\tl_if_eq:NNF
@@ -673,11 +673,34 @@
\ior_new:N\klg_tmpa_ior
\ior_new:N\klg_tmpb_ior
\iow_new:N\klg_tmpa_iow
+\cs_new:Npn\commandVariant#1#2{#2\cs_to_str:N#1}
+
\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
- \exp_args:Nc\NewDocumentCommand{NEW\cs_to_str:N#1}{#2}{#3}
- \cs_gset_eq:Nc#1{NEW\cs_to_str:N#1}}
+\NewDocumentCommand\OverloadCommand{mmO{NEW}m}
+ {\cs_if_exist:cTF
+ {\commandVariant#1{switch~}}
+{}
+ {\exp_args:Nc\cs_gset_eq:NN
+{\commandVariant#1{SUPER}}
+#1
+ \exp_args:NNx\cs_gset:Npn
+ #1{\exp_not:c{\commandVariant#1{switch~}}}
+ }
+ \exp_args:Nc\NewDocumentCommand
+ {\commandVariant#1{#3}}{#2}{#4}
+ \ChooseCommand#1{#3}
+}
+\NewDocumentCommand\ChooseCommand{mm}{
+ \tl_map_inline:nn{#1}
+ {\cs_if_exist:cTF
+ {\commandVariant##1{#2}}
+ {\cs_gset_eq:cc
+ {\commandVariant##1{switch~}}
+ {\commandVariant##1{#2}}}
+ {\tl_show:n
+ {knowledge_utils~ERROR:~##1~has~no~variant~{#2}}}
+ }
+}
\NewDocumentCommand\XparseArgs{mm}
{\kutils_reverting_args:Nn#1{#2}}
\DeclareExpandableDocumentCommand\ExpXparseArgs{mm}
@@ -1278,6 +1301,7 @@
\scope_area_push_ii:n{#1}}}
}
\cs_new:Nn\scope_internal_push:n {
+ \ScopeActivate
\tl_gset:Nn\scope_top_area_tl{#1}
\int_gincr:c{\scope_tl.area[\scope_top_area_tl].nesting_int}
\int_gincr:c{\scope_tl.area[\scope_top_area_tl].count_int}
@@ -1453,11 +1477,12 @@
\let\label\scopeLabel
}
\NewDocumentCommand\ScopeActivate{}{
- \scope_internal_push:n{base}
\cs_gset_eq:NN\ScopeActivate\relax
+ \scope_internal_push:n{base}
}
\AtBeginDocument{\ScopeActivate}
\AtBeginDocument{\ScopeHackEnvironments}
+\AtEndDocument{\scope_area_pop:n{document}}
\scope_area_set:nn{document,base,body} {
environment=false
}
@@ -1480,7 +1505,7 @@
{body}{knowledge=none}
%
\newenvironment{scope}
- {\mode_if_preamble:TF{\scope_area_push:n{scope}}{}}
+ {\mode_if_preamble:TF{\ScopeActivate\scope_area_push:n{scope}}{}}
{\mode_if_preamble:TF{\scope_area_pop:n{scope}}{}}
\knowledgeconfigureenvironment{scope}{}
\scope_area_set:nn{knowledge~context~internal}
@@ -1954,7 +1979,7 @@
{\tl_set:Nn\knowledge_knowledgedefault_tl{#2}}
\kl_hide_end:
}
-\NewDocumentCommand\__kl:w{d() o d() m}{
+\NewDocumentCommand\knowledge_kl:w{d() o d() m}{
\IfNoValueTF{#1}
{\IfNoValueTF{#3}
{\IfNoValueTF{#2}
@@ -2264,7 +2289,7 @@
%
\NewDocumentCommand#1{s}
{\knowledge_kl_modifiers_add:N#1
- \IfBooleanF{##1}{\__kl:w}}
+ \IfBooleanF{##1}{\knowledge_kl:w}}
%
\tl_new_eq:cN
{knowledge_kl_\cs_to_str:N#1_namespace_tl}
@@ -2616,11 +2641,11 @@
{\int_compare:nNnTF\l_tmpa_int=1
{} {\int_to_alph:n\l_tmpa_int}}
\exp_args:Nx\label{\exp_not:V\knowledge_kl_autoref_tl\l_tmpa_tl}}
- \expandafter\ktuple_countintro_gincr:N
- \knowledge_kl_resourcetoken_tl
- \KAuxWriteX
- {\exp_not:N\KAuxAutorefTarget
- \exp_not:o\knowledge_kl_resourcearguments_tl}}
+ \expandafter\ktuple_countintro_gincr:N
+ \knowledge_kl_resourcetoken_tl
+ \KAuxWriteX
+ {\exp_not:N\KAuxAutorefTarget
+ \exp_not:o\knowledge_kl_resourcearguments_tl}}
}
\cs_new:Nn\knowledge_kl_compute_code_makeidx:{
\tl_if_exist_ne:NTF\knowledge_kl_index_tl
@@ -2974,15 +2999,15 @@
\knowledgestyle{invisible}{invisible}
\knowledgenewvariant\kl{
- namespace=default,
- default style={kl,autoref link},
+ namespace= default,
+ default style= {kl,autoref link},
unknown style= kl unknown,
- unknown style cont=kl unknown cont,
+ unknown style cont= kl unknown cont,
style directive={style}
}
\knowledgenewvariant\intro{
- namespace=default,
- default style={intro,autoref target},
+ namespace= default,
+ default style= {intro,autoref target},
unknown style= intro unknown,
unknown style cont= intro unknown cont,
style directive= intro style
@@ -3189,7 +3214,6 @@
%%%%%%%%%%
\ExplSyntaxOn
\exp_args:NNV\ExplSyntaxOff\knowledgeconfigure\knowledge_configuration_pending_tl
-\ScopeActivate
\endinput
%%