summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/filehook
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-12-10 00:12:33 +0000
committerKarl Berry <karl@freefriends.org>2010-12-10 00:12:33 +0000
commit51edd003e4de8bee6f4fe40b27fd4d1c9eef78ac (patch)
treed13b0057a2b17102cd6e7801e005c49fd53f4eae /Master/texmf-dist/tex/latex/filehook
parent61435bcff2d1dd16f28224cee0e48b2ab441933b (diff)
filehook 0.2 (10dec10)
git-svn-id: svn://tug.org/texlive/trunk@20701 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/filehook')
-rw-r--r--Master/texmf-dist/tex/latex/filehook/filehook.sty97
1 files changed, 81 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/filehook/filehook.sty b/Master/texmf-dist/tex/latex/filehook/filehook.sty
index 38d196ad77d..c7a632929e5 100644
--- a/Master/texmf-dist/tex/latex/filehook/filehook.sty
+++ b/Master/texmf-dist/tex/latex/filehook/filehook.sty
@@ -18,10 +18,10 @@
%% This work consists of the files filehook.dtx, filehook.ins
%% and the derived file filehook.sty.
%%
-%% $Id: standalone.dtx 1803 2010-04-03 13:59:44Z martin $
+%% $Id: filehook.dtx 1905 2010-12-08 18:57:34Z martin $
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{filehook}
- [2010/04/08 v0.1 Hooks for input files]
+ [2010/12/08 v0.2 Hooks for input files]
\let\filehook@orig@@input@\@input@
\let\filehook@orig@@iinput\@iinput
\def\@input@#1{%
@@ -40,22 +40,84 @@
\filehook@orig@@iinput{#1}%
\filehook@input@atend{#1}%
}
-\ifcase0%
- \ifx\fink@input\@undefined 1\else
- \ifx\fink@input\relax 1\fi\fi
-\relax
-\long\def\InputIfFileExists#1#2{%
- \IfFileExists{#1}{%
- #2\@addtofilelist{#1}%
- \fink@prepare{#1}%
- \filehook@atbegin{#1}%
- \expandafter\fink@input%
- \expandafter\fink@restore\expandafter{\finkpath}%
- \filehook@atend{#1}%
- }%
+\begingroup
+
+\long\def\latex@InputIfFileExists#1#2{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}%
+ \@@input\@filef@und
+ }%
}
+\long\def\memoir@InputIfFileExists#1#2{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}\m@matbeginf{#1}%
+ \@@input \@filef@und
+ \m@matendf{#1}%
+ \killm@matf{#1}}%
+}
+\long\def\scrlfile@InputIfFileExists#1#2{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname #1-@alias\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+ \scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}%
+ \expandafter\@firstoftwo
+ \fi
+ {%
+ \expandafter\InputIfFileExists\expandafter{\csname
+ #1-@alias\endcsname}{#2}%
+ }%
+ {\IfFileExists{#1}{%
+ \scr@load@hook{before}{#1}%
+ #2\@addtofilelist{#1}%
+ \@@input \@filef@und
+ \scr@load@hook{after}{#1}%
+ }}%
+}
+\ifx\InputIfFileExists\scrlfile@InputIfFileExists
+
+\long\gdef\InputIfFileExists#1#2{%
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname #1-@alias\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+ \scr@replacefile@msg{\csname #1-@alias\endcsname}{#1}%
+ \expandafter\@firstoftwo
+ \fi
+ {%
+ \expandafter\InputIfFileExists\expandafter{\csname
+ #1-@alias\endcsname}{#2}%
+ }%
+ {\IfFileExists{#1}{%
+ \scr@load@hook{before}{#1}%
+ #2\@addtofilelist{#1}%
+ \filehook@atbegin{#1}%
+ \@@input \@filef@und
+ \filehook@atend{#1}%
+ \scr@load@hook{after}{#1}%
+ }}%
+}
+
+\PackageInfo{filehook}{Package 'scrlfile' detected and compensated for.}
+
+\else
+
+\ifx\InputIfFileExists\memoir@InputIfFileExists
+ \AtEndOfPackage{%
+ \AtBeginOfFiles{\m@matbeginf{#1}}%
+ \AtEndOfFiles{\m@matendf{#1}\killm@matf{#1}}%
+ }
+ \PackageInfo{filehook}{Detected 'memoir' class: the memoir hooks will be moved to the 'At...OfFiles' hooks.}
\else
-\long\def\InputIfFileExists#1#2{%
+\ifx\InputIfFileExists\latex@InputIfFileExists
+\else
+ \PackageWarning{filehook}
+ {Changed definition of \string\InputIfFileExists\space detected!^^J%
+ This macro will be redefined and this might break other packages or code.}%
+\fi
+\fi
+
+\long\gdef\InputIfFileExists#1#2{%
\IfFileExists{#1}%
{#2\@addtofilelist{#1}%
\filehook@atbegin{#1}%
@@ -63,7 +125,10 @@
\filehook@atend{#1}%
}%
}
+
\fi
+
+\endgroup
\def\filehook@include@atbegin#1{%
\@nameuse{\filehook@include@atbegin@#1}%
}