From ed48151feadfdc69a37a082480d1b756a466e54c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 13 Nov 2012 00:22:24 +0000 Subject: filedate (12nov12) git-svn-id: svn://tug.org/texlive/trunk@28242 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/filedate/filedate.RLS | 1 + Master/texmf-dist/tex/latex/filedate/filedate.sty | 105 +++++++++++++++------- 2 files changed, 72 insertions(+), 34 deletions(-) (limited to 'Master/texmf-dist/tex/latex/filedate') diff --git a/Master/texmf-dist/tex/latex/filedate/filedate.RLS b/Master/texmf-dist/tex/latex/filedate/filedate.RLS index 01c1eb275ea..5f48a2845f2 100644 --- a/Master/texmf-dist/tex/latex/filedate/filedate.RLS +++ b/Master/texmf-dist/tex/latex/filedate/filedate.RLS @@ -1,4 +1,5 @@ \ProvidesFile{filedate.RLS} %% RELEASE INFO\ + [{2012/11/11 v0.4 \string\[No]FileDateAutoChecks}] [2012/11/06 r0.3a `fdatechk.tex'] [2012/11/06 v0.3 \DatesDiffWarning] [2012/10/19 v0.21 bug fix, reimplementation, diff --git a/Master/texmf-dist/tex/latex/filedate/filedate.sty b/Master/texmf-dist/tex/latex/filedate/filedate.sty index 5f3e52a7716..0fd44cbc674 100644 --- a/Master/texmf-dist/tex/latex/filedate/filedate.sty +++ b/Master/texmf-dist/tex/latex/filedate/filedate.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{filedate}[2012/10/25 v0.3 check file dates (UL)] +\ProvidesPackage{filedate}[2012/11/11 v0.4 check file dates (UL)] %% Copyright (C) 2012 Uwe Lueck, %% http://www.contact-ednotes.sty.de.vu @@ -16,6 +16,7 @@ %% %% http://www.contact-ednotes.sty.de.vu %% +%% \filbreak %% 2012/11/10 %% === The \ctanpkgref{readprov} Package === %% \label{sec:readprov} % \RequirePackage{readprov} @@ -28,7 +29,6 @@ %% only. %% Please care for providing it on your own if you need that. %% -%% \pagebreak %% === Accessing ``Info Date" === %% \label{sec:readinfo} %% |\theinfodateof{}| will expand to the first ``word" of the @@ -36,8 +36,8 @@ \newcommand*{\theinfodateof}[1]{% \@ifundefined{ver@#1}{unknown}{% \expandafter\expandafter\expandafter - \fd@firstword\csname ver@#1\endcsname\@gobble{} \@nil}} -\def\fd@firstword#1 #2\@nil{#1} + \FD@firstword\csname ver@#1\endcsname\@gobble{} \@nil}} +\def\FD@firstword#1 #2\@nil{#1} %% This avoids the `\relax' that `\UseDateOf' from \ctanpkgref{readprov} %% currently adds (which doesn't harm in printing but is bad for comparing). %% @@ -75,9 +75,9 @@ \string\pdffilemoddate\space unavailable.} \else \newcommand*{\thepdfmoddateof}[1]{% - \expandafter \fd@pdftexdate \pdffilemoddate{#1}\@nil} + \expandafter \FD@pdftexdate \pdffilemoddate{#1}\@nil} \expandafter \def \expandafter - \fd@pdftexdate\string D:#1#2#3#4#5#6#7#8#9\@nil{% + \FD@pdftexdate\string D:#1#2#3#4#5#6#7#8#9\@nil{% #1#2#3#4/#5#6/#7#8} %% ---cf.~Will \ctanpkgauref{robertson}{Robertson}'s suggestion dating from 2010 on %% \httpref{stackoverflow.com/questions/2118972/latex-command-for-last-modified}{% @@ -106,12 +106,12 @@ \LoadInfoDateOf{#1}% % \show\theinfodate \ReadPDFmodDateOf{#1}% - \edef\fd@therefdate{#2}% -% \show\fd@therefdate - \ifx\theinfodate\fd@therefdate - \fd@datesequal{#1}% + \edef\FD@therefdate{#2}% +% \show\FD@therefdate + \ifx\theinfodate\FD@therefdate + \FD@datesequal{#1}% \else - \fd@datesdiff{#1}% + \FD@datesdiff{#1}% \fi} %% |\ReadCheckDateOf{}{}| prepends |\ReadFileInfos{}| %% from the \ctanpkgref{readprov} package (cf. Section~\ref{sec:readprov}): @@ -119,22 +119,22 @@ \ReadFileInfos{#1}\CheckDateOf{#1}} %% TODO provide automatically. %% -%% \pagebreak +%% \filbreak %% === Reporting Styles === %% By default, there is no report about comparisons finding equality. -\let\fd@datesequal\@gobble +\let\FD@datesequal\@gobble %% % We do not want to disturb `\listfiles' with \ctanpkgref{myfilist}. %% %% <- rm. 2012/10/25 %% |\EqualityMessages| changes this to screen and log messages: -\newcommand*{\EqualityMessages}{\let\fd@datesequal\fd@equalmess} -\def\fd@equalmess#1{\message{ + #1 passed date check + }} -\def\fd@errdatesdiff#1{% +\newcommand*{\EqualityMessages}{\let\FD@datesequal\FD@equalmess} +\def\FD@equalmess#1{\message{ + #1 passed date check + }} +\def\FD@errdatesdiff#1{% \PackageError{filedate}{% - \fd@infodate{#1}\fd@refdate}{% %% \fd@refdate 2012/10/19 + \FD@infodate{#1}\FD@refdate}{% %% \fd@refdate 2012/10/19 Fix that!}} -%% |\fd@infodate{}| might be used to change the current +%% |\FD@infodate{}| might be used to change the current %% presentation of the ``info date:" -\def\fd@infodate#1{% +\def\FD@infodate#1{% #1 has \string\Provides... date \theinfodate\space} %% TODO here |\theinfodate| could be replaced by %% |\theinfodateof{#1}|, there is no essential application of @@ -142,29 +142,29 @@ %% %% After |\DatesDiffErrors|, date differences are reportet ``drastically" %% by `\PackageError': -\newcommand*{\DatesDiffErrors}{\let\fd@datesdiff\fd@errdatesdiff} +\newcommand*{\DatesDiffErrors}{\let\FD@datesdiff\FD@errdatesdiff} %% This is the default: \DatesDiffErrors %% After |\DatesDiffNotices|, date differences are reported by %% %% <- told -> reported 2012/10/19 %% `\typeout': -\newcommand*{\DatesDiffNotices}{\let\fd@datesdiff\fd@notedatesdiff} -\def\fd@notedatesdiff#1{\def\MessageBreak{^^J}% %% added 2012/10/24 - {\typeout{\fd@infodate{#1}% - \fd@refdate}}} %% added 2012/10/19 -%% v0.7 adds |\DatesDiffWarnings| to get more salient reports of +\newcommand*{\DatesDiffNotices}{\let\FD@datesdiff\FD@notedatesdiff} +\def\FD@notedatesdiff#1{\def\MessageBreak{^^J}% %% added 2012/10/24 + {\typeout{\FD@infodate{#1}% + \FD@refdate}}} %% added 2012/10/19 +%% v0.3 adds |\DatesDiffWarnings| to get more salient reports of %% date differences by `\PackageWarningNoLine': -\newcommand*{\DatesDiffWarnings}{\let\fd@datesdiff\fd@warndatesdiff} -\def\fd@warndatesdiff#1{% +\newcommand*{\DatesDiffWarnings}{\let\FD@datesdiff\FD@warndatesdiff} +\def\FD@warndatesdiff#1{% \PackageWarningNoLine{filedate}% - {\fd@infodate{#1}\fd@refdate}} + {\FD@infodate{#1}\FD@refdate}} %% After |\ModDates|, reference dates are called ``modification'' dates: -\newcommand*{\ModDates}{\let\fd@refdate\fd@moddate} -\def\fd@moddate{\MessageBreak vs. modification date \fd@therefdate} +\newcommand*{\ModDates}{\let\FD@refdate\FD@moddate} +\def\FD@moddate{\MessageBreak vs. modification date \FD@therefdate} %% After |\SomeDates|, the type of reference dates is not specified. %% This is more accurate when the info date is compared with |\rawtoday|. -\newcommand*{\SomeDates}{\let\fd@refdate\fd@somedate} -\def\fd@somedate{\MessageBreak vs. \fd@therefdate} +\newcommand*{\SomeDates}{\let\FD@refdate\FD@somedate} +\def\FD@somedate{\MessageBreak vs. \FD@therefdate} %% That's the default: \SomeDates %% @@ -212,15 +212,48 @@ %% know that the file was modified ``today".) \newcommand*{\CheckDateOfToday}[1]{% \begingroup - \def\fd@refdate{% + \def\FD@refdate{% \MessageBreak which is not today}% \CheckDateOf{#1}{\rawtoday}% \endgroup} %% +%% === Automatical Immediate Checking === +%% |\FileDateAutoChecks| modifies the \qtdcode{&\Provides...} +%% commands internally so that they check their date with +%% with the file's modification date according to +%% |\pdffilemoddate|---this choice might be queried (TODO). +%% The modification may be undone by |\NoFileDateAutoChecks| +%% so that the \qtdcode{&\Provides...} commands get their +%% original functionality (only) again. This will even work +%% with \ctanpkgref{readprov} v0.4. +%% +%% Actually, \LaTeX's internal `\@pr@videpackage' and +%% `\@profidesfile' are used as hooks. Their original meanings +%% are stored so they can be regained by \qtd{&\NoFile...}: +\let\FD@@provpkg\@pr@videpackage +\def\FD@provpkg[#1]{% + \FD@@provpkg[#1]% + \CheckDateOfPDFmod{\@currname.\@currext}} +\let\FD@@provfile\@providesfile +\def\FD@provfile#1[#2]{% + \FD@@provfile{#1}[#2]% + \CheckDateOfPDFmod{#1}} +%% |\FileDateAutoChecks*| in addition to `\FileDateAutoChecks' +%% checks the main file's info date, +%% assuming the main file is `\jobname.tex': +\newcommand*{\FileDateAutoChecks}{% + \@ifstar{\CheckDateOfPDFmod{\jobname.tex}% + \FD@autochecks}% + {\FD@autochecks}} +\newcommand*{\FD@autochecks}{% + \let\@pr@videpackage\FD@provpkg + \let\@providesfile\FD@provfile} +\newcommand*{\NoFileDateAutoChecks}{% + \let\@pr@videpackage\FD@@provpkg + \let\@providesfile\FD@@provfile} %% %% TODO single check commands for comma-separated list of files, %% (\ctanpkgref{dowith}) -%% automatic tests by `\ReadFileInfos' etc. (\ctanpkgref{fileinfo}). %% %% === Leaving the Package File === \endinput @@ -238,3 +271,7 @@ v0.3 2012/10/24 \MessageBreak fix, \DatesDiffWarnings rm. remark on \fd@datesequal, mod. text on \DatesDiffWarnings, -- -> --- before `a script might' +v0.4 2012/11/10 \fd@ -> \FD@, doc. v0.7 -> v0.3, v0.21, + \filbreak; code for \...AutoChecks + 2012/11/11 doc. another \filbreak, documenenting + \...AutoChecks, \...AutoChecks* -- cgit v1.2.3