summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltfilehook.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/base/ltfilehook.dtx')
-rw-r--r--macros/latex-dev/base/ltfilehook.dtx73
1 files changed, 60 insertions, 13 deletions
diff --git a/macros/latex-dev/base/ltfilehook.dtx b/macros/latex-dev/base/ltfilehook.dtx
index b5b5de629a..85c758ae60 100644
--- a/macros/latex-dev/base/ltfilehook.dtx
+++ b/macros/latex-dev/base/ltfilehook.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
-%%
-%% File: ltfilehook.dtx (C) Copyright 2020,2021 Frank Mittelbach,
-%% Phelype Oleinik & LaTeX Team
+%
+% Copyright (C) 2020-2021
+% Frank Mittelbach, Phelype Oleinik & LaTeX Team
%
% This file is part of the LaTeX base system.
% -------------------------------------------
@@ -31,8 +31,8 @@
%%% From File: ltfilehook.dtx
%
% \begin{macrocode}
-\providecommand\ltfilehookversion{v1.0e}
-\providecommand\ltfilehookdate{2021/01/07}
+\providecommand\ltfilehookversion{v1.0g}
+\providecommand\ltfilehookdate{2021/02/08}
% \end{macrocode}
%
%<*driver>
@@ -55,6 +55,10 @@
}
\ExplSyntaxOff
+\providecommand\InternalDetectionOff{}
+\providecommand\InternalDetectionOn{}
+
+
\usepackage{structuredlog} % for demonstration
\EnableCrossrefs
@@ -622,6 +626,7 @@
% When rolling forward the following expl3 functions may not be defined.
% If we roll back the code does nothing.
% \changes{v1.0d}{2020/11/24}{Support for roll forward (gh/434)}
+% \InternalDetectionOff
% \begin{macrocode}
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\file_parse_full_name_apply:nN}{Roll forward help}%
@@ -643,7 +648,8 @@
%<latexrelease> {
%<latexrelease> \tl_if_empty:nTF {#3}
%<latexrelease> { \__file_parse_full_name_base:nw { } #2 . \s__file_stop {#1} }
-%<latexrelease> { \__file_parse_full_name_area:nw { #1 / #2 } #3 \s__file_stop }
+%<latexrelease> { \__file_parse_full_name_area:nw { #1 / #2 }
+%<latexrelease> #3 \s__file_stop }
%<latexrelease> }
%<latexrelease>\cs_new:Npn \__file_parse_full_name_base:nw #1 #2 . #3 \s__file_stop
%<latexrelease> {
@@ -657,7 +663,8 @@
%<latexrelease> }
%<latexrelease> { \__file_parse_full_name_tidy:nnnN {#1} { .#2 } }
%<latexrelease> }
-%<latexrelease> { \__file_parse_full_name_base:nw { #1 . #2 } #3 \s__file_stop }
+%<latexrelease> { \__file_parse_full_name_base:nw { #1 . #2 }
+%<latexrelease> #3 \s__file_stop }
%<latexrelease> }
%<latexrelease>\cs_new:Npn \__file_parse_full_name_tidy:nnnN #1 #2 #3 #4
%<latexrelease> {
@@ -675,6 +682,7 @@
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
+% \InternalDetectionOn
%
% \begin{macrocode}
%<@@=>
@@ -847,6 +855,17 @@
%<latexrelease>\long\def \InputIfFileExists#1#2{%
%<latexrelease> \IfFileExists{#1}%
%<latexrelease> {#2\@addtofilelist{#1}\@@input \@filef@und}}
+% \end{macrocode}
+%
+% Also undo the internal command as some packages unfortunately test
+% for their existence instead of using \cs{IfFormatAtLeastTF}.
+% \changes{v1.0g}{2021/02/08}{Undo the internal for robust
+% \cs{InputIfFileExists} in rollback (gh/494)}
+% \begin{macrocode}
+%<latexrelease>\expandafter\let\csname InputIfFileExists \endcsname\@undefined
+% \end{macrocode}
+%
+% \begin{macrocode}
%<latexrelease>\let\@input@file@exists@with@hooks\@undefined
%<latexrelease>\let\unqu@tefilef@und\@undefined
%<latexrelease>\EndIncludeInRelease
@@ -897,7 +916,8 @@
@file-subst@
\@@_subst_file_normalize:Nn \use_ii_iii:nnn {#1}
}
- { \@@_subst_file_normalize:Nn \@@_file_name_compose:nnn {#2} }
+ { \@@_subst_file_normalize:Nn \@@_file_name_compose:nnn
+ {#2} }
\group_end:
}
\cs_new_protected:Npn \@@_subst_remove:n #1
@@ -990,6 +1010,7 @@
% \subsection{Selecting a file (\cs{set@curr@file})}
%
% \begin{macro}{\set@curr@file,\@curr@file,\@curr@file@reqd}
+% \changes{v1.0f}{2021/01/31}{set \cs{protect} to \cs{string} gh/481}
% Now we hook into \cs{set@curr@file} to resolve a possible file
% substitution, and add \cs{@expl@@@filehook@set@curr@file@@nNN}
% at the end, after \cs{@curr@file} is set.
@@ -1013,11 +1034,12 @@
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
-%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>\IncludeInRelease{2021/05/01}%
%<latexrelease> {\set@curr@file}{Setting current file name}%
\def\set@curr@file#1{%
\begingroup
\escapechar\m@ne
+ \let\protect\string
\expandafter\def\csname\expandafter\endcsname
\expandafter{\csname\endcsname}%
% \end{macrocode}
@@ -1055,6 +1077,28 @@
% \end{macrocode}
%
% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease>\def\set@curr@file#1{%
+%<latexrelease> \begingroup
+%<latexrelease> \escapechar\m@ne
+%<latexrelease> \expandafter\def\csname\expandafter\endcsname
+%<latexrelease> \expandafter{\csname\endcsname}%
+%<latexrelease> \@expl@@@filehook@if@no@extension@@nTF{#1}%
+%<latexrelease> {\@tempswatrue}{\@tempswafalse}%
+%<latexrelease> \@kernel@make@file@csname\@curr@file
+%<latexrelease> \@expl@@@filehook@resolve@file@subst@@w {#1}%
+%<latexrelease> \@expl@@@filehook@if@file@replaced@@TF
+%<latexrelease> {\@kernel@make@file@csname\@curr@file@reqd
+%<latexrelease> \@expl@@@filehook@normalize@file@name@@w{#1}%
+%<latexrelease> \if@tempswa \@expl@@@filehook@drop@extension@@N\@curr@file@reqd \fi}%
+%<latexrelease> {\if@tempswa \@expl@@@filehook@drop@extension@@N\@curr@file \fi
+%<latexrelease> \global\let\@curr@file@reqd\@curr@file}%
+%<latexrelease> \@expl@@@filehook@clear@replacement@flag@@
+%<latexrelease> \endgroup}
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease> {\set@curr@file}{Setting current file name}%
%<latexrelease>\def\set@curr@file#1{%
@@ -1106,7 +1150,8 @@
\expandafter\ifx\csname\endcsname#1%
.tex\else\string#1\fi}
% \end{macrocode}
-%
+%
+% \begin{sloppypar}
% Then we call \cs{@expl@@@filehook@set@curr@file@@nNN} once for
% \cs{@curr@file} to set \cs[no-index]{CurrentFile(Path)Used} and once for
% \cs{@curr@file@reqd} to set \cs[no-index]{CurrentFile(Path)}.
@@ -1116,6 +1161,7 @@
% \cs{@curr@file} and \cs{@curr@file@reqd} differ. This macro is
% issued separate from \cs{set@curr@file} because it changes
% \cs{CurrentFile}, and side-effects would quickly get out of control.
+% \end{sloppypar}
% \begin{macrocode}
\def\@filehook@set@CurrentFile{%
\@expl@@@filehook@set@curr@file@@nNN{\@curr@file}%
@@ -1185,7 +1231,7 @@
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
-%<latexrelease> {\@@_resolve_file_subst:w}{Replace files detect loops}%
+%<latexrelease> {\@@_resolve_file_subst:w}{Replace files detect loops}%
\ExplSyntaxOn
\cs_new:Npn \@@_resolve_file_subst:w #1 \@nil
{ \@@_file_parse_full_name:nN {#1} \@@_file_subst_begin:nnn }
@@ -1284,7 +1330,7 @@
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
-%<latexrelease> {\@@_file_subst_tortoise_hare:nn}{Tortoise and Hare}%
+%<latexrelease> {\@@_file_subst_tortoise_hare:nn}{Tortoise and Hare}%
\ExplSyntaxOn
\cs_new:Npn \@@_file_subst_tortoise_hare:nn #1 #2 #3
{
@@ -1437,7 +1483,7 @@
% \begin{macrocode}
%<@@=>
% \end{macrocode}
-%
+% \InternalDetectionOff
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
@@ -1495,6 +1541,7 @@
\cs_new_eq:NN \@expl@@@filehook@file@pop@assign@@nnnn
\__filehook_file_pop_assign:nnnn
% \end{macrocode}
+% \InternalDetectionOn
%
%
% \begin{macrocode}