diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-11 20:57:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-11 20:57:29 +0000 |
commit | 344f571397847584bf25231169ad48625098a3c5 (patch) | |
tree | 5db8517c24c0922b83a2b89adfef1d04ecd7c695 /Master/texmf-dist/tex/latex-dev/base | |
parent | 669f118b45756491c4d06049f501796b22192227 (diff) |
latex-base-dev (10sep20)
git-svn-id: svn://tug.org/texlive/trunk@56324 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex-dev/base')
8 files changed, 651 insertions, 440 deletions
diff --git a/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty b/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty index 2ffbc66bfc1..b390284aef3 100644 --- a/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty +++ b/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty @@ -45,9 +45,9 @@ %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team %% %%% From File: ltshipout.dtx -\providecommand\ltshipoutversion{v1.0a} -\providecommand\ltshipoutdate{2020/08/31} -\ProvidesPackage{atbegshi} +\providecommand\ltshipoutversion{v1.0b} +\providecommand\ltshipoutdate{2020/09/09} +\ProvidesPackage{atbegshi-ltx} [2020/08/17 v1.0a Emulation of the original atbegshi package^^Jwith kernel methods] \let \AtBeginShipoutBox \ShipoutBox diff --git a/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty b/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty index 05678138e89..f41f42d1401 100644 --- a/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty +++ b/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty @@ -44,10 +44,10 @@ %% %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach, %% Phelype Oleinik & LaTeX Team -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx \providecommand\ltfilehookversion{v1.0a} \providecommand\ltfilehookdate{2020/08/30} -\ProvidesPackage{atveryend} +\ProvidesPackage{atveryend-ltx} [2020/08/19 v1.0a Emulation of the original atvery package^^Jwith kernel methods] \newcommand\AfterLastShipout {\AddToHook{enddocument/afterlastpage}} diff --git a/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty b/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty index 5eadf0fc814..2b6f09f0767 100644 --- a/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty +++ b/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty @@ -45,9 +45,9 @@ %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team %% %%% From File: ltshipout.dtx -\providecommand\ltshipoutversion{v1.0a} -\providecommand\ltshipoutdate{2020/08/31} -\ProvidesPackage{everyshi} +\providecommand\ltshipoutversion{v1.0b} +\providecommand\ltshipoutdate{2020/09/09} +\ProvidesPackage{everyshi-ltx} [2020/08/17 v1.0a Emulation of the original everyshi package^^Jwith kernel methods] \def \EveryShipout {\AddToHook{shipout/before}} diff --git a/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty b/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty index b652ce8de84..8ade09ed909 100644 --- a/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty +++ b/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty @@ -44,7 +44,7 @@ %% %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach, %% Phelype Oleinik & LaTeX Team -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx \providecommand\ltfilehookversion{v1.0a} \providecommand\ltfilehookdate{2020/08/30} \newcommand\AtBeginOfEveryFile [1] diff --git a/Master/texmf-dist/tex/latex-dev/base/latex.ltx b/Master/texmf-dist/tex/latex-dev/base/latex.ltx index 50794044fc7..af87cdddb8b 100644 --- a/Master/texmf-dist/tex/latex-dev/base/latex.ltx +++ b/Master/texmf-dist/tex/latex-dev/base/latex.ltx @@ -710,7 +710,7 @@ \def\fmtname{LaTeX2e} \edef\fmtversion {2020-10-01} -\def\patch@level{-8} +\def\patch@level{-9} \edef\development@branch@name{develop \the\year-\the\month-\the\day} \iffalse \def\reserved@a#1/#2/#3\@nil{% @@ -1065,6 +1065,8 @@ \cs_gset_eq:NN \@expl@cs@prefix@spec@@N \cs_prefix_spec:N \cs_gset_eq:NN \@expl@cs@argument@spec@@N \cs_argument_spec:N \cs_gset_eq:NN \@expl@cs@replacement@spec@@N \cs_replacement_spec:N +\cs_gset_eq:NN \@expl@str@map@function@@NN \str_map_function:NN +\cs_gset_eq:NN \@expl@char@generate@@nn \char_generate:nn \ExplSyntaxOff %%% From File: ltdefns.dtx \def\two@digits#1{\ifnum#1<10 0\fi\number#1} @@ -1569,9 +1571,21 @@ \edef #1{\expandafter\strip@prefix \meaning #1}% } +\def\string@makeletter#1{% + \@expl@str@map@function@@NN#1\@string@makeletter} +\def\@string@makeletter#1{% + \char@if@alph{#1}% + {\@expl@char@generate@@nn{`#1}{11}}% + {#1}} +\def\char@if@alph#1{% + \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi + \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0 + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} \DeclareRobustCommand\makeatletter{\catcode`\@11\relax} \DeclareRobustCommand\makeatother{\catcode`\@12\relax} - \def\@latex@info#1{} \ifx\directlua\@undefined \DeclareRobustCommand{\-}{% @@ -1615,7 +1629,7 @@ %% Phelype Oleinik & LaTeX Team %%% From File: lthooks.dtx \def\lthooksversion{v1.0a} -\def\lthooksdate{2020/08/31} +\def\lthooksdate{2020/09/10} \ExplSyntaxOn \bool_new:N \g__hook_debug_bool \cs_new_eq:NN \__hook_debug:n \use_none:n @@ -1643,42 +1657,47 @@ \tl_new:N \g__hook_removal_list_tl \tl_new:N \l__hook_cur_hook_tl \prop_new:N \l__hook_work_prop +\prop_new:N \g__hook_execute_immediately_prop +\prop_new:N \g__hook_used_prop \tl_new:N \g__hook_hook_curr_name_tl \seq_new:N \g__hook_name_stack_seq \cs_new_eq:NN \__hook_tmp:w ? \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx } +\cs_generate_variant:Nn \tl_show:n { x } +\cs_generate_variant:Nn \tl_log:n { x } \scan_new:N \s__hook_mark \cs_new_protected:Npn \hook_new:n #1 + { \__hook_normalize_hook_args:Nn \__hook_new:n {#1} } +\cs_new_protected:Npn \__hook_new:n #1 { - \exp_args:Nx \__hook_new:n - { \__hook_parse_label_default:nn {#1} { top-level } } - } -\cs_new_protected:Npn \__hook_new:n #1 { - \hook_if_exist:nTF {#1} - { \msg_error:nnn { hooks } { exists } {#1} } - { \seq_gput_right:Nn \g__hook_all_seq {#1} - \tl_new:c { g__hook_#1_code_tl } - \__hook_declare:n {#1} - \clist_new:c {g__hook_#1_labels_clist} - \tl_new:c { g__hook_#1_reversed_tl } - \__hook_include_legacy_code_chunk:n {#1} + \hook_if_exist:nTF {#1} + { \msg_error:nnn { hooks } { exists } {#1} } + { + \seq_gput_right:Nn \g__hook_all_seq {#1} + \tl_new:c { __hook~#1 } + \__hook_declare:n {#1} + \clist_new:c {g__hook_#1_labels_clist} + \tl_new:c { g__hook_#1_reversed_tl } + \__hook_include_legacy_code_chunk:n {#1} } -} + } \cs_new_protected:Npn \__hook_declare:n #1 { \__hook_if_exist:nF {#1} { \prop_new:c { g__hook_#1_code_prop } - \tl_new:c { g__hook_#1_code_next_tl } + \tl_new:c { __hook_next~#1 } } } -\cs_new_protected:Npn \hook_new_reversed:n #1 { - \hook_new:n {#1} - \tl_gset:cn { g__hook_#1_reversed_tl } { - } -} -\cs_new_protected:Npn \hook_new_pair:nn #1#2 { - \hook_new:n {#1} \hook_new_reversed:n {#2} -} +\cs_new_protected:Npn \hook_new_reversed:n #1 + { \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} } +\cs_new_protected:Npn \__hook_new_reversed:n #1 + { + \__hook_new:n {#1} + \tl_gset:cn { g__hook_#1_reversed_tl } { - } + } +\cs_new_protected:Npn \hook_new_pair:nn #1#2 + { \hook_new:n {#1} \hook_new_reversed:n {#2} } \cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1 { \debug_suspend: @@ -1693,13 +1712,15 @@ } \debug_resume: } -\cs_new:Npn \__hook_parse_label_default:nn #1 #2 +\cs_new:Npn \__hook_parse_label_default:n #1 { \tl_if_novalue:nTF {#1} - { \__hook_currname_or_default:n {#2} } - { \tl_trim_spaces_apply:nN {#1} \__hook_parse_dot_label:nn {#2} } + { \__hook_currname_or_default:n { top-level } } + { + \tl_trim_spaces_apply:nN {#1} + \__hook_parse_dot_label:nn { top-level } + } } -\cs_generate_variant:Nn \__hook_parse_label_default:nn { V } \cs_new:Npn \__hook_parse_dot_label:nn #1 #2 { \tl_if_empty:nTF {#1} @@ -1709,7 +1730,7 @@ } { \str_if_eq:nnTF {#1} { . } - { \__hook_currname_or_default:n {#1} } + { \__hook_currname_or_default:n {#2} } { \__hook_parse_dot_label:nw {#2} #1 ./ \s__hook_mark } } } @@ -1719,40 +1740,79 @@ { \__hook_parse_dot_label_aux:nw {#1} #3 \s__hook_mark } { \tl_if_empty:nTF {#3} - {#2} + { \__hook_make_name:n {#2} } { \__hook_parse_dot_label_cleanup:w #2 ./ #3 \s__hook_mark } } } \cs_new:Npn \__hook_parse_dot_label_cleanup:w #1 ./ \s__hook_mark {#1} \cs_new:Npn \__hook_parse_dot_label_aux:nw #1 #2 ./ \s__hook_mark - { \__hook_currname_or_default:n {#1} / #2 } + { \__hook_currname_or_default:n {#1} / \__hook_make_name:n {#2} } \cs_new:Npn \__hook_currname_or_default:n #1 { \tl_if_empty:NTF \g__hook_hook_curr_name_tl { \tl_if_empty:NTF \@currname - {#1} + { \__hook_make_name:n {#1} } { \@currname } } { \g__hook_hook_curr_name_tl } } -\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 +\cs_new:Npn \__hook_make_name:n #1 + { + \exp_after:wN \exp_after:wN \exp_after:wN \__hook_make_name:w + \exp_after:wN \token_to_str:N \cs:w __hook~ #1 \cs_end: + } +\exp_last_unbraced:NNNNo +\cs_new:Npn \__hook_make_name:w #1 \tl_to_str:n { __hook~ } { } +\cs_new_protected:Npn \__hook_normalize_hook_args_aux:Nn #1 #2 + { + \group_begin: + \use:e + { + \group_end: + \exp_not:N #1 #2 + } + } +\cs_new_protected:Npn \__hook_normalize_hook_args:Nn #1 #2 + { + \__hook_normalize_hook_args_aux:Nn #1 + { { \__hook_parse_label_default:n {#2} } } + } +\cs_new_protected:Npn \__hook_normalize_hook_args:Nnn #1 #2 #3 + { + \__hook_normalize_hook_args_aux:Nn #1 + { + { \__hook_parse_label_default:n {#2} } + { \__hook_parse_label_default:n {#3} } + } + } +\cs_new_protected:Npn \__hook_normalize_hook_rule_args:Nnnnn #1 #2 #3 #4 #5 { - \exp_args:Nxx \__hook_gput_code:nnn - { \__hook_parse_label_default:nn {#1} { top-level } } - { \__hook_parse_label_default:nn {#2} { top-level } } + \__hook_normalize_hook_args_aux:Nn #1 + { + { \__hook_parse_label_default:n {#2} } + { \__hook_parse_label_default:n {#3} } + { \tl_trim_spaces:n {#4} } + { \__hook_parse_label_default:n {#5} } + } } +\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 + { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} } \cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3 { - \__hook_if_marked_removal:nnTF {#1} {#2} - { \__hook_unmark_removal:nn {#1} {#2} } + \prop_if_in:NnTF \g__hook_execute_immediately_prop {#1} + {#3} { - \hook_if_exist:nTF {#1} + \__hook_if_marked_removal:nnTF {#1} {#2} + { \__hook_unmark_removal:nn {#1} {#2} } { - \__hook_hook_gput_code_do:nnn {#1} {#2} {#3} - \__hook_update_hook_code:n {#1} + \hook_if_exist:nTF {#1} + { + \__hook_hook_gput_code_do:nnn {#1} {#2} {#3} + \__hook_update_hook_code:n {#1} + } + { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} } } - { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} } } } \cs_generate_variant:Nn \__hook_gput_code:nnn { nxv } @@ -1852,11 +1912,7 @@ \prop_const_from_keyval:Nn \c__hook_generics_reversed_iii_prop {after=} \prop_const_from_keyval:Nn \c__hook_generics_file_prop {before=,after=} \cs_new_protected:Npn \hook_gremove_code:nn #1 #2 - { - \exp_args:Nxx \__hook_gremove_code:nn - { \__hook_parse_label_default:nn {#1} { top-level } } - { \__hook_parse_label_default:nn {#2} { top-level } } - } + { \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} } \cs_new_protected:Npn \__hook_gremove_code:nn #1 #2 { \__hook_if_exist:nTF {#1} @@ -1895,18 +1951,12 @@ \cs_new:Npn \__hook_removal_tl:nn #1 #2 { & \tl_to_str:n {#2} $ \tl_to_str:n {#1} $ } \prop_new:c {g__hook_??_code_prop} -\prop_new:c {g__hook_??_code_tl} +\prop_new:c {__hook~??} \tl_new:c {g__hook_??_reversed_tl} \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4 { - \use:x - { - \__hook_gset_rule:nnnn - { \__hook_parse_label_default:nn {#1} { top-level } } - { \__hook_parse_label_default:nn {#2} { top-level } } - {#3} - { \__hook_parse_label_default:nn {#4} { top-level } } - } + \__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn + {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \__hook_gset_rule:nnnn #1#2#3#4 { @@ -1981,37 +2031,39 @@ { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:} \prop_map_inline:Nn \g__hook_used_prop { \iow_term:x{^^J~ ##1~ ->~ - \exp_not:v {g__hook_##1_code_tl}~ } + \exp_not:v {__hook~##1}~ } } } \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n } -\cs_new_protected:Npn \__hook_initialize_hook_code:n #1 { - \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~ - '#1' \on@line :^^J} } - \__hook_include_legacy_code_chunk:n {#1} - \hook_if_exist:nT {#1} - { - \prop_if_empty:cTF {g__hook_#1_code_prop} - { \tl_gset:co {g__hook_#1_code_tl} - {\cs:w g__hook_#1_code_next_tl \cs_end: } } - { - \__hook_if_reversed:nTF {#1} - { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_left:NV - \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV } - { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_right:NV - \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV } - \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop } - \__hook_initialize_single:cccn - { g__hook_#1_code_tl } { g__hook_#1_code_next_tl } - { g__hook_#1_labels_clist } {#1} - \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn - \g__hook_used_prop {#1}{} } - } - } -} -\prop_new:N\g__hook_used_prop +\cs_new_protected:Npn \__hook_initialize_hook_code:n #1 + { + \debug_suspend: + \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~ + '#1' \on@line :^^J} } + \__hook_include_legacy_code_chunk:n {#1} + \hook_if_exist:nT {#1} + { + \prop_if_empty:cTF {g__hook_#1_code_prop} + { \tl_gset:co { __hook~#1 } + { \cs:w __hook_next~#1 \cs_end: } } + { + \__hook_if_reversed:nTF {#1} + { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_left:NV + \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV } + { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_right:NV + \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV } + \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop } + \__hook_initialize_single:cccn + { __hook~#1 } { __hook_next~#1 } + { g__hook_#1_labels_clist } {#1} + \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn + \g__hook_used_prop {#1}{} } + } + } + \debug_resume: + } \cs_new:Npn \__hook_tl_csname:n #1 { l__hook_label_#1_tl } \cs_new:Npn \__hook_seq_csname:n #1 { l__hook_label_#1_seq } \seq_new:N \l__hook_labels_seq @@ -2019,33 +2071,33 @@ \tl_new:N \l__hook_front_tl \tl_new:N \l__hook_rear_tl \tl_new:c { \__hook_tl_csname:n { 0 } } -\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4 { - \debug_suspend: - \seq_clear:N \l__hook_labels_seq - \int_zero:N \l__hook_labels_int - \tl_set:Nn \l__hook_cur_hook_tl {#4} - \prop_map_inline:Nn \l__hook_work_prop - { - \int_incr:N \l__hook_labels_int - \seq_put_right:Nn \l__hook_labels_seq {##1} - \tl_set:cn { \__hook_tl_csname:n {##1} }{0} - \seq_clear_new:c { \__hook_seq_csname:n {##1} } - } - \prop_map_inline:Nn \l__hook_work_prop - { - \prop_map_inline:Nn \l__hook_work_prop - { - \__hook_if_label_case:nnnnn {##1} {####1} - { \prop_map_break: } - { \__hook_apply_label_pair:nnn {##1} {####1} } - { \__hook_apply_label_pair:nnn {####1} {##1} } - {#4} - } - } - \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop } - \tl_set:Nn \l__hook_rear_tl { 0 } - \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 } - \seq_map_inline:Nn \l__hook_labels_seq +\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4 + { + \seq_clear:N \l__hook_labels_seq + \int_zero:N \l__hook_labels_int + \tl_set:Nn \l__hook_cur_hook_tl {#4} + \prop_map_inline:Nn \l__hook_work_prop + { + \int_incr:N \l__hook_labels_int + \seq_put_right:Nn \l__hook_labels_seq {##1} + \tl_set:cn { \__hook_tl_csname:n {##1} }{0} + \seq_clear_new:c { \__hook_seq_csname:n {##1} } + } + \prop_map_inline:Nn \l__hook_work_prop + { + \prop_map_inline:Nn \l__hook_work_prop + { + \__hook_if_label_case:nnnnn {##1} {####1} + { \prop_map_break: } + { \__hook_apply_label_pair:nnn {##1} {####1} } + { \__hook_apply_label_pair:nnn {####1} {##1} } + {#4} + } + } + \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop } + \tl_set:Nn \l__hook_rear_tl { 0 } + \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 } + \seq_map_inline:Nn \l__hook_labels_seq { \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 { @@ -2053,42 +2105,41 @@ \tl_set:Nn \l__hook_rear_tl {##1} } } - \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } } - \tl_gclear:N #1 - \clist_gclear:N #3 - \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } } - { - \int_decr:N \l__hook_labels_int - \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl - \__hook_tl_gput:NV #1 \l__hook_return_tl - \__hook_clist_gput:NV #3 \l__hook_front_tl - \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} } - \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } } - { - \tl_set:cx { \__hook_tl_csname:n {##1} } - { \int_eval:n - { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 } - } - \int_compare:nNnT - { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 - { - \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} - \tl_set:Nn \l__hook_rear_tl {##1} - } - } - \tl_set_eq:Nc \l__hook_front_tl - { \__hook_tl_csname:n { \l__hook_front_tl } } - } - \int_compare:nNnF \l__hook_labels_int = 0 + \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } } + \tl_gclear:N #1 + \clist_gclear:N #3 + \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } } + { + \int_decr:N \l__hook_labels_int + \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl + \__hook_tl_gput:NV #1 \l__hook_return_tl + \__hook_clist_gput:NV #3 \l__hook_front_tl + \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} } + \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } } + { + \tl_set:cx { \__hook_tl_csname:n {##1} } + { \int_eval:n + { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 } + } + \int_compare:nNnT + { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 + { + \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} + \tl_set:Nn \l__hook_rear_tl {##1} + } + } + \tl_set_eq:Nc \l__hook_front_tl + { \__hook_tl_csname:n { \l__hook_front_tl } } + } + \int_compare:nNnF \l__hook_labels_int = 0 { \iow_term:x{====================} \iow_term:x{Error:~ label~ rules~ are~ incompatible:} \__hook_debug_label_data:N \l__hook_work_prop \iow_term:x{====================} } - \tl_gput_right:Nn #1 {#2} - \debug_resume: -} + \tl_gput_right:Nn #1 {#2} + } \cs_generate_variant:Nn \__hook_initialize_single:NNNn {ccc} \cs_new:Npn \__hook_tl_gput:NV {\ERROR} \cs_new:Npn \__hook_clist_gput:NV {\ERROR} @@ -2192,67 +2243,88 @@ } \cs_new_protected:Npn \hook_log:n #1 { - \exp_args:Nx \__hook_log:n - { \__hook_parse_label_default:nn {#1} { top-level } } + \cs_set_eq:NN \__hook_log_cmd:x \iow_log:x + \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_log:x } -\cs_new_protected:Npn \__hook_log:n #1 +\cs_new_protected:Npn \hook_show:n #1 + { + \cs_set_eq:NN \__hook_log_cmd:x \iow_term:x + \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_show:x + } +\cs_new_protected:Npn \__hook_log_line:x #1 + { \__hook_log_cmd:x { >~#1 } } +\cs_new_protected:Npn \__hook_log_line_indent:x #1 + { \__hook_log_cmd:x { >~\@spaces #1 } } +\cs_new_protected:Npn \__hook_log:nN #1 #2 { \__hook_preamble_hook:n {#1} - \iow_term:x{^^JThe~ hook~ '#1':} + \iow_term:x { ^^J ->~The~hook~'#1': } \hook_if_exist:nF {#1} - { \iow_term:x {~Hook~ is~ not~ declared!} } + { \__hook_log_line:x { is~not~declared! } } \__hook_if_exist:nTF {#1} { - \iow_term:x{~Code~ chunks:} - \prop_if_empty:cTF {g__hook_#1_code_prop} - { \iow_term:x{\@spaces ---} } + \__hook_log_line:x { Code~chunks: } + \prop_if_empty:cTF { g__hook_#1_code_prop } + { \__hook_log_line_indent:x { --- } } { - \prop_map_inline:cn {g__hook_#1_code_prop} - { \iow_term:x{\@spaces ##1~ ->~ \tl_to_str:n{##2} } } + \prop_map_inline:cn { g__hook_#1_code_prop } + { \__hook_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } } } - \iow_term:x{~Extra~ code~ next~ invocation:} - \iow_term:x{\@spaces - \tl_if_empty:cTF { g__hook_#1_code_next_tl } - {---} - {->~ \exp_args:Nv - \__hook_log_next_code:n {g__hook_#1_code_next_tl} } } - \iow_term:x { ~Rules: } + \__hook_log_line:x { Extra~code~for~next~invocation:} + \__hook_log_line_indent:x + { + \tl_if_empty:cTF { __hook_next~#1 } + { --- } + { ->~ \exp_args:Nv \__hook_log_next_code:n { __hook_next~#1 } } + } + \__hook_log_line:x { Rules: } \bool_set_true:N \l__hook_tmpa_bool \__hook_list_rules:nn {#1} { \bool_set_false:N \l__hook_tmpa_bool - \iow_term:x + \__hook_log_line_indent:x { - \@spaces ##2~ with~ + ##2~ with~ \str_if_eq:nnT {##3} {??} { default~ } - relation~ ##1 } + relation~ ##1 + } } \bool_if:NT \l__hook_tmpa_bool - { \iow_term:x { \@spaces --- } } - \bool_lazy_and:nnT + { \__hook_log_line_indent:x { --- } } + \bool_lazy_and:nnTF { \hook_if_exist_p:n {#1} } { ! \hook_if_empty_p:n {#1} } - { \iow_term:x { ~Execution~ order - \bool_if:NTF \l__hook_tmpa_bool - { \__hook_if_reversed:nT {#1} - { ~ (after~ reversal) } - } - { ~ (after~ - \__hook_if_reversed:nT {#1} {reversal~ and~} - applying~ rules) - } - : + { + \__hook_log_line:x + { + Execution~order + \bool_if:NTF \l__hook_tmpa_bool + { \__hook_if_reversed:nT {#1} { ~(after~reversal) } } + { ~(after~ + \__hook_if_reversed:nT {#1} { reversal~and~ } + applying~rules) + } : + } + #2 % \tl_show:n + { + \@spaces + \clist_if_empty:cTF { g__hook_#1_labels_clist } + { --- } + { \clist_use:cn {g__hook_#1_labels_clist} { ,~ } } + } + } + { + #2 + { + Hook~ \hook_if_exist:nTF {#1} + {code~pool~empty} {not~declared} } - \iow_term:x - { \@spaces \clist_use:cn {g__hook_#1_labels_clist} { ,~ } } } } - { \iow_term:n { ~The~hook~is~empty. } } - \iow_term:n { } + { #2 { The~hook~is~empty. } } } -\cs_new:Npn \__hook_log_next_code:n #1 { - \exp_args:No \tl_to_str:n {\use_none:nn #1} -} +\cs_new:Npn \__hook_log_next_code:n #1 + { \exp_args:No \tl_to_str:n { \use_none:nn #1 } } \cs_new_protected:Npn \__hook_list_rules:nn #1 #2 { \cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2} @@ -2297,47 +2369,56 @@ \exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } } } \cs_new_protected:Npn \hook_gput_next_code:nn #1 - { - \exp_args:Nx \__hook_gput_next_code:nn - { \__hook_parse_label_default:nn {#1} { top-level } } - } + { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} } \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2 { + \debug_suspend: \__hook_declare:n {#1} \hook_if_exist:nTF {#1} { \__hook_gput_next_do:nn {#1} {#2} } { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} } + \debug_resume: } \cs_new_protected:Npn \__hook_gput_next_do:nn #1 { \exp_args:Nc \__hook_gput_next_do:Nnn - { g__hook_#1_code_next_tl } {#1} + { __hook_next~#1 } {#1} } \cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2 { - \tl_if_empty:cT { g__hook_#2_code_tl } + \tl_if_empty:cT { __hook~#2 } { \__hook_update_hook_code:n {#2} } \tl_if_empty:NT #1 - { \tl_gset:Nn #1 { \tl_gclear:c { g__hook_#2_code_next_tl } } } + { \tl_gset:Nn #1 { \__hook_clear_next:n {#2} } } \tl_gput_right:Nn #1 } +\cs_new_protected:Npn \__hook_clear_next:n #1 + { \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl } \cs_new_protected:Npn \hook_use:n #1 { - \tl_if_exist:cTF { g__hook_#1_code_tl } + \tl_if_exist:cTF { __hook~#1 } { \__hook_preamble_hook:n {#1} - \cs:w g__hook_#1_code_tl \cs_end: + \cs:w __hook~#1 \cs_end: } { \__hook_use:wn #1 / \s__hook_mark {#1} } } \cs_new:Npn \__hook_use_initialized:n #1 { - \tl_if_exist:cTF { g__hook_#1_code_tl } - { \cs:w g__hook_#1_code_tl \cs_end: } - { \__hook_use:wn #1 / \s__hook_mark {#1} } + \if_cs_exist:w __hook~#1 \cs_end: + \else: + \__hook_use_undefined:w + \fi: + \cs:w __hook~#1 \__hook_use_end: + } +\cs_new:Npn \__hook_use_undefined:w #1 #2 __hook~#3 \__hook_use_end: + { + #1 % fi + \__hook_use:wn #3 / \s__hook_mark {#3} } \cs_new_protected:Npn \__hook_preamble_hook:n #1 { \__hook_initialize_hook_code:n {#1} } +\cs_new_eq:NN \__hook_use_end: \cs_end: \cs_new:Npn \__hook_use:wn #1 / #2 \s__hook_mark #3 { \str_if_eq:nnTF {#1} { file } @@ -2355,27 +2436,31 @@ } \cs_new_protected:Npn \__hook_if_exist_use:n #1 { - \tl_if_exist:cT { g__hook_#1_code_tl } + \tl_if_exist:cT { __hook~#1 } { \__hook_preamble_hook:n {#1} - \cs:w g__hook_#1_code_tl \cs_end: + \cs:w __hook~#1 \cs_end: } } \cs_new_protected:Npn \hook_use_once:n #1 { - \tl_if_exist:cT { g__hook_#1_code_tl } + \tl_if_exist:cT { __hook~#1 } { - \clist_gput_left:Nn \g__hook_execute_immediately_clist {#1} + \tl_set:Nn \l__hook_return_tl {#1} + \__hook_normalize_hook_args:Nn \__hook_use_once_store:n + { \l__hook_return_tl } \hook_use:n {#1} } } +\cs_new_protected:Npn \__hook_use_once_store:n #1 + { \prop_gput:Nnn \g__hook_execute_immediately_prop {#1} { } } \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF } { \__hook_if_exist:nTF {#1} { \bool_lazy_and:nnTF { \prop_if_empty_p:c { g__hook_#1_code_prop } } - { \tl_if_empty_p:c { g__hook_#1_code_next_tl } } + { \tl_if_empty_p:c { __hook_next~#1 } } { \prg_return_true: } { \prg_return_false: } } @@ -2383,7 +2468,7 @@ } \prg_new_conditional:Npnn \hook_if_exist:n #1 { p , T , F , TF } { - \tl_if_exist:cTF { g__hook_#1_code_tl } + \tl_if_exist:cTF { __hook~#1 } { \prg_return_true: } { \prg_return_false: } } @@ -2401,7 +2486,6 @@ \prg_return_false: \fi: } -\clist_new:N \g__hook_execute_immediately_clist \msg_new:nnnn { hooks } { labels-incompatible } { Labels~`#1'~and~`#2'~are~incompatible @@ -2443,11 +2527,7 @@ \NewDocumentCommand \NewReversedHook { m }{ \hook_new_reversed:n {#1} } \NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} } \NewDocumentCommand \AddToHook { m o +m } - { - \clist_if_in:NnTF \g__hook_execute_immediately_clist {#1} - {#3} - { \hook_gput_code:nnn {#1} {#2} {#3} } - } + { \hook_gput_code:nnn {#1} {#2} {#3} } \NewDocumentCommand \AddToHookNext { m +m } { \hook_gput_next_code:nn {#1} {#2} } \NewDocumentCommand \RemoveFromHook { m o } @@ -2473,9 +2553,10 @@ \seq_gpop:NN \g__hook_name_stack_seq \l__hook_return_tl \__hook_curr_name_push:n {#1} } -\newcommand \UseHook { \hook_use:n } -\newcommand \UseOneTimeHook { \hook_use_once:n } -\cs_new_protected:Npn \ShowHook { \hook_log:n } +\cs_new:Npn \UseHook { \hook_use:n } +\cs_new:Npn \UseOneTimeHook { \hook_use_once:n } +\cs_new_protected:Npn \ShowHook { \hook_show:n } +\cs_new_protected:Npn \LogHook { \hook_log:n } \cs_new_protected:Npn \DebugHooksOn { \hook_debug_on: } \cs_new_protected:Npn \DebugHooksOff { \hook_debug_off: } \NewDocumentCommand \DeclareHookRule { m m m m } @@ -3107,7 +3188,7 @@ Type H <return> for immediate help.}% \edef \@kernel@after@begindocument@before {% \let\expandafter\noexpand\csname - g__hook_env/document/begin_code_tl\endcsname + __hook env/document/begin\endcsname \noexpand\@empty} \let \@kernel@before@begindocument \@empty \let \@kernel@after@begindocument \@empty @@ -9684,9 +9765,10 @@ Type H <return> for immediate help.}% \@makeother\&% \kernel@ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}} \def\@pass@ptions#1#2#3{% - \expandafter\xdef\csname opt@#3.#1\endcsname{% - \@ifundefined{opt@#3.#1}\@empty - {\csname opt@#3.#1\endcsname,}% + \edef\reserved@a{\@expl@@@filehook@resolve@file@subst@@w #3.#1\@nil}% + \expandafter\xdef\csname opt@\reserved@a\endcsname{% + \@ifundefined{opt@\reserved@a}\@empty + {\csname opt@\reserved@a\endcsname,}% \zap@space#2 \@empty}} \@onlypreamble\@pass@ptions \def\PassOptionsToPackage{\@pass@ptions\@pkgextension} @@ -9880,7 +9962,6 @@ Type H <return> for immediate help.}% \fi \reserved@a} \@onlypreamble\@fileswith@pti@ns - \def\@onefilewithoptions#1[#2][#3]#4{% \@pushfilename \xdef\@currname{#1}% @@ -9913,6 +9994,13 @@ Type H <return> for immediate help.}% {\@expl@@@filehook@file@push@@ \set@curr@file{\@currname.\@currext}% \@filehook@set@CurrentFile + \edef\@currpkg@reqd{\@currname.\@currext}% + \ifx\CurrentFile\CurrentFileUsed + \else + \filename@parse\@curr@file + \edef\@currname{\string@makeletter\filename@base}% + \edef\@currext{\string@makeletter\filename@ext}% + \fi \load@onefile@withoptions{#2}% \@expl@@@filehook@file@pop@@}% \expandafter\@firstofone @@ -9930,7 +10018,6 @@ Type H <return> for immediate help.}% \@reset@ptions} \@onlypreamble\@onefilewithoptions \let\@unprocessedoptions\@undefined - \def\@missing@onefilewithoptions#1{% \@missingfileerror\@currname\@currext \xdef\@currname{\@missingfile@area\@missingfile@base}% @@ -9952,7 +10039,9 @@ Type H <return> for immediate help.}% \UseHook{class/before/\@currname}% \fi \fi - \InputIfFileExists{\@currname.\@currext}{}{}% + \InputIfFileExists{\@currpkg@reqd}{}% + {\@latex@error + {The \@cls@pkg\space\@currpkg@reqd\space failed to load.}\@ehd}% \expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname \@@unprocessedoptions \csname\@currname.\@currext-h@@k\endcsname @@ -9975,7 +10064,7 @@ Type H <return> for immediate help.}% \UseHook{class/after}% \fi \fi}% - \reserved@a} + \@ifl@aded\@currext\@currname{}{\reserved@a}} \let\@@fileswith@pti@ns\@fileswith@pti@ns \@onlypreamble\@@fileswith@pti@ns \def\@reset@ptions{% @@ -10376,7 +10465,7 @@ Type H <return> for immediate help.}% %% %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach, %% Phelype Oleinik & LaTeX Team -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx \providecommand\ltfilehookversion{v1.0a} \providecommand\ltfilehookdate{2020/08/30} \ExplSyntaxOn @@ -10636,8 +10725,8 @@ Type H <return> for immediate help.}% %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team %% %%% From File: ltshipout.dtx -\providecommand\ltshipoutversion{v1.0a} -\providecommand\ltshipoutdate{2020/08/31} +\providecommand\ltshipoutversion{v1.0b} +\providecommand\ltshipoutdate{2020/09/09} \ExplSyntaxOn \bool_new:N \g__shipout_debug_bool \cs_new_eq:NN \__shipout_debug:n \use_none:n @@ -10883,7 +10972,8 @@ Type H <return> for immediate help.}% \vbox_to_zero:n { \kern -\c__shipout_vorigin_tl \scan_stop: \unitlength 1pt \scan_stop: - \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim { \ignorespaces #1 } + \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim + { \ignorespaces #1 \hss } \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim \box_use:N \l__shipout_tmp_box diff --git a/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty b/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty index bb34f36cd02..a96f356e263 100644 --- a/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty +++ b/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty @@ -521,6 +521,8 @@ of this package available from CTAN} \cs_gset_eq:NN \@expl@cs@prefix@spec@@N \cs_prefix_spec:N \cs_gset_eq:NN \@expl@cs@argument@spec@@N \cs_argument_spec:N \cs_gset_eq:NN \@expl@cs@replacement@spec@@N \cs_replacement_spec:N +\cs_gset_eq:NN \@expl@str@map@function@@NN \str_map_function:NN +\cs_gset_eq:NN \@expl@char@generate@@nn \char_generate:nn \EndIncludeInRelease \IncludeInRelease{0000/00/00}{expl3~2020-10-01}% {expl3~macros~added~for~the~2020-10-01~release}% @@ -529,6 +531,7 @@ of this package available from CTAN} \cs_undefine:N \@expl@cs@prefix@spec@@N \cs_undefine:N \@expl@cs@argument@spec@@N \cs_undefine:N \@expl@cs@replacement@spec@@N +\cs_undefine:N \@expl@str@map@function@@NN \EndIncludeInRelease \ExplSyntaxOff %%% From File: ltdefns.dtx @@ -912,6 +915,28 @@ of this package available from CTAN} \expandafter\@secondoftwo \fi} \EndIncludeInRelease +\IncludeInRelease{2020/10/01}{\string@makeletter} + {Add \string@makeletter}% +\def\string@makeletter#1{% + \@expl@str@map@function@@NN#1\@string@makeletter} +\def\@string@makeletter#1{% + \char@if@alph{#1}% + {\@expl@char@generate@@nn{`#1}{11}}% + {#1}} +\def\char@if@alph#1{% + \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi + \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0 + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}{\string@makeletter} + {Undefine \string@makeletter}% +\let\string@makeletter\@undefined +\let\@string@makeletter\@undefined +\let\char@if@alph\@undefined +\EndIncludeInRelease \IncludeInRelease{2020/10/01}{\-}{Use primitive \- in Lua\LaTeX}% \ifx\directlua\@undefined \DeclareRobustCommand{\-}{% @@ -987,7 +1012,7 @@ of this package available from CTAN} %% Phelype Oleinik & LaTeX Team %%% From File: lthooks.dtx \def\lthooksversion{v1.0a} -\def\lthooksdate{2020/08/31} +\def\lthooksdate{2020/09/10} \IncludeInRelease{2020/10/01}% {\NewHook}{The hook management}% \ExplSyntaxOn @@ -1017,42 +1042,47 @@ of this package available from CTAN} \tl_new:N \g__hook_removal_list_tl \tl_new:N \l__hook_cur_hook_tl \prop_new:N \l__hook_work_prop +\prop_new:N \g__hook_execute_immediately_prop +\prop_new:N \g__hook_used_prop \tl_new:N \g__hook_hook_curr_name_tl \seq_new:N \g__hook_name_stack_seq \cs_new_eq:NN \__hook_tmp:w ? \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx } +\cs_generate_variant:Nn \tl_show:n { x } +\cs_generate_variant:Nn \tl_log:n { x } \scan_new:N \s__hook_mark \cs_new_protected:Npn \hook_new:n #1 + { \__hook_normalize_hook_args:Nn \__hook_new:n {#1} } +\cs_new_protected:Npn \__hook_new:n #1 { - \exp_args:Nx \__hook_new:n - { \__hook_parse_label_default:nn {#1} { top-level } } - } -\cs_new_protected:Npn \__hook_new:n #1 { - \hook_if_exist:nTF {#1} - { \msg_error:nnn { hooks } { exists } {#1} } - { \seq_gput_right:Nn \g__hook_all_seq {#1} - \tl_new:c { g__hook_#1_code_tl } - \__hook_declare:n {#1} - \clist_new:c {g__hook_#1_labels_clist} - \tl_new:c { g__hook_#1_reversed_tl } - \__hook_include_legacy_code_chunk:n {#1} + \hook_if_exist:nTF {#1} + { \msg_error:nnn { hooks } { exists } {#1} } + { + \seq_gput_right:Nn \g__hook_all_seq {#1} + \tl_new:c { __hook~#1 } + \__hook_declare:n {#1} + \clist_new:c {g__hook_#1_labels_clist} + \tl_new:c { g__hook_#1_reversed_tl } + \__hook_include_legacy_code_chunk:n {#1} } -} + } \cs_new_protected:Npn \__hook_declare:n #1 { \__hook_if_exist:nF {#1} { \prop_new:c { g__hook_#1_code_prop } - \tl_new:c { g__hook_#1_code_next_tl } + \tl_new:c { __hook_next~#1 } } } -\cs_new_protected:Npn \hook_new_reversed:n #1 { - \hook_new:n {#1} - \tl_gset:cn { g__hook_#1_reversed_tl } { - } -} -\cs_new_protected:Npn \hook_new_pair:nn #1#2 { - \hook_new:n {#1} \hook_new_reversed:n {#2} -} +\cs_new_protected:Npn \hook_new_reversed:n #1 + { \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} } +\cs_new_protected:Npn \__hook_new_reversed:n #1 + { + \__hook_new:n {#1} + \tl_gset:cn { g__hook_#1_reversed_tl } { - } + } +\cs_new_protected:Npn \hook_new_pair:nn #1#2 + { \hook_new:n {#1} \hook_new_reversed:n {#2} } \cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1 { \debug_suspend: @@ -1067,13 +1097,15 @@ of this package available from CTAN} } \debug_resume: } -\cs_new:Npn \__hook_parse_label_default:nn #1 #2 +\cs_new:Npn \__hook_parse_label_default:n #1 { \tl_if_novalue:nTF {#1} - { \__hook_currname_or_default:n {#2} } - { \tl_trim_spaces_apply:nN {#1} \__hook_parse_dot_label:nn {#2} } + { \__hook_currname_or_default:n { top-level } } + { + \tl_trim_spaces_apply:nN {#1} + \__hook_parse_dot_label:nn { top-level } + } } -\cs_generate_variant:Nn \__hook_parse_label_default:nn { V } \cs_new:Npn \__hook_parse_dot_label:nn #1 #2 { \tl_if_empty:nTF {#1} @@ -1083,7 +1115,7 @@ of this package available from CTAN} } { \str_if_eq:nnTF {#1} { . } - { \__hook_currname_or_default:n {#1} } + { \__hook_currname_or_default:n {#2} } { \__hook_parse_dot_label:nw {#2} #1 ./ \s__hook_mark } } } @@ -1093,40 +1125,79 @@ of this package available from CTAN} { \__hook_parse_dot_label_aux:nw {#1} #3 \s__hook_mark } { \tl_if_empty:nTF {#3} - {#2} + { \__hook_make_name:n {#2} } { \__hook_parse_dot_label_cleanup:w #2 ./ #3 \s__hook_mark } } } \cs_new:Npn \__hook_parse_dot_label_cleanup:w #1 ./ \s__hook_mark {#1} \cs_new:Npn \__hook_parse_dot_label_aux:nw #1 #2 ./ \s__hook_mark - { \__hook_currname_or_default:n {#1} / #2 } + { \__hook_currname_or_default:n {#1} / \__hook_make_name:n {#2} } \cs_new:Npn \__hook_currname_or_default:n #1 { \tl_if_empty:NTF \g__hook_hook_curr_name_tl { \tl_if_empty:NTF \@currname - {#1} + { \__hook_make_name:n {#1} } { \@currname } } { \g__hook_hook_curr_name_tl } } -\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 +\cs_new:Npn \__hook_make_name:n #1 + { + \exp_after:wN \exp_after:wN \exp_after:wN \__hook_make_name:w + \exp_after:wN \token_to_str:N \cs:w __hook~ #1 \cs_end: + } +\exp_last_unbraced:NNNNo +\cs_new:Npn \__hook_make_name:w #1 \tl_to_str:n { __hook~ } { } +\cs_new_protected:Npn \__hook_normalize_hook_args_aux:Nn #1 #2 { - \exp_args:Nxx \__hook_gput_code:nnn - { \__hook_parse_label_default:nn {#1} { top-level } } - { \__hook_parse_label_default:nn {#2} { top-level } } + \group_begin: + \use:e + { + \group_end: + \exp_not:N #1 #2 + } } +\cs_new_protected:Npn \__hook_normalize_hook_args:Nn #1 #2 + { + \__hook_normalize_hook_args_aux:Nn #1 + { { \__hook_parse_label_default:n {#2} } } + } +\cs_new_protected:Npn \__hook_normalize_hook_args:Nnn #1 #2 #3 + { + \__hook_normalize_hook_args_aux:Nn #1 + { + { \__hook_parse_label_default:n {#2} } + { \__hook_parse_label_default:n {#3} } + } + } +\cs_new_protected:Npn \__hook_normalize_hook_rule_args:Nnnnn #1 #2 #3 #4 #5 + { + \__hook_normalize_hook_args_aux:Nn #1 + { + { \__hook_parse_label_default:n {#2} } + { \__hook_parse_label_default:n {#3} } + { \tl_trim_spaces:n {#4} } + { \__hook_parse_label_default:n {#5} } + } + } +\cs_new_protected:Npn \hook_gput_code:nnn #1 #2 + { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} } \cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3 { - \__hook_if_marked_removal:nnTF {#1} {#2} - { \__hook_unmark_removal:nn {#1} {#2} } + \prop_if_in:NnTF \g__hook_execute_immediately_prop {#1} + {#3} { - \hook_if_exist:nTF {#1} + \__hook_if_marked_removal:nnTF {#1} {#2} + { \__hook_unmark_removal:nn {#1} {#2} } { - \__hook_hook_gput_code_do:nnn {#1} {#2} {#3} - \__hook_update_hook_code:n {#1} + \hook_if_exist:nTF {#1} + { + \__hook_hook_gput_code_do:nnn {#1} {#2} {#3} + \__hook_update_hook_code:n {#1} + } + { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} } } - { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} } } } \cs_generate_variant:Nn \__hook_gput_code:nnn { nxv } @@ -1226,11 +1297,7 @@ of this package available from CTAN} \prop_const_from_keyval:Nn \c__hook_generics_reversed_iii_prop {after=} \prop_const_from_keyval:Nn \c__hook_generics_file_prop {before=,after=} \cs_new_protected:Npn \hook_gremove_code:nn #1 #2 - { - \exp_args:Nxx \__hook_gremove_code:nn - { \__hook_parse_label_default:nn {#1} { top-level } } - { \__hook_parse_label_default:nn {#2} { top-level } } - } + { \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} } \cs_new_protected:Npn \__hook_gremove_code:nn #1 #2 { \__hook_if_exist:nTF {#1} @@ -1269,18 +1336,12 @@ of this package available from CTAN} \cs_new:Npn \__hook_removal_tl:nn #1 #2 { & \tl_to_str:n {#2} $ \tl_to_str:n {#1} $ } \prop_new:c {g__hook_??_code_prop} -\prop_new:c {g__hook_??_code_tl} +\prop_new:c {__hook~??} \tl_new:c {g__hook_??_reversed_tl} \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4 { - \use:x - { - \__hook_gset_rule:nnnn - { \__hook_parse_label_default:nn {#1} { top-level } } - { \__hook_parse_label_default:nn {#2} { top-level } } - {#3} - { \__hook_parse_label_default:nn {#4} { top-level } } - } + \__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn + {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \__hook_gset_rule:nnnn #1#2#3#4 { @@ -1355,37 +1416,39 @@ of this package available from CTAN} { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:} \prop_map_inline:Nn \g__hook_used_prop { \iow_term:x{^^J~ ##1~ ->~ - \exp_not:v {g__hook_##1_code_tl}~ } + \exp_not:v {__hook~##1}~ } } } \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n } -\cs_new_protected:Npn \__hook_initialize_hook_code:n #1 { - \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~ - '#1' \on@line :^^J} } - \__hook_include_legacy_code_chunk:n {#1} - \hook_if_exist:nT {#1} - { - \prop_if_empty:cTF {g__hook_#1_code_prop} - { \tl_gset:co {g__hook_#1_code_tl} - {\cs:w g__hook_#1_code_next_tl \cs_end: } } - { - \__hook_if_reversed:nTF {#1} - { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_left:NV - \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV } - { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_right:NV - \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV } - \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop } - \__hook_initialize_single:cccn - { g__hook_#1_code_tl } { g__hook_#1_code_next_tl } - { g__hook_#1_labels_clist } {#1} - \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn - \g__hook_used_prop {#1}{} } - } - } -} -\prop_new:N\g__hook_used_prop +\cs_new_protected:Npn \__hook_initialize_hook_code:n #1 + { + \debug_suspend: + \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~ + '#1' \on@line :^^J} } + \__hook_include_legacy_code_chunk:n {#1} + \hook_if_exist:nT {#1} + { + \prop_if_empty:cTF {g__hook_#1_code_prop} + { \tl_gset:co { __hook~#1 } + { \cs:w __hook_next~#1 \cs_end: } } + { + \__hook_if_reversed:nTF {#1} + { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_left:NV + \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV } + { \cs_set_eq:NN \__hook_tl_gput:NV \tl_gput_right:NV + \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV } + \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop } + \__hook_initialize_single:cccn + { __hook~#1 } { __hook_next~#1 } + { g__hook_#1_labels_clist } {#1} + \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn + \g__hook_used_prop {#1}{} } + } + } + \debug_resume: + } \cs_new:Npn \__hook_tl_csname:n #1 { l__hook_label_#1_tl } \cs_new:Npn \__hook_seq_csname:n #1 { l__hook_label_#1_seq } \seq_new:N \l__hook_labels_seq @@ -1393,33 +1456,33 @@ of this package available from CTAN} \tl_new:N \l__hook_front_tl \tl_new:N \l__hook_rear_tl \tl_new:c { \__hook_tl_csname:n { 0 } } -\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4 { - \debug_suspend: - \seq_clear:N \l__hook_labels_seq - \int_zero:N \l__hook_labels_int - \tl_set:Nn \l__hook_cur_hook_tl {#4} - \prop_map_inline:Nn \l__hook_work_prop - { - \int_incr:N \l__hook_labels_int - \seq_put_right:Nn \l__hook_labels_seq {##1} - \tl_set:cn { \__hook_tl_csname:n {##1} }{0} - \seq_clear_new:c { \__hook_seq_csname:n {##1} } - } - \prop_map_inline:Nn \l__hook_work_prop - { - \prop_map_inline:Nn \l__hook_work_prop - { - \__hook_if_label_case:nnnnn {##1} {####1} - { \prop_map_break: } - { \__hook_apply_label_pair:nnn {##1} {####1} } - { \__hook_apply_label_pair:nnn {####1} {##1} } - {#4} - } - } - \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop } - \tl_set:Nn \l__hook_rear_tl { 0 } - \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 } - \seq_map_inline:Nn \l__hook_labels_seq +\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4 + { + \seq_clear:N \l__hook_labels_seq + \int_zero:N \l__hook_labels_int + \tl_set:Nn \l__hook_cur_hook_tl {#4} + \prop_map_inline:Nn \l__hook_work_prop + { + \int_incr:N \l__hook_labels_int + \seq_put_right:Nn \l__hook_labels_seq {##1} + \tl_set:cn { \__hook_tl_csname:n {##1} }{0} + \seq_clear_new:c { \__hook_seq_csname:n {##1} } + } + \prop_map_inline:Nn \l__hook_work_prop + { + \prop_map_inline:Nn \l__hook_work_prop + { + \__hook_if_label_case:nnnnn {##1} {####1} + { \prop_map_break: } + { \__hook_apply_label_pair:nnn {##1} {####1} } + { \__hook_apply_label_pair:nnn {####1} {##1} } + {#4} + } + } + \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop } + \tl_set:Nn \l__hook_rear_tl { 0 } + \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 } + \seq_map_inline:Nn \l__hook_labels_seq { \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 { @@ -1427,42 +1490,41 @@ of this package available from CTAN} \tl_set:Nn \l__hook_rear_tl {##1} } } - \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } } - \tl_gclear:N #1 - \clist_gclear:N #3 - \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } } - { - \int_decr:N \l__hook_labels_int - \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl - \__hook_tl_gput:NV #1 \l__hook_return_tl - \__hook_clist_gput:NV #3 \l__hook_front_tl - \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} } - \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } } - { - \tl_set:cx { \__hook_tl_csname:n {##1} } - { \int_eval:n - { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 } - } - \int_compare:nNnT - { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 - { - \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} - \tl_set:Nn \l__hook_rear_tl {##1} - } - } - \tl_set_eq:Nc \l__hook_front_tl - { \__hook_tl_csname:n { \l__hook_front_tl } } - } - \int_compare:nNnF \l__hook_labels_int = 0 + \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } } + \tl_gclear:N #1 + \clist_gclear:N #3 + \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } } + { + \int_decr:N \l__hook_labels_int + \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl + \__hook_tl_gput:NV #1 \l__hook_return_tl + \__hook_clist_gput:NV #3 \l__hook_front_tl + \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} } + \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } } + { + \tl_set:cx { \__hook_tl_csname:n {##1} } + { \int_eval:n + { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 } + } + \int_compare:nNnT + { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0 + { + \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1} + \tl_set:Nn \l__hook_rear_tl {##1} + } + } + \tl_set_eq:Nc \l__hook_front_tl + { \__hook_tl_csname:n { \l__hook_front_tl } } + } + \int_compare:nNnF \l__hook_labels_int = 0 { \iow_term:x{====================} \iow_term:x{Error:~ label~ rules~ are~ incompatible:} \__hook_debug_label_data:N \l__hook_work_prop \iow_term:x{====================} } - \tl_gput_right:Nn #1 {#2} - \debug_resume: -} + \tl_gput_right:Nn #1 {#2} + } \cs_generate_variant:Nn \__hook_initialize_single:NNNn {ccc} \cs_new:Npn \__hook_tl_gput:NV {\ERROR} \cs_new:Npn \__hook_clist_gput:NV {\ERROR} @@ -1566,67 +1628,88 @@ of this package available from CTAN} } \cs_new_protected:Npn \hook_log:n #1 { - \exp_args:Nx \__hook_log:n - { \__hook_parse_label_default:nn {#1} { top-level } } + \cs_set_eq:NN \__hook_log_cmd:x \iow_log:x + \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_log:x } -\cs_new_protected:Npn \__hook_log:n #1 +\cs_new_protected:Npn \hook_show:n #1 + { + \cs_set_eq:NN \__hook_log_cmd:x \iow_term:x + \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_show:x + } +\cs_new_protected:Npn \__hook_log_line:x #1 + { \__hook_log_cmd:x { >~#1 } } +\cs_new_protected:Npn \__hook_log_line_indent:x #1 + { \__hook_log_cmd:x { >~\@spaces #1 } } +\cs_new_protected:Npn \__hook_log:nN #1 #2 { \__hook_preamble_hook:n {#1} - \iow_term:x{^^JThe~ hook~ '#1':} + \iow_term:x { ^^J ->~The~hook~'#1': } \hook_if_exist:nF {#1} - { \iow_term:x {~Hook~ is~ not~ declared!} } + { \__hook_log_line:x { is~not~declared! } } \__hook_if_exist:nTF {#1} { - \iow_term:x{~Code~ chunks:} - \prop_if_empty:cTF {g__hook_#1_code_prop} - { \iow_term:x{\@spaces ---} } + \__hook_log_line:x { Code~chunks: } + \prop_if_empty:cTF { g__hook_#1_code_prop } + { \__hook_log_line_indent:x { --- } } + { + \prop_map_inline:cn { g__hook_#1_code_prop } + { \__hook_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } } + } + \__hook_log_line:x { Extra~code~for~next~invocation:} + \__hook_log_line_indent:x { - \prop_map_inline:cn {g__hook_#1_code_prop} - { \iow_term:x{\@spaces ##1~ ->~ \tl_to_str:n{##2} } } + \tl_if_empty:cTF { __hook_next~#1 } + { --- } + { ->~ \exp_args:Nv \__hook_log_next_code:n { __hook_next~#1 } } } - \iow_term:x{~Extra~ code~ next~ invocation:} - \iow_term:x{\@spaces - \tl_if_empty:cTF { g__hook_#1_code_next_tl } - {---} - {->~ \exp_args:Nv - \__hook_log_next_code:n {g__hook_#1_code_next_tl} } } - \iow_term:x { ~Rules: } + \__hook_log_line:x { Rules: } \bool_set_true:N \l__hook_tmpa_bool \__hook_list_rules:nn {#1} { \bool_set_false:N \l__hook_tmpa_bool - \iow_term:x + \__hook_log_line_indent:x { - \@spaces ##2~ with~ + ##2~ with~ \str_if_eq:nnT {##3} {??} { default~ } - relation~ ##1 } + relation~ ##1 + } } \bool_if:NT \l__hook_tmpa_bool - { \iow_term:x { \@spaces --- } } - \bool_lazy_and:nnT + { \__hook_log_line_indent:x { --- } } + \bool_lazy_and:nnTF { \hook_if_exist_p:n {#1} } { ! \hook_if_empty_p:n {#1} } - { \iow_term:x { ~Execution~ order - \bool_if:NTF \l__hook_tmpa_bool - { \__hook_if_reversed:nT {#1} - { ~ (after~ reversal) } - } - { ~ (after~ - \__hook_if_reversed:nT {#1} {reversal~ and~} - applying~ rules) - } - : + { + \__hook_log_line:x + { + Execution~order + \bool_if:NTF \l__hook_tmpa_bool + { \__hook_if_reversed:nT {#1} { ~(after~reversal) } } + { ~(after~ + \__hook_if_reversed:nT {#1} { reversal~and~ } + applying~rules) + } : + } + #2 % \tl_show:n + { + \@spaces + \clist_if_empty:cTF { g__hook_#1_labels_clist } + { --- } + { \clist_use:cn {g__hook_#1_labels_clist} { ,~ } } + } + } + { + #2 + { + Hook~ \hook_if_exist:nTF {#1} + {code~pool~empty} {not~declared} } - \iow_term:x - { \@spaces \clist_use:cn {g__hook_#1_labels_clist} { ,~ } } } } - { \iow_term:n { ~The~hook~is~empty. } } - \iow_term:n { } + { #2 { The~hook~is~empty. } } } -\cs_new:Npn \__hook_log_next_code:n #1 { - \exp_args:No \tl_to_str:n {\use_none:nn #1} -} +\cs_new:Npn \__hook_log_next_code:n #1 + { \exp_args:No \tl_to_str:n { \use_none:nn #1 } } \cs_new_protected:Npn \__hook_list_rules:nn #1 #2 { \cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2} @@ -1671,47 +1754,56 @@ of this package available from CTAN} \exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } } } \cs_new_protected:Npn \hook_gput_next_code:nn #1 - { - \exp_args:Nx \__hook_gput_next_code:nn - { \__hook_parse_label_default:nn {#1} { top-level } } - } + { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} } \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2 { + \debug_suspend: \__hook_declare:n {#1} \hook_if_exist:nTF {#1} { \__hook_gput_next_do:nn {#1} {#2} } { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} } + \debug_resume: } \cs_new_protected:Npn \__hook_gput_next_do:nn #1 { \exp_args:Nc \__hook_gput_next_do:Nnn - { g__hook_#1_code_next_tl } {#1} + { __hook_next~#1 } {#1} } \cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2 { - \tl_if_empty:cT { g__hook_#2_code_tl } + \tl_if_empty:cT { __hook~#2 } { \__hook_update_hook_code:n {#2} } \tl_if_empty:NT #1 - { \tl_gset:Nn #1 { \tl_gclear:c { g__hook_#2_code_next_tl } } } + { \tl_gset:Nn #1 { \__hook_clear_next:n {#2} } } \tl_gput_right:Nn #1 } +\cs_new_protected:Npn \__hook_clear_next:n #1 + { \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl } \cs_new_protected:Npn \hook_use:n #1 { - \tl_if_exist:cTF { g__hook_#1_code_tl } + \tl_if_exist:cTF { __hook~#1 } { \__hook_preamble_hook:n {#1} - \cs:w g__hook_#1_code_tl \cs_end: + \cs:w __hook~#1 \cs_end: } { \__hook_use:wn #1 / \s__hook_mark {#1} } } \cs_new:Npn \__hook_use_initialized:n #1 { - \tl_if_exist:cTF { g__hook_#1_code_tl } - { \cs:w g__hook_#1_code_tl \cs_end: } - { \__hook_use:wn #1 / \s__hook_mark {#1} } + \if_cs_exist:w __hook~#1 \cs_end: + \else: + \__hook_use_undefined:w + \fi: + \cs:w __hook~#1 \__hook_use_end: + } +\cs_new:Npn \__hook_use_undefined:w #1 #2 __hook~#3 \__hook_use_end: + { + #1 % fi + \__hook_use:wn #3 / \s__hook_mark {#3} } \cs_new_protected:Npn \__hook_preamble_hook:n #1 { \__hook_initialize_hook_code:n {#1} } +\cs_new_eq:NN \__hook_use_end: \cs_end: \cs_new:Npn \__hook_use:wn #1 / #2 \s__hook_mark #3 { \str_if_eq:nnTF {#1} { file } @@ -1729,27 +1821,31 @@ of this package available from CTAN} } \cs_new_protected:Npn \__hook_if_exist_use:n #1 { - \tl_if_exist:cT { g__hook_#1_code_tl } + \tl_if_exist:cT { __hook~#1 } { \__hook_preamble_hook:n {#1} - \cs:w g__hook_#1_code_tl \cs_end: + \cs:w __hook~#1 \cs_end: } } \cs_new_protected:Npn \hook_use_once:n #1 { - \tl_if_exist:cT { g__hook_#1_code_tl } + \tl_if_exist:cT { __hook~#1 } { - \clist_gput_left:Nn \g__hook_execute_immediately_clist {#1} + \tl_set:Nn \l__hook_return_tl {#1} + \__hook_normalize_hook_args:Nn \__hook_use_once_store:n + { \l__hook_return_tl } \hook_use:n {#1} } } +\cs_new_protected:Npn \__hook_use_once_store:n #1 + { \prop_gput:Nnn \g__hook_execute_immediately_prop {#1} { } } \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF } { \__hook_if_exist:nTF {#1} { \bool_lazy_and:nnTF { \prop_if_empty_p:c { g__hook_#1_code_prop } } - { \tl_if_empty_p:c { g__hook_#1_code_next_tl } } + { \tl_if_empty_p:c { __hook_next~#1 } } { \prg_return_true: } { \prg_return_false: } } @@ -1757,7 +1853,7 @@ of this package available from CTAN} } \prg_new_conditional:Npnn \hook_if_exist:n #1 { p , T , F , TF } { - \tl_if_exist:cTF { g__hook_#1_code_tl } + \tl_if_exist:cTF { __hook~#1 } { \prg_return_true: } { \prg_return_false: } } @@ -1775,7 +1871,6 @@ of this package available from CTAN} \prg_return_false: \fi: } -\clist_new:N \g__hook_execute_immediately_clist \msg_new:nnnn { hooks } { labels-incompatible } { Labels~`#1'~and~`#2'~are~incompatible @@ -1817,11 +1912,7 @@ of this package available from CTAN} \NewDocumentCommand \NewReversedHook { m }{ \hook_new_reversed:n {#1} } \NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} } \NewDocumentCommand \AddToHook { m o +m } - { - \clist_if_in:NnTF \g__hook_execute_immediately_clist {#1} - {#3} - { \hook_gput_code:nnn {#1} {#2} {#3} } - } + { \hook_gput_code:nnn {#1} {#2} {#3} } \NewDocumentCommand \AddToHookNext { m +m } { \hook_gput_next_code:nn {#1} {#2} } \NewDocumentCommand \RemoveFromHook { m o } @@ -1847,9 +1938,10 @@ of this package available from CTAN} \seq_gpop:NN \g__hook_name_stack_seq \l__hook_return_tl \__hook_curr_name_push:n {#1} } -\newcommand \UseHook { \hook_use:n } -\newcommand \UseOneTimeHook { \hook_use_once:n } -\cs_new_protected:Npn \ShowHook { \hook_log:n } +\cs_new:Npn \UseHook { \hook_use:n } +\cs_new:Npn \UseOneTimeHook { \hook_use_once:n } +\cs_new_protected:Npn \ShowHook { \hook_show:n } +\cs_new_protected:Npn \LogHook { \hook_log:n } \cs_new_protected:Npn \DebugHooksOn { \hook_debug_on: } \cs_new_protected:Npn \DebugHooksOff { \hook_debug_off: } \NewDocumentCommand \DeclareHookRule { m m m m } @@ -3018,7 +3110,7 @@ of this package available from CTAN} \edef \@kernel@after@begindocument@before {% \let\expandafter\noexpand\csname - g__hook_env/document/begin_code_tl\endcsname + __hook env/document/begin\endcsname \noexpand\@empty} \let \@kernel@before@begindocument \@empty \let \@kernel@after@begindocument \@empty @@ -3956,7 +4048,7 @@ of this package available from CTAN} %% %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach, %% Phelype Oleinik & LaTeX Team -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx \providecommand\ltfilehookversion{v1.0a} \providecommand\ltfilehookdate{2020/08/30} \IncludeInRelease{2020/10/01}% @@ -4305,8 +4397,8 @@ of this package available from CTAN} %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team %% %%% From File: ltshipout.dtx -\providecommand\ltshipoutversion{v1.0a} -\providecommand\ltshipoutdate{2020/08/31} +\providecommand\ltshipoutversion{v1.0b} +\providecommand\ltshipoutdate{2020/09/09} \IncludeInRelease{2020/10/01}% {\shipout}{Hook mangement (shipout)}% \ExplSyntaxOn @@ -4554,7 +4646,8 @@ of this package available from CTAN} \vbox_to_zero:n { \kern -\c__shipout_vorigin_tl \scan_stop: \unitlength 1pt \scan_stop: - \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim { \ignorespaces #1 } + \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim + { \ignorespaces #1 \hss } \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim \box_use:N \l__shipout_tmp_box @@ -5625,6 +5718,23 @@ of this package available from CTAN} \let\protected@wlog\@undefined \EndIncludeInRelease +\IncludeInRelease{2020/10/01}{\@pass@ptions} + {Add file replacement in \@pass@ptions}% +\def\@pass@ptions#1#2#3{% + \edef\reserved@a{\@expl@@@filehook@resolve@file@subst@@w #3.#1\@nil}% + \expandafter\xdef\csname opt@\reserved@a\endcsname{% + \@ifundefined{opt@\reserved@a}\@empty + {\csname opt@\reserved@a\endcsname,}% + \zap@space#2 \@empty}} +\EndIncludeInRelease +\IncludeInRelease{0000/00/00}{\@pass@ptions} + {\@pass@ptions}% +\def\@pass@ptions#1#2#3{% + \expandafter\xdef\csname opt@#3.#1\endcsname{% + \@ifundefined{opt@#3.#1}\@empty + {\csname opt@#3.#1\endcsname,}% + \zap@space#2 \@empty}} +\EndIncludeInRelease \IncludeInRelease{2020/10/01}% {\@process@pti@ns}{Unused options issue}% \def\@process@pti@ns{% @@ -5781,6 +5891,13 @@ of this package available from CTAN} {\@expl@@@filehook@file@push@@ \set@curr@file{\@currname.\@currext}% \@filehook@set@CurrentFile + \edef\@currpkg@reqd{\@currname.\@currext}% + \ifx\CurrentFile\CurrentFileUsed + \else + \filename@parse\@curr@file + \edef\@currname{\string@makeletter\filename@base}% + \edef\@currext{\string@makeletter\filename@ext}% + \fi \load@onefile@withoptions{#2}% \@expl@@@filehook@file@pop@@}% \expandafter\@firstofone @@ -5798,7 +5915,6 @@ of this package available from CTAN} \@reset@ptions} \@onlypreamble\@onefilewithoptions \let\@unprocessedoptions\@undefined - \def\@missing@onefilewithoptions#1{% \@missingfileerror\@currname\@currext \xdef\@currname{\@missingfile@area\@missingfile@base}% @@ -5820,7 +5936,9 @@ of this package available from CTAN} \UseHook{class/before/\@currname}% \fi \fi - \InputIfFileExists{\@currname.\@currext}{}{}% + \InputIfFileExists{\@currpkg@reqd}{}% + {\@latex@error + {The \@cls@pkg\space\@currpkg@reqd\space failed to load.}\@ehd}% \expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname \@@unprocessedoptions \csname\@currname.\@currext-h@@k\endcsname @@ -5843,7 +5961,7 @@ of this package available from CTAN} \UseHook{class/after}% \fi \fi}% - \reserved@a} + \@ifl@aded\@currext\@currname{}{\reserved@a}} \EndIncludeInRelease \IncludeInRelease{0000/00/00}% {\@onefilewithoptions}{Hooks and unused options issue}% @@ -10264,6 +10382,8 @@ of this package available from CTAN} \cs_gset_eq:NN \@expl@cs@prefix@spec@@N \cs_prefix_spec:N \cs_gset_eq:NN \@expl@cs@argument@spec@@N \cs_argument_spec:N \cs_gset_eq:NN \@expl@cs@replacement@spec@@N \cs_replacement_spec:N +\cs_gset_eq:NN \@expl@str@map@function@@NN \str_map_function:NN +\cs_gset_eq:NN \@expl@char@generate@@nn \char_generate:nn \EndIncludeInRelease \IncludeInRelease{0000/00/00}{expl3~2020-10-01}% {expl3~macros~added~for~the~2020-10-01~release}% @@ -10272,6 +10392,7 @@ of this package available from CTAN} \cs_undefine:N \@expl@cs@prefix@spec@@N \cs_undefine:N \@expl@cs@argument@spec@@N \cs_undefine:N \@expl@cs@replacement@spec@@N +\cs_undefine:N \@expl@str@map@function@@NN \EndIncludeInRelease \ExplSyntaxOff %%% From File: ltfinal.dtx diff --git a/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty b/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty index 4c07a63305a..3643c55af23 100644 --- a/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty +++ b/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty @@ -44,7 +44,7 @@ %% %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach, %% Phelype Oleinik & LaTeX Team -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx \providecommand\ltfilehookversion{v1.0a} \providecommand\ltfilehookdate{2020/08/30} \newcommand\BeforeClass[2] diff --git a/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty b/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty index 2f625adbbc3..58fc086af8d 100644 --- a/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty +++ b/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty @@ -44,7 +44,7 @@ %% %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach, %% Phelype Oleinik & LaTeX Team -%%% From File: ltshipout.dtx +%%% From File: ltfilehook.dtx \providecommand\ltfilehookversion{v1.0a} \providecommand\ltfilehookdate{2020/08/30} \ProvidesExplPackage @@ -62,7 +62,7 @@ ( LEVEL ~ \int_use:N \g__filehook_nesting_level_int \c_space_tl #1 ) ~ \CurrentFileUsed \str_if_eq:NNF \CurrentFileUsed \CurrentFile - { ~ ( \CurrentFile \space requested ) } + { ~ ( \CurrentFile \c_space_tl requested ) } \iow_newline: } \str_if_eq:nnT {#1} {STOP} { \int_gdecr:N \g__filehook_nesting_level_int } |