summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/filedate
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/filedate
Initial commit
Diffstat (limited to 'macros/latex/contrib/filedate')
-rw-r--r--macros/latex/contrib/filedate/README53
-rw-r--r--macros/latex/contrib/filedate/doc/Announce.txt52
-rw-r--r--macros/latex/contrib/filedate/doc/SrcFILEs.txt13
-rw-r--r--macros/latex/contrib/filedate/doc/filedate.RLS8
-rw-r--r--macros/latex/contrib/filedate/doc/filedate.pdfbin0 -> 610198 bytes
-rw-r--r--macros/latex/contrib/filedate/docsrc/fdatechk.tex7
-rw-r--r--macros/latex/contrib/filedate/docsrc/filedate.tex192
-rw-r--r--macros/latex/contrib/filedate/docsrc/srcfiles.tex15
-rw-r--r--macros/latex/contrib/filedate/filedate.sty415
9 files changed, 755 insertions, 0 deletions
diff --git a/macros/latex/contrib/filedate/README b/macros/latex/contrib/filedate/README
new file mode 100644
index 0000000000..8aca60b799
--- /dev/null
+++ b/macros/latex/contrib/filedate/README
@@ -0,0 +1,53 @@
+
+ README for the `filedate' package
+
+ Access and Compare LaTeX File Info and Modification Dates
+
+ (C) Uwe Lueck 2012-11-06
+
+`filedate.sty' provides basic access to the date of a LaTeX
+source file according to its \ProvidesFile, \ProvidesPackage,
+or \ProvidesClass entry -- the "info date" --, as well as to
+its modification date according to \pdffilemoddate if the
+latter is available. Moreover commands are provided to compare
+the "info date" with the modification date, with "today"'s
+date, or with another date that a script accessing modifica-
+tion dates such as adhocfilelist.sh may insert, and to choose
+the effect of comparisons (error vs. "notice", reference date
+characterization). Thus updating the "info date" ("date con-
+sistency") of a source file may be ensured by a test during
+typesetting from it or by some (shell/TeX) script.
+
+REQUIRED PACKAGES: `readprov' for two commands
+
+RELATED PACKAGES: filemod, getfiledate, zwgetfdate, fileinfo
+
+KEYWORDs: modification date, metadata, package documentation,
+ document versions, macro programming
+
+LICENSE:
+
+The package file `filedate.sty' and the documentation files
+`filedate.pdf' (see directory `doc') and `filedate.tex' can be
+redistributed and/or modified under the terms of the LaTeX
+Project Public License; either version 1.3c of the License,
+or any later version, see
+
+ http://www.latex-project.org/lppl.txt
+
+There is NO WARRANTY, indeed this still is somewhat experimental.
+
+The `filedate' package is author-maintained in the sense of
+the license.
+
+The latest public version of the package is available at
+
+ http://mirror.ctan.org/macros/latex/contrib/filedate/
+
+A TDS version of the package is available as
+
+ http://mirror.ctan.org/install/macros/latex/contrib/filedate.tds.zip
+
+Please report bugs, problems, and suggestions via
+
+ http://www.contact-ednotes.sty.de.vu
diff --git a/macros/latex/contrib/filedate/doc/Announce.txt b/macros/latex/contrib/filedate/doc/Announce.txt
new file mode 100644
index 0000000000..be87aee77b
--- /dev/null
+++ b/macros/latex/contrib/filedate/doc/Announce.txt
@@ -0,0 +1,52 @@
+FIRST UPLOAD 2012-10-17:
+
+`filedate.sty' provides basic access to the date of a LaTeX
+source file according to its \ProvidesFile, \ProvidesPackage,
+or \ProvidesClass entry -- the "info date" --, as well as to
+its modification date according to \pdffilemoddate if the
+latter is available. Moreover commands are provided to compare
+the "info date" with the modification date, with "today"'s
+date, or with another date that a script accessing modifica-
+tion dates such as adhocfilelist.sh may insert, and to choose
+the effect of comparisons (error vs. "notice", reference date
+characterization). Thus updating the "info date" ("date con-
+sistency") of a source file may be ensured by a test during
+typesetting from it or by some (shell/TeX) script.
+
+In fact the test today admonished me to update the
+documentation source and driver `filedate.tex'. Another
+motivating example of "date inconsistency" was `nicefilelist'
+v0.6 as of 2012-10-11 (see version history) with "info date"
+2012/10/03.
+
+SECOND UPLOAD 2012-10-25: v0.3 has
+
+ * bug fix with \DatesDiffNotices
+ * new \DatesDiffWarnings
+
+THIRD UPLOAD (r0.3a) 2012-11-06:
+
+ * a checking script `fdatechk.tex' is input both by
+ documentation generator and file list generator
+ (`filedate.tex', `srcfiles.tex')
+ - recommendation for using the package
+ * still contains `filedate.sty' v0.3
+
+FOURTH UPLOAD 2012-11-11: v0.4 has
+
+ * \FileDateAutoChecks after which each \Provides...
+ checks info date against its \pdffilemoddate
+ * \FileDateAutoChecks* additionally checking dates
+ of main file (hopefully \jobname.tex)
+ * \NoFileDateAutoChecks restoring the original behaviour
+ of \Provides..., e.g., for files whose original time
+ stamp has not been preserved in copying/sending
+
+UPLOAD 2013-03-27, v0.41:
+
+ * \FileDateLevelChecks etc., \FileDateUserChecks etc.
+ do not check as much automatically as
+ \FileDateAutoChecks does. E.g., .fd files may be
+ loaded "indirectly" whose modification date is not
+ the \Provides... date, ignore them!
+
diff --git a/macros/latex/contrib/filedate/doc/SrcFILEs.txt b/macros/latex/contrib/filedate/doc/SrcFILEs.txt
new file mode 100644
index 0000000000..f76ca4f07d
--- /dev/null
+++ b/macros/latex/contrib/filedate/doc/SrcFILEs.txt
@@ -0,0 +1,13 @@
+
+ *File List*
+filedate.sty 2013/03/26 v0.41 check file dates (UL)
+filedate.tex 2013/03/25 -- documenting filedate.sty
+ wrong.tex 2012/10/15 -- filedate.sty demo
+fdatechk.tex 2013/03/25 -- `filedate' checks
+filedate.RLS 2013/03/27 v0.41 restricted auto-checks
+srcfiles.tex 2013/03/25 -- file infos -> SrcFILEs.txt
+ ***********
+
+ List made at 2013/03/27, 00:27
+ from script file srcfiles.tex
+
diff --git a/macros/latex/contrib/filedate/doc/filedate.RLS b/macros/latex/contrib/filedate/doc/filedate.RLS
new file mode 100644
index 0000000000..54aac127d6
--- /dev/null
+++ b/macros/latex/contrib/filedate/doc/filedate.RLS
@@ -0,0 +1,8 @@
+\ProvidesFile{filedate.RLS} %% RELEASE INFO\
+ [2013/03/27 v0.41 restricted auto-checks]
+ [{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,
+ doc. mod.]
+ [2012/10/17 v0.2 first public]
diff --git a/macros/latex/contrib/filedate/doc/filedate.pdf b/macros/latex/contrib/filedate/doc/filedate.pdf
new file mode 100644
index 0000000000..e0ff09cdab
--- /dev/null
+++ b/macros/latex/contrib/filedate/doc/filedate.pdf
Binary files differ
diff --git a/macros/latex/contrib/filedate/docsrc/fdatechk.tex b/macros/latex/contrib/filedate/docsrc/fdatechk.tex
new file mode 100644
index 0000000000..9856c423ef
--- /dev/null
+++ b/macros/latex/contrib/filedate/docsrc/fdatechk.tex
@@ -0,0 +1,7 @@
+\ProvidesFile{fdatechk.tex}[2013/03/25 `filedate' checks]
+\EqualityMessages
+\ReadFileInfos{filedate.RLS,srcfiles}
+\DoWithBasesExts{\CheckDateOfPDFmod}{filedate}{sty,tex,RLS}
+\CheckDateOfPDFmod{srcfiles.tex}
+\DatesDiffWarnings
+\CheckDateOfToday{filedate.RLS}
diff --git a/macros/latex/contrib/filedate/docsrc/filedate.tex b/macros/latex/contrib/filedate/docsrc/filedate.tex
new file mode 100644
index 0000000000..6be4950cbe
--- /dev/null
+++ b/macros/latex/contrib/filedate/docsrc/filedate.tex
@@ -0,0 +1,192 @@
+\ProvidesFile{filedate.tex}[2013/03/25 documenting filedate.sty]
+%% 2012/06/24
+\title{\pkgtitle{filedate.sty}{Access and Compare
+ \LaTeX~File~% %% 2012/11/06
+ Info
+ \\ %% 2012/11/06
+ and Modification Date}}
+% \listfiles
+{ \RequirePackage{makedoc} \ProcessLineMessage{}
+ \MakeJobDoc{18}%% 2012/10/16
+ {\SectionLevelThreeParseInput} } %% Three 2013/03/24
+\documentclass[fleqn]{article}%% TODO paper dimensions!?
+\input{makedoc.cfg} %% shared formatting settings
+\usepackage{filedate,readprov}
+\MDkeywords{modification date, metadata, package documentation,
+ %% <- were these two 2012/10/25 ->
+ document versions, macro programming}
+\usepackage{lmodern}
+\usepackage{filesdo} %% TODO makedoc.cfg? 2013/03/25
+\sloppy
+\providecommand*{\LuaTeX}{Lua\TeX}
+\providecommand*{\pdfTeX}{pdf\TeX}
+\providecommand*{\XeLaTeX}{X\lower.5ex\hbox{E}\kern-.125em\LaTeX}
+%% <- TODO some logo package
+% \newcommand*{\qtdfile}{} %% 2012/11/06
+\newcommand*{\secref}[1]{Section~\ref{sec:#1}} %% 2013/03/24
+\begin{document}
+\maketitle
+\begin{MDabstract}
+'filedate.sty' provides basic access to the date of a
+\LaTeX\ source file according to its `\ProvidesFile',
+`\ProvidesPackage', or `\ProvidesClass' entry---the ``info date"---,
+as well as to its modification date according to `\pdffilemoddate'
+if the latter is available. Moreover commands are provided
+to compare the ``info date" with the modification date, with ``today"'s
+date, or with another date---that a script accessing modification dates
+such as \CtanPkgRef{adhocfilelist}{adhocfilelist.sh}
+may insert---, and to choose the effect of comparisons
+(error vs.\ ``notice," reference date characterization).
+Thus updating the ``info date" (``\strong{date consistency}")
+of a source file may be ensured by a test
+during typesetting from it or by some (shell/\TeX) script.
+v0.4 enables checking info dates automatically as soon as
+a \LaTeX\ file is loaded while typesetting or in a
+\ctanpkgref{myfilist} script.
+
+\MDaddtoabstract{Related packages:} \ctanpkgref{filemod},
+\ctanpkgref{getfiledate}, \ctanpkgref{zwgetfdate},
+\ctanpkgref{fileinfo}
+\end{MDabstract}
+\tableofcontents
+
+% \newpage
+\section{Features and Usage}
+\subsection{Basics of Usage} %% 2013/03/24
+\subsubsection{The Most Interesting Command}
+The package allows to check whether the file \strong{info}
+date <date> according to `\Provides' near the top of a \LaTeX\
+input file <file>---i.e.,
+\[`\Provides...{<file>}[<date> ...]'\]
+has been updated the same day when <file> actually was \strong{modified}
+most recently. With \pdfTeX, this can be checked by
+\[|\CheckDateOfPDFmod{<file>}|\]
+
+\subsubsection{Installing and Calling}
+The file 'filedate.sty' is provided ready, installation only requires
+putting it somewhere where \TeX\ finds it
+(which may need updating the filename data
+ base).\urlfoot{ukfaqref}{inst-wlcf} %% corr. 2011/02/08
+
+%% extended 2011/01/14:
+Below the `\documentclass' line(s) and above `\begin{document}',
+you load 'filedate.sty' (as usually) by
+\[|\usepackage{filedate}|\]
+but in ``\TeX\ scripts" such as \hyperref[sec:wrong]{below},
+\[|\RequirePackage{filedate}|\]
+is better.
+
+\subsubsection{Demonstration with a ``\TeX\ script" Example}
+\label{sec:wrong}
+The accompanying `wrong.tex' is an example of a ``\pkg{filedate} \TeX\ script"
+demonstrating what may go wrong.
+% \begin{quotation}\tt\small
+% \expandafter\def\expandafter\{\expandafter{\string{}
+% \expandafter\def\expandafter\}\expandafter{\string}}
+% \obeyspaces\obeylines
+% \cs{ProvidesFile}\{wrong.tex\}[2012/10/15 filedate.sty demo]
+% \cs{RequirePackage}\{filedate\}
+% \cs{CheckDateOfPDFmod}\{wrong\}
+% \cs{CheckDateOfPDFmod}\{wrong.tex\}
+% \cs{CheckDateOfToday}\{wrong.tex\}
+% \cs{stop}
+% \end{quotation}
+\MDsamplecodeinput{wrong}
+\ReadFileInfos{wrong}
+You may run it (by the command line \qtd{\file{latex wrong}}) and experience:
+\begin{enumerate}
+% \AddQuotes
+ \item `wrong.tex''s ``info date" is \qtd{\file{\theinfodateof{wrong.tex}}},
+ but its modification date is at least one day later.
+ \item
+ `\CheckDateOfPDFmod{wrong}' demonstrates that in
+ \[|\CheckDateOfPDFmod{<file>}|\]
+ <file> must be the \Wikiref{filename} \emph{including extension.}
+ Otherwise the ``info date" may be (displayed as) ``unknown."
+ \item
+ |\CheckDateOfPDFmod{wrong.tex}| tests against `wrong.tex''s
+ modification date according to `\pdffilemoddate'---the present
+ package documentation uses \ctanpkgref{pdftex} indeed.
+ \item
+ |\CheckDateOfToday{wrong.tex}| tests against ``today"'s date,
+ which should be different from `2012/10/15'.
+ \item
+ The ``script" terminates on \LaTeX's |\stop| command,
+ without typesetting anything.
+% (or that's what I expect and what has happened when I tried it).
+ \TeX\ is just used as a program, a command interpreter
+ (as with \ctanpkgref{docstrip}).
+\end{enumerate}
+
+% \subsection{The Single Commands}
+% $\dots$ are described below near to their implementation.
+
+ \pagebreak[2] %% 2013/03/25
+
+\section{Implementation and Single Commands}
+\subsection{Package File Header (Legalese)}
+\input{filedate.doc}
+
+ \pagebreak %% 2013/03/25
+\section{Use with Present Package Documentation}
+\label{sec:demo-here}
+%% mod. 2012/11/06:
+\noNiceVerb
+ \input{fdatechk.tex}
+\useNiceVerb
+
+\AddQuotes
+
+Above this paragraph,
+the documentation source `filedate.tex' issues
+\[|\input{fdatechk.tex}|\]
+in order to run the following \TeX~script `fdatechk.tex':
+\MDsamplecodeinput{fdatechk}
+(That is done \emph{above} the paragraph to avoid wrong spacing
+ within the paragraph from `filedate.tex'.)
+This way we check whether the ``info dates" of the package file
+`filedate.sty', of the documentation source and driver
+`filedate.tex', and of some other related files
+are the same as their modification dates
+according to |\pdffilemoddate| (using \code{pdflatex}).
+When I added the (original) check on 2012-10-17,
+it indeed informed me that I had not updated
+`filedate.tex's info date
+(\code{2012/10/16},
+ generation of first version of the file from a template,
+ draft).---%%% 2013/03/25
+|\EqualityMessages| confirms that the tests were run indeed.
+%
+|\DoWithBasesExts| is from the 'filesdo' package
+(\ctanpkgdref{commado} bundle).
+
+The \TeX~script `srcfiles.tex' that in the first instance
+generates a release overview additionally inputs `fdatechk.tex'
+(as of 2012-11-06) as well. This way the check is performed
+even when I rerun the documentation without updating the file list,
+as well the other way round.
+%% rm. 2012/11/06:
+% However, such checks rather
+% approaching package management should better be based on modification
+% \emph{times}. If this should be done by \TeX\
+% (\CtanPkgRef{pdftex}{\pdfTeX}, \ctanpkgref{pdfcmds}),
+% it should better be based on the \ctanpkgref{filemod} package.
+
+\end{document}
+
+VERSION HISTORY
+
+2012/10/16 for v0.2 started %% was v0.1 2012/10/19
+2012/10/17 completed
+2012/10/19 for v0.21 added srcfiles check, corr. history
+2012/10/25 for v0.3 more than two keywords, lmodern
+2012/11/06 for r0.3a final demo with `fdatechk.tex', \AddQuotes
+ for \qtd{\file{..., and other mod.s of
+ doc. there; title extended
+2012/11/11 for v0.4 v0.4 in abstract
+2013/03/24 for v0.41 deeper sectioning level, \secref,
+ \MDsamplecodeinput (+ `code'),
+ \subsubsections for "Basic Usage"
+2013/03/25 for v0.41 \usepackage{filesdo}, \label{sec:demo-here},
+ mentioning `filesdo' there;
+ folding and page breaks
diff --git a/macros/latex/contrib/filedate/docsrc/srcfiles.tex b/macros/latex/contrib/filedate/docsrc/srcfiles.tex
new file mode 100644
index 0000000000..e354f5786d
--- /dev/null
+++ b/macros/latex/contrib/filedate/docsrc/srcfiles.tex
@@ -0,0 +1,15 @@
+\ProvidesFile{srcfiles.tex}[2013/03/25 file infos -> SrcFILEs.txt]
+\RequirePackage[r]{nicefilelist}
+\RequirePackage{filedate,filesdo}
+\MaxBaseEmptyList*[filedate.sty] %%% [readprov.sty,myfilist.sty]
+%% packages:
+\ReadPackageInfos{filedate}
+%% documentation:
+\ReadFileInfos{filedate,wrong}
+%% documentation settings and auxiliaries:
+%\ReadPackageInfos{fifinddo,makedoc,niceverb}
+%\ReadFileInfos{makedoc.cfg,mdoccorr.cfg}
+%\ReadFileInfos{srcfiles.tex}
+\input{fdatechk}
+\ListInfos[SrcFILEs.txt]
+
diff --git a/macros/latex/contrib/filedate/filedate.sty b/macros/latex/contrib/filedate/filedate.sty
new file mode 100644
index 0000000000..f518cb3339
--- /dev/null
+++ b/macros/latex/contrib/filedate/filedate.sty
@@ -0,0 +1,415 @@
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{filedate}[2013/03/26 v0.41 check file dates (UL)]
+
+%% Copyright (C) 2012 2013 Uwe Lueck,
+%% http://www.contact-ednotes.sty.de.vu
+%% -- author-maintained in the sense of LPPL below --
+%%
+%% This file can be redistributed and/or modified under
+%% the terms of the LaTeX Project Public License; either
+%% version 1.3c of the License, or any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% We did our best to help you, but there is NO WARRANTY.
+%%
+%% Please report bugs, problems, and suggestions via
+%%
+%% http://www.contact-ednotes.sty.de.vu
+%%
+%% % \filbreak %% 2012/11/10 rm. 2013/03/25
+%% === The 'readprov' Package ===
+%% \label{sec:readprov}
+% \RequirePackage{readprov}
+%% ---is required for \[|\ReadInfoDate{<file>}|\quad
+%% \mbox{and}\quad |\ReadCheckDateOf{<file>}{<date>}|\]
+%% %% <- <date>, \[...\] 2012/10/25
+%% % \hyperref[sec:readinfo]{below}
+%% (sections~\ref{sec:readinfo} and \ref{sec:readcheck})
+%% % below
+%% only.
+%% Please care for providing \ctanpkgdref{readprov} %% href 2013/03/25
+%% on your own if you need that.
+%%
+%% === Providing Dates for Comparisons === %% 2013/03/24
+%% ==== Accessing ``Info Date" ====
+%% \label{sec:readinfo}
+%% |\theinfodateof{<file>}| will expand to the first ``word" of the
+%% `\Provides'\code{...} entry, provided that has been read before:
+\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}
+%% This avoids the `\relax' that `\UseDateOf' from \ctanpkgref{readprov}
+%% currently adds (which doesn't harm in printing but is bad for comparing).
+%%
+%% |\LoadInfoDateOf{<file>}| sets |\theinfodate| to the first word of
+%% what is in the `\Provides' instruction of <file>, provided that info
+%% has been input. So far, you must care for yourself that this works.
+%% % The purpose of this kind of actions is to refer to a ``type'' of
+%% % comparisons (with `\CheckDateGiven') for a multiplicity of files.
+\newcommand*{\LoadInfoDateOf}[1]{%
+ \edef\theinfodate{\theinfodateof{#1}}}
+%% |\ReadInfoDateOf{<file>}| additionally inputs the info before:
+\newcommand*{\ReadInfoDateOf}[1]{%
+ \ReadFileInfos{#1}\LoadInfoDateOf{#1}}
+%% TODO provide automatically.
+%%
+%% ==== Accessing \cs{pdffilemoddate} ====
+%% \label{sec:pdfmod}
+%% |\pdffilemoddate{<file>}| in the first instance is a \ctanpkgref{pdftex}
+%% primitive. With \LuaTeX,
+%% \ctanpkgdref{pdftexcmds} provides it. %% d 2013/03/25
+%% Currently, you must care for this yourself before loading the
+%% present package. I recommend the
+%% \ctanpkgdref{filemod} documentation for %% d 2013/03/25
+%% details about \cs{pdffilemoddate}.
+%%
+%% %% rm. 2013/03/24:
+%% % Otherwise, (with \XeLaTeX) the modification date may be obtained
+%% % by a (shell) script---the next definitions do \emph{not} deal with
+%% % the latter situation. Testing against ``today"
+%% % (|\rawtoday| in Section~\ref{sec:rawtoday})
+%% % may be another alternative.
+%%
+%% |\thepdfmoddateof{<file>}| expands to the modification date
+%% (eight digits separated by two slashes) if `\pdffilemoddate'
+%% is available. Otherwise, we are trying to inform about
+%% unavailability:
+\ifx\pdffilemoddate\@undefined
+ \newcommand*{\thepdfmoddateof}{%
+ \string\pdffilemoddate\space unavailable.}
+\else
+ \newcommand*{\thepdfmoddateof}[1]{%
+ \expandafter \FD@pdftexdate \pdffilemoddate{#1}\@nil}
+ \expandafter \def \expandafter
+ \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}{%
+%% \urlfmt{stackoverflow.com}} in another discussion of accessing modification dates,
+%% including use of scripts.
+%% `\string D' deals with the fact that `\pdffilemoddate' returns
+%% % in %% rm. 2013/03/24
+%% ``other" character tokens.
+\fi
+%% The modification date of <file> according to `\pdffilemoddate'
+%% will be available as `\thepdffilemoddate' after
+%% `ReadPDFfileModDateOf{<file>}', see \secref{short-refdates}.
+%%
+%% ==== \cs{rawtoday} ====
+%% \label{sec:rawtoday}
+%% % Enabling `\CheckDateOf{<file>}{\rawtoday}':
+%% |\rawtoday| accesses ``today"'s date as eight digits separated
+%% by two slashes (`yyyy/mm/dd'):
+\newcommand*{\rawtoday}{%
+ \the\year/\two@digits{\the\month}/\two@digits{\the\day}}
+%%
+%% === Comparing Basically ===
+%% \label{sec:readcheck}
+%% |\CheckDateOf{<file>}{<ref-date>}| compares <file>'s \strong{info} date with
+%% the \strong{reference} date <ref-date>:
+\newcommand*{\CheckDateOf}[2]{%
+%% We provide a check that does not affect the order with
+%% \ctanpkgdref{myfilist}. %% 2013/03/25
+% \ReadFileInfos{#1}%
+%% The date according to `\Provides' will be accessible as |\theinfodate|:
+ \LoadInfoDateOf{#1}%
+% \show\theinfodate
+ \ReadPDFmodDateOf{#1}%
+ \edef\FD@therefdate{#2}%
+% \show\FD@therefdate
+ \ifx\theinfodate\FD@therefdate
+ \FD@datesequal{#1}%
+ \else
+ \FD@datesdiff{#1}%
+ \fi}
+%% The \strong{reference} date may be either (i)~\emph{today} as accessed
+%% by `\rawtoday' (\secref{rawtoday}), (ii)~the \emph{modification} date as accessed
+%% by `\pdffilemoddate' (\secref{pdfmod}), (iii)~something \emph{else} relevant,
+%% e.g., a modification date determined and inserted by a shell script.
+%% %% <- added 2013/03/24
+%%
+%% |\ReadCheckDateOf{<file>}{<date>}| \ prepends \ |\ReadFileInfos{<file>}|
+%% from the \ctanpkgref{readprov} package (cf. Section~\ref{sec:readprov}),
+%% in order to ensure that the \strong{info} date is known:
+\newcommand*{\ReadCheckDateOf}[1]{%
+ \ReadFileInfos{#1}\CheckDateOf{#1}}
+%% TODO provide automatically.
+%%
+%% === Reporting Styles === %% subsections 2013/03/24
+%% ==== Same Dates ====
+%% By default, there is no report about comparisons finding \strong{equality}.
+\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{%
+ \PackageError{filedate}{%
+ \FD@infodate{#1}\FD@refdate}{% %% \fd@refdate 2012/10/19
+ Fix that!}}
+%% |\FD@infodate{<file>}| might be used to change the current
+%% presentation of the ``info date:"
+\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
+%% `\theinfodate' currently.
+%%
+%% ==== Differing Dates ====
+%% After |\DatesDiffErrors|, date \strong{differences}
+%% are reportet ``drastically" by `\PackageError':
+\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.3 adds |\DatesDiffWarnings| to get more salient reports of
+%% date differences by `\PackageWarningNoLine':
+\newcommand*{\DatesDiffWarnings}{\let\FD@datesdiff\FD@warndatesdiff}
+\def\FD@warndatesdiff#1{%
+ \PackageWarningNoLine{filedate}%
+ {\FD@infodate{#1}\FD@refdate}}
+%% ==== Kinds of Reference Dates ====
+%% When the reference date is `\pdffilemoddate', the report about
+%% a comparison may call it a ``modification date".
+%% But when the reference date is ``today", it may not be a
+%% ``modification date". Otherwise, it depends ...
+%% (See \secref{readcheck} for kinds of reference dates.)
+%%
+%% After |\ModDates|, reference dates are called ``modification'' dates:
+\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}
+%% That's the default:
+\SomeDates
+%%
+%% === Shorthands ===
+%% %% mod. again 2013/03/25
+%% We may want to compare \emph{info} with \emph{reference} dates for
+%% many files. But when the \emph{reference} date is `\pdffilemoddate'
+%% for many files
+%% (probably the most frequent application, see \secref{pdfmod}),
+%% we don't want to state this explicitly for each
+%% file---\secref{short-refdates}---neither
+%% for other kinds of reference dates.
+%%
+%% As to enumerating \emph{file names}, the 'filesdo' package
+%% from the \ctanpkgdref{commado} bundle should help
+%% (combinations of base names and extensions,
+%% see \secref{demo-here}; %% 2013/03/25
+%% TODO: shorthands using 'filesdo' could be defined
+%% in the present package).
+%%
+%% The files <in-file> whose dates we want to check may be just
+%% the same that some <reading-file> tries to `\input'.
+%% It may me helpful if those input commands trigger the
+%% file consistency check without a need to demand this explicitly
+%% for each file---the section on ``automatic immediate checking"
+%% (\secref{auto-check}) aims at this.
+%%
+%% ==== Kinds of Reference Dates ====
+%% \label{sec:short-refdates}
+%% |\ReadPDFmodDateOf{<file>}| enables
+%% \[|\CheckDateOf{<file>}{\thepdfmoddate}|\]
+%% by setting |\thepdfmoddate|:
+\newcommand*{\ReadPDFmodDateOf}[1]{%
+ \edef\thepdfmoddate{\thepdfmoddateof{#1}}}
+%% % The purpose of this section is to control the reference date
+%% % without changing commands with <file> arguments.
+%% After a single |\UseReferenceDate{<date>}| all ensuing
+%% \[|\CheckDateOfGiven{<file>}|\] compare
+%% % `\theinfodateof{<file>}'
+%% <file>'s ``info date"
+%% with
+%% % |\thedategiven|.
+%% <date>.
+%% % <date>
+%% The latter
+%% may be an explicit
+%% \[<4-digits>/<2-digits>/<2-digits>\quad
+%% (`yyyy/mm/dd')\]---a script might insert it---,
+%% `\rawtoday', or `\thepdfmoddate'.
+%% \ctanpkgdref{adhocfilelist} v0.7 (with option \strong{\code{-c}})
+%% is such a script, a shell script generating a ``\TeX\ script",
+%% providing the file modification date according to Unix/Linux.
+\newcommand*{\UseReferenceDate}{\def\thedategiven}
+\newcommand*{\CheckDateOfGiven}[1]{\CheckDateOf{#1}{\thedategiven}}
+%%
+%% %%% *** Clarifying Reference Type in Reports ***
+%% |\CheckDateOfPDFmod{<file>}| compares the ``info date"
+%% with the modification date according to `\pdffilemoddate',
+%% and in reporting a difference the modification
+%% date it is called a ``modification date" indeed:
+\newcommand*{\CheckDateOfPDFmod}[1]{%
+ \begingroup
+ \ModDates
+ \CheckDateOf{#1}{\thepdfmoddate}%
+ \endgroup}
+%% |\CheckDateOfToday{<file>}| checks if the `\Provides' date is today's,
+%% and the report of a difference somewhat emphasizes that this may not
+%% be a \emph{modification} date.
+%% (It may be a \emph{substitute} for a modification date when you
+%% know that the file was modified ``today".)
+\newcommand*{\CheckDateOfToday}[1]{%
+ \begingroup
+ \def\FD@refdate{%
+ \MessageBreak which is not today}%
+ \CheckDateOf{#1}{\rawtoday}%
+ \endgroup}
+%%
+%% ==== Automatic Immediate Checking ====
+%% \label{sec:auto-check}
+%% |\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'
+%% (TODO): %% 2013/03/25 cf. \@iinput
+\newcommand*{\FileDateAutoChecks}{%
+ \@ifstar{{\FD@check@pdf@job\FD@autochecks}\FD@autochecks}%
+ \FD@autochecks}
+%% |\FD@check@pdf@job| is introduced in v0.41 for the
+%% ``restricted" automatic checks below.
+\newcommand*{\FD@check@pdf@job}{\CheckDateOfPDFmod{\jobname.tex}}
+\newcommand*{\FD@autochecks}{\let\@pr@videpackage\FD@provpkg
+ \let\@providesfile\FD@provfile}
+\newcommand*{\NoFileDateAutoChecks}{\let\@pr@videpackage\FD@@provpkg
+ \let\@providesfile \FD@@provfile}
+%%
+%% However, see \secref{auto-level} for \strong{problems}
+%% of the previous idea
+%% (unless using \ctanpkgdref{fileinfo}, i.e., 'readprov' or even 'myfilist').
+%%
+%% \pagebreak %% 2013/03/25
+%% ==== Level-Restricted Automatic Checking ==== %% 2013/03/25
+%% \label{sec:auto-level}
+%% The present package is made to ensure ``date consistency"
+%% of files that the user maintains/edits. By contrast,
+%% date consistency cannot be expected for \LaTeX\ package
+%% files that were generated by \ctanpkgdref{docstrip}
+%% (many days after the `.dtx' source was released).
+%% No date consistency checks should be applied to such files.
+%% (The ``criticism" of the present section does not apply to
+%% usage with \ctanpkgref{fileinfo}, and the commands presented
+%% here \emph{disable} 'fileinfo', so don't use them with 'fileinfo'.)
+%%
+%% The problem with `\FileDateAutoChecks' (\secref{auto-check}) is,
+%% e.g., that a chapter file for a book that is `\include'd by
+%% the master file may trigger loading a font definition file
+%% (`.fd')---that is not date-consistent, though the test is
+%% applied to it. We now aim at checking only those files
+%% that are input by the file that contains the call,
+%% not to files that are input indirectly.
+%% We use `\InputIfFileExists' as a hook for this.
+%% This should affect \emph{\LaTeX} user commands for file inclusion,
+%% even for (the user's) packages and class files.
+%% It does \emph{not} affect the version of `\input' without braces.
+%% The commands for this purpose are |\FileDateLevelChecks|,
+%% |\FileDateLevelChecks*|, and |\NoFileDateLevelChecks|
+%% (replacing `Auto' by `Level' for analogy to the commands
+%% of \secref{auto-check}).
+%%
+%% The implementation is somewhat recursive, or ``counter-recursive"?
+\def\FD@level@provpkg [#1]{\FD@provpkg[#1]%
+ \NoFileDateLevelChecks}
+\def\FD@level@provfile#1[#2]{\FD@provfile{#1}[#2]%
+ \NoFileDateLevelChecks}
+%% |\FD@userchecks@| is introduced for \secref{auto-user}:
+\newcommand*{\FD@userchecks@}{\let\@pr@videpackage\FD@level@provpkg
+ \let\@providesfile\FD@level@provfile}
+\newcommand*{\FD@levelchecks}{\FD@userchecks@
+ \let\InputIfFileExists\FD@input@if@f@ex}
+\let\FD@@input@if@f@ex\InputIfFileExists
+\newcommand{\FD@input@if@f@ex}[3]{\FD@@input@if@f@ex{#1}{#2}{#3}%
+ \FD@levelchecks}
+\newcommand*{\FileDateLevelChecks}{%
+ \@ifstar{\CheckDateOfPDFmod{\jobname.tex}\FD@levelchecks}%
+ \FD@levelchecks}
+\newcommand*{\NoFileDateLevelChecks}{%
+ \NoFileDateAutoChecks \let\InputIfFileExists\FD@@input@if@f@ex}
+%% Section \ref{sec:auto-user} introduces another idea
+%% to avoid checking of \LaTeX\ package files.
+%%
+%% ==== User-Restricted Automatic Checking ==== %% 2013/03/26
+%% \label{sec:auto-user}
+%% Another idea to avoid checking of \LaTeX\ package files
+%% while checking `\input' files automatically are
+%% |\FileDateUserChecks| and |\FileDateUserChecks*|
+%% only affecting user transclusion commands %%% such as
+%% `\include{<file>}' and `\input{<file>}' while allowing
+%% nesting, i.e., e.g., even an `\input{<indir>}' in an
+%% `\include'd file is checked automatically.
+%% (See \secref{auto-level} if you do not remember what is
+%% bad with \secref{auto-check}.)
+\let\FD@@iinput\@iinput \let\FD@@include\@include
+%% Using definitions from above:
+\newcommand*{\FD@userchecks}{%
+%% `\@iinput' is \LaTeX's internal behind `\input':
+ \def\@iinput##1{%
+ \FD@userchecks@\FD@@iinput{##1}\NoFileDateAutoChecks}%
+%% `\@include' is \LaTeX's internal behind `\include'.
+%% Its argument is limited by a space:
+ \def\@include##1 {%
+ \FD@userchecks@\FD@@include##1 \NoFileDateAutoChecks}}
+%% Temporary switching off `\FD@provpkg' and `\FD@provfile'
+%% is doubled to deal with files that don't have a
+%% `\Provides' entry.
+\newcommand*{\FileDateUserChecks}{%
+ \@ifstar{\FD@check@pdf@job\FD@userchecks}\FD@userchecks}
+\newcommand*{\NoFileDateUserChecks}{%
+ \let\@iinput\FD@@iinput \let\@include\FD@@include}
+%% TODO `\usepackage', `\documentclass'?
+%%
+%% === Leaving the Package File ===
+\endinput
+%% \pagebreak %% 2013/03/25
+%% === VERSION HISTORY ===
+
+v0.1 2012/10/15 core try, bad
+v0.2 2012/10/16 code for first release
+ 2012/10/17 reordering, correcting documentation
+v0.21 2012/10/19 \fd@datekind\@tempb -> \fd@refdate,
+ \fd@refdate with \DatesDiffNotices! (bug)
+ \@tempb -> \fd@therefdate; doc. mod.s
+v0.3 2012/10/24 \MessageBreak fix, \DatesDiffWarnings
+ 2012/10/25 doc.: add <date> in sec:readprov,
+ 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*
+v0.41 2013/03/24 doc. restructured and extended
+ 2013/03/25 ... continued; section with \FileDateLevelChecks
+ etc., \@ifstar without braces;
+ doc. automatical ("archaic") -> automatic,
+ reducing numbers of lines
+ 2013/03/26 \FileDateUserChecks etc., \FD@check@pdf@job