summaryrefslogtreecommitdiff
path: root/macros/latex/base/lthooks.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-01-09 03:02:47 +0000
committerNorbert Preining <norbert@preining.info>2021-01-09 03:02:47 +0000
commit0b5fb424a9fab0df06b2d7b9f8edc803cb89a760 (patch)
tree02008dd79efebad99a4b20f38049574ad71a5c10 /macros/latex/base/lthooks.dtx
parentb3f791edc2a8218e3e64f40d7c10d1310362972c (diff)
CTAN sync 202101090302
Diffstat (limited to 'macros/latex/base/lthooks.dtx')
-rw-r--r--macros/latex/base/lthooks.dtx102
1 files changed, 78 insertions, 24 deletions
diff --git a/macros/latex/base/lthooks.dtx b/macros/latex/base/lthooks.dtx
index cc79892ca7..0a04c38efb 100644
--- a/macros/latex/base/lthooks.dtx
+++ b/macros/latex/base/lthooks.dtx
@@ -31,8 +31,8 @@
%%% From File: lthooks.dtx
%
% \begin{macrocode}
-\def\lthooksversion{v1.0g}
-\def\lthooksdate{2020/12/18}
+\def\lthooksversion{v1.0h}
+\def\lthooksdate{2021/01/07}
% \end{macrocode}
%
%<*driver>
@@ -1873,35 +1873,80 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_tl_set:Nn,\@@_tl_set:cn,\@@_tl_set:cx}
-% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:cn,\@@_tl_gset:co,\@@_tl_gset:cx}
-% \begin{macro}{\@@_tl_gput_right:Nn,\@@_tl_gput_right:No,\@@_tl_gput_right:cn}
-% \begin{macro}{\@@_tl_gput_left:Nn,\@@_tl_gput_left:No}
-% \begin{macro}{\@@_tl_gclear:N,\@@_tl_gclear:c}
-% \begin{macro}{\@@_tl_gset_eq:NN}
+% \begin{macro}{\@@_tl_set:Nn,\@@_tl_set:Nx,
+% \@@_tl_set:cn,\@@_tl_set:cx}
% Private copies of a few \pkg{expl3} functions. \pkg{l3debug} will
% only add debugging to the public names, not to these copies, so we
% don't have to use \cs{debug_suspend:} and \cs{debug_resume:}
% everywhere.
+%
+% Functions like \cs{@@_tl_set:Nn} have to be redefined, rather than
+% copied because in \pkg{expl3} they use
+% \cs[no-index]{__kernel_tl_(g)set:Nx}, which is also patched by
+% \pkg{l3debug}.
+% \changes{v1.0h}{2021/01/07}{Manually define some \pkg{l3tl} commands
+% to work around \pkg{expl3} changes}
% \begin{macrocode}
-\cs_new_eq:NN \@@_tl_set:Nn \tl_set:Nn
-\cs_generate_variant:Nn \@@_tl_set:Nn { cn, cx }
-\cs_new_eq:NN \@@_tl_gset:Nn \tl_gset:Nn
-\cs_generate_variant:Nn \@@_tl_gset:Nn { cn, co, cx }
-\cs_new_eq:NN \@@_tl_gput_right:Nn \tl_gput_right:Nn
-\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No, cn }
-\cs_new_eq:NN \@@_tl_gput_left:Nn \tl_gput_left:Nn
-\cs_generate_variant:Nn \@@_tl_gput_left:Nn { No }
-\cs_new_protected:Npn \@@_tl_gclear:N #1
- { \@@_tl_gset_eq:NN #1 \c_empty_tl }
-\cs_generate_variant:Nn \@@_tl_gclear:N { c }
-\cs_new_eq:NN \@@_tl_gset_eq:NN \tl_gset_eq:NN
+\cs_new_protected:Npn \@@_tl_set:Nn #1#2
+ { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
+\cs_new_protected:Npn \@@_tl_set:Nx #1#2
+ { \cs_set_nopar:Npx #1 {#2} }
+\cs_generate_variant:Nn \@@_tl_set:Nn { c }
+\cs_generate_variant:Nn \@@_tl_set:Nx { c }
% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:No,\@@_tl_gset:Nx,
+% \@@_tl_gset:cn,\@@_tl_gset:co,\@@_tl_gset:cx}
+% Same as above.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gset:Nn #1#2
+ { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
+\cs_new_protected:Npn \@@_tl_gset:No #1#2
+ { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
+\cs_new_protected:Npn \@@_tl_gset:Nx #1#2
+ { \cs_gset_nopar:Npx #1 {#2} }
+\cs_generate_variant:Nn \@@_tl_gset:Nn { c }
+\cs_generate_variant:Nn \@@_tl_gset:No { c }
+\cs_generate_variant:Nn \@@_tl_gset:Nx { c }
+% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\@@_tl_gput_right:Nn,\@@_tl_gput_right:No,\@@_tl_gput_right:cn}
+% Same as above.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gput_right:Nn #1#2
+ { \@@_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
+\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No, cn }
+% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\@@_tl_gput_left:Nn,\@@_tl_gput_left:No}
+% Same as above.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gput_left:Nn #1#2
+ {
+ \@@_tl_gset:Nx #1
+ { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
+ }
+\cs_generate_variant:Nn \@@_tl_gput_left:Nn { No }
+% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\@@_tl_gset_eq:NN}
+% Same as above.
+% \begin{macrocode}
+\cs_new_eq:NN \@@_tl_gset_eq:NN \tl_gset_eq:NN
+% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\@@_tl_gclear:N,\@@_tl_gclear:c}
+% Same as above.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gclear:N #1
+ { \@@_tl_gset_eq:NN #1 \c_empty_tl }
+\cs_generate_variant:Nn \@@_tl_gclear:N { c }
+% \end{macrocode}
% \end{macro}
%
%
@@ -2527,11 +2572,20 @@
{ \@@_strip_double_slash:n {#1} }
\cs_new:Npn \@@_strip_double_slash:n #1
{ \@@_strip_double_slash:w #1 // \s_@@_mark }
-\cs_new:Npn \@@_strip_double_slash:w #1 // #2 \s_@@_mark
+% \end{macrocode}
+% This function is always called after testing if the argument is a
+% file hook with \cs{@@_if_file_hook:wTF}, so we can assume it has
+% three parts (it is either \verb|file/before/...| or
+% \verb|file/after/...|), so we use \verb|#1/#2/#3 //| instead of just
+% \verb|#1 //| to prevent losing a slash if the file name is empty.
+% \changes{v1.0h}{2021/01/07}{Assume hook name has at least three
+% nonempty parts (gh/464)}
+% \begin{macrocode}
+\cs_new:Npn \@@_strip_double_slash:w #1/#2/#3 // #4 \s_@@_mark
{
- \tl_if_empty:nTF {#2}
- {#1}
- { \@@_strip_double_slash:w #1 / #2 \s_@@_mark }
+ \tl_if_empty:nTF {#4}
+ { #1/#2/#3 }
+ { \@@_strip_double_slash:w #1/#2/#3 / #4 \s_@@_mark }
}
% \end{macrocode}
% \end{macro}