From bf0f2a4347666ac5ddd006d687d007797abc8e5b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 29 Sep 2020 21:25:46 +0000 Subject: filehook (29sep20) git-svn-id: svn://tug.org/texlive/trunk@56479 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/filehook/filehook.pdf | Bin 301526 -> 304009 bytes .../texmf-dist/source/latex/filehook/filehook.dtx | 68 ++++++++++++++++----- .../tex/latex/filehook/filehook-2019.sty | 6 +- .../tex/latex/filehook/filehook-2020.sty | 38 ++++++++---- Master/texmf-dist/tex/latex/filehook/filehook.sty | 6 +- 5 files changed, 84 insertions(+), 34 deletions(-) diff --git a/Master/texmf-dist/doc/latex/filehook/filehook.pdf b/Master/texmf-dist/doc/latex/filehook/filehook.pdf index dcd978b5f2d..bd94ed1a666 100644 Binary files a/Master/texmf-dist/doc/latex/filehook/filehook.pdf and b/Master/texmf-dist/doc/latex/filehook/filehook.pdf differ diff --git a/Master/texmf-dist/source/latex/filehook/filehook.dtx b/Master/texmf-dist/source/latex/filehook/filehook.dtx index 07cb49537fc..eee04bd9afd 100644 --- a/Master/texmf-dist/source/latex/filehook/filehook.dtx +++ b/Master/texmf-dist/source/latex/filehook/filehook.dtx @@ -26,10 +26,10 @@ %<*driver> \ProvidesFile{filehook.dtx}[% %<=*DATE> - 2020/09/27 + 2020/09/29 %<=/DATE> %<=*VERSION> - v0.8 + v0.8a %<=/VERSION> Hooks for input files] \documentclass{ydoc} @@ -57,7 +57,7 @@ % % \fi % -% \CheckSum{1478} +% \CheckSum{1494} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -100,6 +100,8 @@ % \changes{v0.5e}{2019/08/19}{Fix for new LaTeX format.} % \changes{v0.6}{2019/10/03}{Fix for InputIfFileExists for LaTeX format 2019/10/01.} % \changes{v0.7}{2020/02/03}{Further fixes for InputIfFileExists for LaTeX format 2019/10/01.} +% \changes{v0.8}{2020/09/27}{Support for LaTeX format 2020/10/01.} +% \changes{v0.8a}{2020/09/29}{Further fixes for LaTeX format 2020/10/01.} % % \GetFileInfo{filehook.dtx} % @@ -114,9 +116,24 @@ % execute code at begin or the end of specific or all input files. % \end{abstract} % +% \section{Changes due to new \LaTeX\ core hooks} +% With the \LaTeX\ release 2020/10/01 file hooks are now provided by the \LaTeX\ core. This package has been adjusted to use these hooks +% while trying to provide the same interface and behaviour than before. Simpler usages should work without any differences but advanced +% usages which rely on the exact hook order and position might see some unwanted changes. +% Users should try to use the \LaTeX\ hooks instead for new documents. +% Please see \LaTeX\ core filehook documentation +% \href{http://mirrors.ctan.org/macros/latex-dev/base/ltfilehook-doc.pdf}{\texttt{ltfilehook-doc}} for +% the new hook system. +% +% Support of other hooking systems in other packages and classes has been dropped as this package no longer installs own hooks. +% +% If this package is run under a \LaTeX\ release prior to 2020/10/01 the old implementation will be loaded. +% For this switch two sub-packages \pkg{filehook-2019} and \pkg{filehook-2020} are used and loaded according to the \LaTeX\ release version. +% Please do not load these packages directly as they might be changes or disappear on later releases. +% % % \section{Introduction} -% These package changes some internal \LaTeX{} macros used to load input files so that they include `hooks'. +% These package (under \LaTeX\ prior 2020/10/01) changes some internal \LaTeX{} macros used to load input files so that they include `hooks'. % A hook is an (internal) macro executed at specific points. Normally it is initially empty, but can be extended using % an user level macro. The most common hook in \LaTeX{} is the `At-Begin-Document' hook. Code can be added to this hook % using \Macro\AtBeginDocument{<\TeX\ code>}. @@ -528,7 +545,7 @@ % % \subsection{Options} % \begin{macrocode} -\DeclareOption{force}{\PassOptionsToPackage{forse}{filehook-2019}} +\DeclareOption{force}{\PassOptionsToPackage{force}{filehook-2019}} \ProcessOptions\relax % \end{macrocode} % @@ -547,7 +564,7 @@ % \begin{macrocode} % \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{filehook-2019}[% +\ProvidesPackage{filehook-2019}[% filehook subpackage, do not load directly % % %<*DRIVER> @@ -1353,7 +1370,7 @@ % \begin{macrocode} % \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{filehook-2020}[% +\ProvidesPackage{filehook-2020}[% filehook subpackage, do not load directly % % %<*DRIVER> @@ -1917,10 +1934,25 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\filehook@set@CurrentFile} +% \begin{macrocode} +\def\filehook@set@CurrentFile{% + \edef\filehook@CurrentFile{% + \ifx\CurrentFilePath\empty + \else + \CurrentFilePath/% + \fi + \CurrentFile + }% +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\Hook} % \begin{macrocode} \AddToHook{include/before}{% - \filehook@include@atbegin{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@include@atbegin{\filehook@CurrentFile}% } % \end{macrocode} % \end{macro} @@ -1928,7 +1960,8 @@ % \begin{macro}{\Hook} % \begin{macrocode} \AddToHook{include/end}{% - \filehook@include@atend{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@include@atend{\filehook@CurrentFile}% } % \end{macrocode} % \end{macro} @@ -1936,7 +1969,8 @@ % \begin{macro}{\Hook} % \begin{macrocode} \AddToHook{include/after}{% - \filehook@include@after{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@include@after{\filehook@CurrentFile}% } % \end{macrocode} % \end{macro} @@ -1973,9 +2007,10 @@ % \begin{macro}{\Hook} % \begin{macrocode} \AddToHook{file/before}{% - \filehook@every@atbegin{\CurrentFile}% - \filehook@istexfile\CurrentFile{\filehook@input@atbegin{\CurrentFile}}{}% - \filehook@atbegin{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@every@atbegin{\filehook@CurrentFile}% + \filehook@istexfile\filehook@CurrentFile{\filehook@input@atbegin{\filehook@CurrentFile}}{}% + \filehook@atbegin{\filehook@CurrentFile}% } % \end{macrocode} % \end{macro} @@ -1983,9 +2018,10 @@ % \begin{macro}{\Hook} % \begin{macrocode} \AddToHook{file/after}{% - \filehook@atend{\CurrentFile}% - \filehook@istexfile\CurrentFile{\filehook@input@atend{\CurrentFile}}{}% - \filehook@every@atend{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@atend{\filehook@CurrentFile}% + \filehook@istexfile\filehook@CurrentFile{\filehook@input@atend{\filehook@CurrentFile}}{}% + \filehook@every@atend{\filehook@CurrentFile}% } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/tex/latex/filehook/filehook-2019.sty b/Master/texmf-dist/tex/latex/filehook/filehook-2019.sty index a0a5c327770..9e2bc9db5da 100644 --- a/Master/texmf-dist/tex/latex/filehook/filehook-2019.sty +++ b/Master/texmf-dist/tex/latex/filehook/filehook-2019.sty @@ -18,9 +18,9 @@ %% and pgf-filehook.sty %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{filehook-2019}[% - 2020/09/27 - v0.8 +\ProvidesPackage{filehook-2019}[% filehook subpackage, do not load directly + 2020/09/29 + v0.8a Hooks for input files] \newif\iffilehook@force \DeclareOption{force}{\filehook@forcetrue} diff --git a/Master/texmf-dist/tex/latex/filehook/filehook-2020.sty b/Master/texmf-dist/tex/latex/filehook/filehook-2020.sty index fa5f7fd328e..43c4cd2d7a4 100644 --- a/Master/texmf-dist/tex/latex/filehook/filehook-2020.sty +++ b/Master/texmf-dist/tex/latex/filehook/filehook-2020.sty @@ -18,9 +18,9 @@ %% and pgf-filehook.sty %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{filehook-2020}[% - 2020/09/27 - v0.8 +\ProvidesPackage{filehook-2020}[% filehook subpackage, do not load directly + 2020/09/29 + v0.8a Hooks for input files] \DeclareOption{force}{} \ProcessOptions\relax @@ -238,14 +238,26 @@ \expandafter\filehook@@ensuretex#1\empty.tex\empty\empty } \def\filehook@@ensuretex#1.tex\empty#2\empty{#1.tex} +\def\filehook@set@CurrentFile{% + \edef\filehook@CurrentFile{% + \ifx\CurrentFilePath\empty + \else + \CurrentFilePath/% + \fi + \CurrentFile + }% +} \AddToHook{include/before}{% - \filehook@include@atbegin{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@include@atbegin{\filehook@CurrentFile}% } \AddToHook{include/end}{% - \filehook@include@atend{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@include@atend{\filehook@CurrentFile}% } \AddToHook{include/after}{% - \filehook@include@after{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@include@after{\filehook@CurrentFile}% } \begingroup \edef\dottex{\expandafter\expandafter\expandafter\@gobble\expandafter\string\csname.tex\endcsname} @@ -266,14 +278,16 @@ } \endgroup \AddToHook{file/before}{% - \filehook@every@atbegin{\CurrentFile}% - \filehook@istexfile\CurrentFile{\filehook@input@atbegin{\CurrentFile}}{}% - \filehook@atbegin{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@every@atbegin{\filehook@CurrentFile}% + \filehook@istexfile\filehook@CurrentFile{\filehook@input@atbegin{\filehook@CurrentFile}}{}% + \filehook@atbegin{\filehook@CurrentFile}% } \AddToHook{file/after}{% - \filehook@atend{\CurrentFile}% - \filehook@istexfile\CurrentFile{\filehook@input@atend{\CurrentFile}}{}% - \filehook@every@atend{\CurrentFile}% + \filehook@set@CurrentFile + \filehook@atend{\filehook@CurrentFile}% + \filehook@istexfile\filehook@CurrentFile{\filehook@input@atend{\filehook@CurrentFile}}{}% + \filehook@every@atend{\filehook@CurrentFile}% } \endinput %% diff --git a/Master/texmf-dist/tex/latex/filehook/filehook.sty b/Master/texmf-dist/tex/latex/filehook/filehook.sty index dc2e9336143..b2f09be2973 100644 --- a/Master/texmf-dist/tex/latex/filehook/filehook.sty +++ b/Master/texmf-dist/tex/latex/filehook/filehook.sty @@ -19,10 +19,10 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{filehook}[% - 2020/09/27 - v0.8 + 2020/09/29 + v0.8a Hooks for input files] -\DeclareOption{force}{\PassOptionsToPackage{forse}{filehook-2019}} +\DeclareOption{force}{\PassOptionsToPackage{force}{filehook-2019}} \ProcessOptions\relax \@ifl@t@r\fmtversion{2020/10/01}{\RequirePackage{filehook-2020}}{\RequirePackage{filehook-2019}} \endinput -- cgit v1.2.3