svninfo/svninfo.dtx

1375 lines
47 KiB
TeX

% \iffalse
%<*header>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `svninfo' package to use with LaTeX2e.
%%
%% This package is used to extract the revision and file information provided
%% by the Subversion revision control system.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%% Copyright (C) 2003-2010 Achim D. Brucker
%%
%% License:
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1.3c of the License, or any later version.
%%
%% SPDX-License-Identifier: LPPL-1.3c+
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\iffalse
% to test the checksum, uncomment \OnlyDescription
% in the driver
%\fi
%
%% \CheckSum{628}
%% \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
%% Lower-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
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%</header>
%\fi
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\if,\else,\fi,\emph,\footnotesize,\footrulewidth,\let}
% \DoNotIndex{\newcount,\newif,\number,\or,\parindent,\plainfootrulewidth}
% \DoNotIndex{\PrintChanges,\PrintIndex,\relax,\setlength,\space}
% \DoNotIndex{\the,\textwidth,\thepage,\newcommand,\texttt,\verb,\vfill}
% \DoNotIndex{\input,\newpage,\setcounter,\newcounter,\\,\ ,\typeout,\today}
%
% \MakeShortVerb{\|}
% \newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
% \def\param#1{\texttt{\##1}}
% \newcommand{\Cmd}[1]{\texttt{$\backslash$#1}}
% \newcommand{\Svn}{\emph{Subversion}}
% \newcommand{\Svk}{\emph{svk}}
% \newcommand{\blank}{{\tiny$_\sqcup$}}
% \newcommand{\Id}{\texttt{\$Id\$}}
% \newcommand{\SvnInfoCmd}[1]{\texttt{$\backslash$svnInfo\blank\$Id#1\$\blank}}
%
% \changes{v0.7.4}{2010/03/23}{Fixed localization of date formats,
% e.g., \texttt{\\svnToday}.}
% \changes{v0.7.3}{2008/08/09}{Fixed bug resulting in wrong date for maximal
% revision}
% \changes{v0.7.2}{2008/04/28}{Fixed documentation: the option for using
% the \texttt{scrpage2} package is called \texttt{scrpage}. Fixed
% support for \texttt{svk}.}
% \changes{v0.7.1}{2007/04/27}{Fixed \texttt{\\svnMaxToday} and
% introduced \texttt{\\svnInfoMaxToday} as an alternative
% name. Improved documentation}
% \changes{v0.7}{2007/03/26}{Added option \texttt{margin} for showing
% version info in the margins of the document; added option
% \texttt{svk} for supporting the keyword expansion of svk; added command
% \texttt{\\svnMaxToday}; and fixed the use of \texttt{fancyhdr} for
% single-sided documents.}
% \changes{v0.6}{2006/05/11}{Added \texttt{\\svnInfoMinRevision} and
% \texttt{\\svnInfoMaxRevision} together with the option
% \texttt{revrange}. Also added support for \texttt{\textbackslash} in keywords.}
% \changes{v0.5}{2006/01/11}{Removed support for \LatexToHtml{} (it is
% non-free software and also seems to be unmaintained) and added new
% command \texttt{\\svnKeyword} for defining arbitrary svn keywords
% (e.g. \texttt{\string$Author:\string$}).}
% \changes{v0.4}{2005/11/07}{Added new package options \texttt{draft}, \texttt{final},
% \texttt{eso-foot}, and \texttt{scrpage}. Fixed problem
% with `\_' in file names.}
% \changes{v0.3}{2005/09/30}{Added support for \texttt{\$Id:\$} keywords without
% owner information.}
% \changes{v0.2.1}{2005/04/07}{Added \texttt{\\svnId}.}
% \changes{v0.2}{2005/01/17}{Removed \LatexToHtml{} build-dependency.}
% \changes{v0.1}{2003/08/14}{Initial version, mainly a modified version
% of the \texttt{rcsinfo} package.}
%
% \title{The \texttt{svninfo} package}
% \author{Achim D.~Brucker\\
% {\footnotesize adbrucker@0x5f.org}\\
% {\footnotesize http://www.brucker.ch/}}
% \date{March 23, 2010\\Version 0.7.4}
%
% \maketitle
%
% \begin{abstract}
% \noindent This package is used to extract the revision and file
% information provided by the \Svn\
% (\texttt{http://subversion.tigris.org}) and the \Svk\
% (\texttt{http://svk.elixus.org}) revision control system.
% \end{abstract}
%
%\section{Introduction}
%
% To maintain different versions of a document or to keep track on the
% development of one, the document is kept under a revision control
% system like \emph{SCCS}, \emph{CVS}, \Svn, or \Svk. This package
% assumes you are using either the \Svn\ or the \Svk\ system. To
% present the version information of a document, one needs to extract
% it from somewhere. For example, \Svk\ and \Svn\ offer several keywords
% that are expanded by the \Svn\ and \Svk\ \emph{update}
% commands.\footnote{The expansion of keywords has to be enabled
% manually, e.g., \texttt{svn propset svn:keywords "Id"
% svninfo.dtx}.} The most informative keyword is |$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $| which
% contains a lot of useful information. This information is made
% available through this package. Additionally, the package allows one
% to extract also the information from the more specific keywords,
% e.g., |$Author$| or |$Date$|.
%
% In this documentation we use \Svn\ in the examples; but the results
% should be similar if you are using \Svk. Note that you have to use
% the \texttt{svk} option if you use \Svk.
%
% Moreover, one has to set the \Svn\ property for keywords expansion of
% that file, e.g., by executing:
% \begin{verbatim}
% svn propset svn:keywords "Id" svninfo.dtx
% \end{verbatim}
% Please consult the manual of \Svn\ (e.g., \emph{h}) or \Svk\ for further
% details about keyword expansion.
%
% The information obtained from the expanded \Id\ string are
% \begin{itemize}
% \item the filename,
% \item the revision number,
% \item the date and time of the last \Svn\ \emph{co} command, and
% \item name of the user who has done this action.
% \end{itemize}
% For each of these items a macro is defined.
% When \emph{updating} a file, the \Svn\ keywords should be contained in
% the \emph{updated} source. Further, one has to set the \Svn\ property
% for keyword expansion of that file, e.g.\
% \begin{verbatim}
% svn propset svn:keywords "Id" svninfo.dtx
% \end{verbatim}
% See the \Svn\ documentation for more details.
%
% If you want to read about the implementation, put a \% before
% |\Only|\-|Description| in the code marked with |<*driver>| in the file
% |svninfo.dtx|.
%
%\section{User Interface}
%
%\subsection{Options}
%
% Options for this package are:
% \begin{description}
% \item[svk]
% Use \texttt{svk} for parsing the Id information generated by
% \Svk.
% \item[today]
% Set the date of |\today| to the date obtained by the \Svn\ information.
% If the \Id\ string is not expanded (see below), the current date is
% used.
% \item[notoday]
% Don't use the \Svn\ date for |\today|.
% \item[revrange] For multi-file documents, display minimum and
% maximum revision. Every file of the document must either
% include a |\svnInfo| or a |\svnKeyword $Revision:$| statement.
% This is information needs two runs of \LaTeX{} to be correct.
% \item[fancyhdr]
% We use the \texttt{fancyhdr} package to fill the footline with
% \Svn\ information: filename, revision-number and date.
%
% If the \texttt{fancyhdr} package is not already loaded, it will be
% loaded
% by this package. To use the footnotes, put something like:\\
% \hspace*{1em}|\pagestyle{fancyplain}|\\
% \hspace*{1em}|\fancyhead[RE,LO]{\leftmark}|\\
% \hspace*{1em}|\fancyhead[LE,RO]{\thepage}|\\
% in the preamble.
% \item[nofancy]
% We don't define the footline. The
% \texttt{fancyhdr} package is not loaded.
% \item[scrpage]
% Use \texttt{scrpage2} instead of \texttt{fancyhdr}.
% \item[eso-foot]
% Use \texttt{eso-pic} for showing a tiny info line at the bottom
% line of the paper.
% \item[margin] Use \texttt{margin} for showing the version info in
% the margin area.
% \item[long]
% If used together with \texttt{fancy} / \texttt{fancyhdr} the date
% string is printed in the long format
% as |\today| returns it. If \texttt{fancy} / \texttt{fancyhdr}
% is not used, nothing.
% \item[short]
% If used together with \texttt{fancy} / \texttt{fancyhdr} the date
% string is printed in the short
% format \emph{YYYY-MM-DD}.
% If \texttt{fancy} / \texttt{fancyhdr} is not used, nothing.
% \item[final] Don't define the footline. If you want the \Svn\ in the
% final document, please use\\
% \verb|\usepackage{draft}|
% \item[draft] If \texttt{nofancy} is not used, show a footline with \Svn\ information.
% \end{description}
% If the \texttt{babel} package is used, the |\svnToday| string is language
% dependent.
%
% The default options are: \emph{draft,today,long}. You may also
% configure the default fancy heading packages in the configuration
% file |svninfo.cfg|.
%
%\subsection{Commands}
%
% \subsubsection{Defining the \Svn\ Id information}
%
% There is only one macro to define the information:
% |\svnInfo|\DescribeMacro{\svnInfo}. Since it must collaborate with
% \Svn\ it has an ``unusual'' calling sequence: The arguments are
% prefaced with a `\$' and completed with a `\$\blank' (note the final
% space or carriage return).
% The following arguments are valid:\\
% \hspace*{0.5em} \SvnInfoCmd{}\\
% \hspace*{0.5em} \SvnInfoCmd{:}\\
% \hspace*{0.5em}
% \SvnInfoCmd{:\blank\emph{file}\blank\emph{rev}\blank\emph{YYYY-MM-DD}\blank\emph{hh:mm:ss}\blank\emph{owner}\blank}
%
% In the first two forms, \Svn\ has not expanded the \Id\ string.
% This form will usually be used before the file is \emph{checked in}
% the first time.
%
% \emph{YYYY-MM-DD} is a date, \emph{hh:mm:ss} a time.
% Note: when you perform the \Svn\ \emph{check out} command, the \Id\ string
% is expanded by \Svn\ automatically.
%
% To take effect, |\svnInfo| must follow the |\begin{document}|.
% If you are using multiple files for a document, you could place
% |\svnInfo| at the
% beginning of each file, so the information from the current file is
% obtained.
%
% \subsubsection{Accessing the \Svn\ Id information}
% There are the following macros to access the information provided by \Svn.
% If \Svn\ has not expanded the \Id\ string, or no |\svnInfo| command is given,
% default values are returned.
%
% \begin{itemize}
% \item \DescribeMacro{\svnInfoFile} The name of the source file.
% Default: \texttt{--sourcefile--}.
% \item \DescribeMacro{\svnInfoRevision} The revision number, of the
% \emph{checked out} file.
% Default: \texttt{--revision--}.
% \item \DescribeMacro{\svnInfoMinRevision} The minimum revision
% number of multi-file documents. Every file of the document must either
% include a |\svnInfo| or a |\svnKeyword $Revision:$| statement.
% This is information needs two runs of \LaTeX{} to be correct.
% Default: \texttt{--minrevision--}.
% \item \DescribeMacro{\svnInfoMaxRevision} The maximum revision
% number of multi-file documents. Every file of the document must either
% include a |\svnInfo| or a |\svnKeyword $Revision:$| statement.
% This is information needs two runs of \LaTeX{} to be correct.
% Default: \texttt{--maxrevision--}.
% \item \DescribeMacro{\svnInfoDate} The date in the form \emph{YYYY-MM-DD},
% when the file was \emph{checked out}.
% Default: the current date.
% \item \DescribeMacro{\svnInfoTime} The time, when the file was
% \emph{checked out}.
% Default: \texttt{--time--}.
% \item \DescribeMacro{\svnInfoOwner} The user name of the file owner.
% Default: \texttt{--owner--}.
% \item \DescribeMacro{\svnInfoYear} The year \emph{YYYY} of |\svnInfoDate|.
% Default: the current year.
% \item \DescribeMacro{\svnInfoMonth} The month \emph{MM} of |\svnInfoDate|.
% Default: the current month.
% \item \DescribeMacro{\svnInfoDay} The day \emph{DD} of |\svnInfoDate|.
% Default: the current day.
% \item \DescribeMacro{\svnInfoLongDate} The date in the form of |\today|
% when the file was \emph{checked out}. This is language depended.
% Default: the current date.
% \item \DescribeMacro{\svnId} Mimics the behavior of the \Id\ strings, i.e.\ it
% prints a string with a summary of the above described
% information.
% \item \DescribeMacro{\svnToday} The date obtained from the \Svn\ information
% in the format |\today| is using.
% \item \DescribeMacro{\svnInfoMaxToday} The date obtained from the latest
% \Svn\ revision in the format |\today| is using.
% \end{itemize}
% \section{Examples}
%
% \newcommand{\svnExample}{
% \begin{tabular}[t]{rl}
% \Cmd{svnInfoFile} & \svnInfoFile \\
% \Cmd{svnInfoRevision} & \svnInfoRevision \\
% \Cmd{svnInfoMinRevision} & \svnInfoMinRevision \\
% \Cmd{svnInfoMaxRevision} & \svnInfoMaxRevision \\
% \Cmd{svnInfoDate} & \svnInfoDate \\
% \Cmd{svnInfoTime} & \svnInfoTime \\
% \Cmd{svnInfoOwner} & \svnInfoOwner \\
% \end{tabular}
% \begin{tabular}[t]{rl}
% \Cmd{svnInfoYear} & \svnInfoYear \\
% \Cmd{svnInfoMonth} & \svnInfoMonth \\
% \Cmd{svnInfoDay} & \svnInfoDay \\
% \Cmd{svnInfoLongDate} & \svnInfoLongDate \\
% \Cmd{svnToday} & \svnToday \\
% \Cmd{svnInfoMaxYear} & \svnInfoMaxYear \\
% \Cmd{svnInfoMaxDay} & \svnInfoMaxDay \\
% \Cmd{svnInfoMaxMonth} & \svnInfoMaxMonth \\
% \Cmd{svnInfoMaxToday} & \svnInfoMaxToday \\
% \end{tabular}\\
% \Cmd{svnId} \svnId
% \bigskip
%}
%
% \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
% |\svnInfo| not expanded, no colon\\
% \verb+\svnInfo $+\verb+Id$+\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
% |\svnInfo| not expanded, having colon\\
% \verb+\svnInfo $+\verb+Id:$+\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
% |\svnInfo| standard version\\
% {\small\verb+\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $+}\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
% |\svnInfo| standard version without owner\\
% {\small\verb+\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $+}\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
% |\svnInfo| standard version with \\ in the owner \\
% {\small\verb+\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $+}\\
% \svnExample
%
% \svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $
% |\svnInfo| no leading \$\\
% {\footnotesize\verb+\svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $+}\\
% \svnExample
%
% \section{The generic \Svn\ keyword interface}
% In addition to the already presented |\svnInfo| macro which is
% specially built for analyzing the \Svn\ |$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $| information we also
% provide a generic interface via
% |\svnKeyword|\DescribeMacro{\svnKeyword}. This interface can
% be used to extract information from the remaining keywords:
% \begin{itemize}
% \item |$Date$|: The date of the last commit with changes. This
% information can also be accessed using the keyword
% |$LastChangedDate$|.
% \item |$Revision$|: The revision of the last commit with
% changes. This information can also be accessed using the keyword
% |$LastChangedRevision$| or |$Rev$|.
% \item |$Author$|: The author of the last commit with changes. This
% information can also be accessed using the keyword
% |$LastChangeBy$|.
% \item |$HeadURL$|: The the full URL to the latest version of the
% file in the repository. This information can also be accessed
% using the keyword |$URL$|.
% \end{itemize}
% These keywords can be accessed using the |\svnKeyword|
% macro. This macro accepts a single argument that should be of the
% form |$|\meta{Keyword}|$| (unexpanded) or
% |$|\meta{Keyword}:\blank\meta{value}\blank|$| (expanded), e.g.:
% \begin{verbatim}
% \svnKeyword $Author: brucker $
% \end{verbatim}
% The |\svnKeyword| updates the corresponding \Svn\ Id
% information, e.g., our example updates |\svnInfoOwner|. In more
% detail:
% \begin{itemize}
% \item |\svnKeyword $Date:$| updates the date and time
% information, e.g., |\svnInfoDate|\DescribeMacro{\svnInfoDate},
% |\svnInfoMonth|\DescribeMacro{\svnInfoMonth}, or
% |\svnInfoTime|\DescribeMacro{\svnInfoTime}.
% \item |\svnKeyword $Revision:$| updates
% |\svnInfoRevision|\DescribeMacro{\svnInfoRevision}.
% \item |\svnKeyword $Author:$| updates
% |\svnInfoOwner|\DescribeMacro{\svnInfoOwner}.
% \item |\svnKeyword $HeadURL:$| updates
% |\svnInfoHeadURL|\DescribeMacro{\svnInfoHeadURL}.
% \end{itemize}
%
% Note, the parser used by |\svnKeyword| is not that powerful than
% the one used by |\svnInfo|. Thus it is advisable to use
% |\svnKeywordId| for the |$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $| keyword and |\svnKeyword|
% only for the keywords described in this section.
%
% Further, the |\svnKeyword| macro does not reset all keyword
% definitions globally, i.e., you can combine the |$Revision$|
% of one file, with the |$Author$| of another file. Please take
% care of that!
%
% \section{Acknowledgments}
% %%%%%%%%%%%%%%%%%%%%%%%%%
% This package is based on \texttt{rcsinfo} from Dr.~J{\"u}rgen
% Vollmer. The \texttt{rcsinfo} package is distributed via the CTAN
% archives ('\texttt{macros/latex/contrib/rcsinfo}').
%
% The code for parsing generic \Svn{} keywords was taken from the
% \texttt{svn} packages written by Richard Lewis. The \texttt{svn}
% package is distributed via the CTAN archives
% ('\texttt{macros/latex/contrib/svn}').
%
% Further I want to thank all the people that reported bugs and ideas
% for improvements, often including patches: Andreas Haller, Benjamin
% Hiller, Christophe Jacquet, Dries Kimpe, Jami Lawrence, Henning
% Lenz, Stefan Mann, Nigel Metheringham, Igor Nikolic, Michael
% Niedermair, Heiko Oberdiek, Oliver Pons, Bernd Raichle, Krzysztof
% Retel, J\"org, Sommer, Arnout Standaert, Daniel Tr\"umper, Thomas
% Weber, and Uwe Ziegenhagen.
%
% \section{Copyright and License}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{tabular}{ll}
% Copyright (\copyright) 1995 & Dr. J{\"u}rgen Vollmer\\
% Copyright (\copyright) 2003--2010 & Achim D.~Brucker \texttt{adbrucker@0x5f.org}\\
% \end{tabular}
%
% \noindent This program can be redistributed and/or modified under
% the terms of the \LaTeX{} Project Public License Distributed from
% CTAN archives in directory '\texttt{macros/latex/base/lppl.txt}';
% either version 1.3c of the License, or (at your opinion) any later version.
%
% \StopEventually{}
%
% \section{The Documentation Driver File}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The next bit of code contains the documentation driver file for
% \TeX\, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the
% \texttt{docstrip} program.
%
% If you want to read about the implementation, put a \% before
% |\OnlyDescription| in the following code.
% \begin{macrocode}
%<*driver>
\documentclass{article}
\usepackage{doc}
\usepackage[nofancy]{svninfo}
\OnlyDescription
\makeatletter
\if@svnInfoUseFancyhdr@
\pagestyle{fancyplain}
\if@twoside
\fancyhead[RE,LO]{\leftmark}
\fancyhead[LE,RO]{\thepage}
\else
\fancyhead[R]{\leftmark}
\fancyhead[L]{\thepage}
\fi
\fi
\makeatother
\RecordChanges
\EnableCrossrefs
\CodelineIndex
\begin{document}
\DocInput{svninfo.dtx}
\PrintChanges
\setcounter{IndexColumns}{2}
\PrintIndex
\end{document}
%</driver>
% \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{The Configuration File}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% You can set up the default fancy headings package in the file
% |svninfo.cfg|.
% Use the |fancyhdr| package, by setting the default option: |fancyhdr|.
% \begin{macrocode}
%<*config>
\ExecuteOptions{fancyhdr}
%</config>
% \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{The Implementation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The implementation is based on cracking the \Id\ string.
%
% What do we need, and who we are:
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{svninfo}[2010/03/22 v0.7.4]
% \end{macrocode}
%
% Declare some local counters to store the \Svn\ date
% \begin{macrocode}
\newcount\@svnInfoDay
\newcount\@svnInfoMonth
\newcount\@svnInfoYear
% \end{macrocode}
%
% To memorize, that we want to set |\svnToday| to the date obtained by the
% \Svn\ information.
% \begin{macrocode}
\newif\if@svnInfoToday@
% \end{macrocode}
%
% |\svnToday| should return the date obtained by the \Svn\ information.
% \begin{macrocode}
\DeclareOption{today}{
\@svnInfoToday@true
}
% \end{macrocode}
%
% Ok we don't want do use it.
% \begin{macrocode}
\DeclareOption{notoday}{
\@svnInfoToday@false
}
% \end{macrocode}
% To memorize if we should show ranges of revision (for multiple-file
% documents):
% \begin{macrocode}
\newif\if@svnInfoRevRange@
\@svnInfoRevRange@false
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{revrange}{
\@svnInfoRevRange@true
}
% \end{macrocode}
% \begin{macrocode}
% To memorize if we are in final or draft mode:
% \begin{macrocode}
\newif\if@svnInfoDraft@
% \end{macrocode}
% \begin{macrocode}
\DeclareOption{final}{
\@svnInfoDraft@false
}
\DeclareOption{draft}{
\@svnInfoDraft@true
}
% \end{macrocode}
%
% To memorize, that we want to have the old \texttt{fancyheadings}, the new
% \texttt{fancyhdr}, \texttt{srcpage2}, \texttt{eso-pic}, or \texttt{margin}.
% footline filled with \Svn\ information.
% \begin{macrocode}
\newif\if@svnInfoNotPreamble@%
\@svnInfoNotPreamble@false%
\newif\if@svnInfoUseFancy@
\newif\if@svnInfoUseFancyhdr@
\newif\if@svnInfoUseScrpage@
\newif\if@svnInfoUseEsofoot@
\newif\if@svnInfoUseMargin@
\newif\if@svnInfoSVK@
% \end{macrocode}
%
% We want to use the \texttt{fancyhdr}
% package, and set the footline with the \Svn\ information.
% Only one option may be in effect.
% \begin{macrocode}
\DeclareOption{fancy}{
\@svnInfoUseFancy@true
\@svnInfoUseFancyhdr@false
\@svnInfoUseScrpage@false
\@svnInfoUseEsofoot@false
}
\DeclareOption{fancyhdr}{
\@svnInfoUseFancy@false
\@svnInfoUseFancyhdr@true
\@svnInfoUseScrpage@false
\@svnInfoUseEsofoot@false
}
\DeclareOption{scrpage}{
\@svnInfoUseFancy@false
\@svnInfoUseFancyhdr@false
\@svnInfoUseScrpage@true
\@svnInfoUseEsofoot@false
}
\DeclareOption{eso-foot}{
\@svnInfoUseFancy@false
\@svnInfoUseFancyhdr@false
\@svnInfoUseScrpage@false
\@svnInfoUseEsofoot@true
}
\DeclareOption{margin}{
\@svnInfoUseMargin@true
}
\DeclareOption{svk}{
\@svnInfoSVK@true
}
% \end{macrocode}
%
% Ok we don't want do use it.
% \begin{macrocode}
\DeclareOption{nofancy}{
\@svnInfoUseFancy@false
\@svnInfoUseFancyhdr@false
\@svnInfoUseScrpage@false
\@svnInfoUseEsofoot@false
}
% \end{macrocode}
%
% To memorize, that we want to use the long date format.
% \begin{macrocode}
\newif\if@svnInfoLong@
% \end{macrocode}
%
% We want to use the long date format.
% \begin{macrocode}
\DeclareOption{long}{
\@svnInfoLong@true
}
% \end{macrocode}
%
% Ok we don't want do use it.
% \begin{macrocode}
\DeclareOption{short}{
\@svnInfoLong@false
}
% \end{macrocode}
%
% Use these default options,
% \begin{macrocode}
\ExecuteOptions{draft,today,long}
% \end{macrocode}
%
% read the configuration file, to set the default fancy headings package,
% \begin{macrocode}
\IfFileExists{svninfo.cfg}{\input{svninfo.cfg}}{}
% \end{macrocode}
%
% and the process the user options.
% \begin{macrocode}
\ProcessOptions*\relax
% \end{macrocode}
% Load packages for page headers of footers if necessary.
% \begin{macrocode}
\if@svnInfoDraft@
\if@svnInfoUseFancy@
\RequirePackage{fancyheadings}
\fi
\if@svnInfoUseFancyhdr@
\RequirePackage{fancyhdr}
\fi
\if@svnInfoUseScrpage@
\RequirePackage{scrpage2}
\fi
\if@svnInfoUseEsofoot@
\RequirePackage{eso-pic}
\fi
\fi
% \end{macrocode}
%
% \begin{macrocode}
\RequirePackage{ifthen}
% \end{macrocode}
%
% If no language for the |babel| package is given in the document,
% we have to redefine |\svnToday| (otherwise the changed |\year|, |\month| and
% |\day| won't work). In this case use the English version of |\svnToday|.
% \begin{macrocode}
\def\svnToday{\@svnInfoToday}
%ifcase\month\or
% January\or February\or March\or April\or May\or June\or
% July\or August\or September\or October\or November\or December\fi
% \space\number\day, \number\year}
% \end{macrocode}
%
% We have a problem, since the number of arguments of |\svnInfo| vary from
% zero to five.
% To deal with that, we use some kind ``continuation passing'' style of
% programming.
% |\@svnInfoNext| contains the action to be done next.
%
%\begin{macro}{\svnInfo}
% Extract the \Svn\ information, and give commands shown above their values.
% Check the catcode of |:| and set the flag. The restoration is done after the
% |:| has been read. Allow \_ (underscore) in file names, hence change the
% |\catcode| of it.
% \begin{macrocode}
%
% Whenever reading another portion of the SVN/RCS info,
% expand \@svnBeginRead before calling the reading macro
% and call \@svnEndRead as first thing inside the reading macro.
\def\@svnBeginRead{\begingroup
\catcode`\_=13 %
\catcode`:=12 %
\catcode`\\=12 %
}
\def\@svnEndRead{\endgroup
}
\def\svnInfo {\@svnBeginRead
\@svnInfoReadArgs
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoReadArgs}
% First check, if the \Id\ string is not-expanded.
% Set the default values, so that for not expanded \Id\ strings, we get them.
% The \$ before |Id| may be omitted (I use this to avoid expansion of
% \$Id-Tags to be expanded by SVN in some cases).
% Restore the catcode of the |:|.
% \begin{macrocode}
\def\@svnInfoReadArgs #1Id#2 {\@svnEndRead
\@svnInfoDefaults
\if $#2 \expandafter\@svnInfoEat
\else \@svnBeginRead
\expandafter\@svnInfoEatColon
\fi
$Id#2 %
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoEat}
% This macro eats up its argument, i.e.\ removes it from the input.
% Reset the |\catcode| of the underscore.
% \begin{macrocode}
\def\@svnInfoEat #1 {}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoEatColon}
% This macro eats up the colon following \texttt{Id}.
% The colon may be followed by a \$, which means that the \Id\ string is not
% expanded.
% \begin{macrocode}
\def\@svnInfoEatColon $Id:#1 {\@svnEndRead
\if $#1 \expandafter\@svnInfoEat
\else \@svnBeginRead
\expandafter\@svnInfoCrackAndEat
\fi
#1 %
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoCrackAndEat}
% Take an expanded \Id\ string pass it to the crack routine
% |\@svnInfoCrack|\-|String|, which specifies what has to be done
% after it. We have already eaten the \$.
% Note: here we don't give an argument to |\@svnInfoNext|, since it is taken
% form the source, in case of |\@svnInfoEat|.
% We have to take the next 7 tokens.
% Note, first argument (\verb|#1|) contains only spaces.
% \begin{macrocode}
\def\@svnInfoCrackAndEat #1 #2 #3 #4 #5 #6 {\@svnEndRead
\@svnInfoCrackString #2 #3 #4 #5 #6 %
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoCrackString}
% Take an expanded \Id\ string and crack it:\\
% \#1: filename, \#2 revision, \#3 date, \#4 time, \#5 owner\\
% Hence we have to consume the terminating \$ afterwards. Reset
% the |\catcode| of the underscore.
%
% If the document checked into the repository without authentication,
% the owner may be empty. In that case the argument \#5 is \$ and
% we already consumed the terminating \$.
%
% Split the date into year,month and day.
% If the option \texttt{today} is given, |\svnToday| returns from now
% on the \Svn\ date.
%
% \begin{macrocode}
\def\@svnInfoCrackString #1 #2 #3 #4 #5 {%
\def\svnInfoFile{#1}%
\def\svnInfoRevision{#2}%
\def\svnInfoTime{#4}%
%
\@svnInfoSplitDate x#3r#2x%
\@svnInfoMargin%
\def\svnInfoLongDate{\@svnInfoToday}%
%
\if@svnInfoToday@
\year =\@svnInfoYear
\month =\@svnInfoMonth
\day =\@svnInfoDay
\fi
\ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\) %
\OR \( \svnInfoMaxRevision < #2 \)}{%
\def\svnInfoMaxRevision{#2}%
}{}%
\ifthenelse{\(\equal{\svnInfoMinRevision}{--minrevision--}\) %
\OR \( #2 < \svnInfoMinRevision \)}{\def\svnInfoMinRevision{#2}}{}%
\if $#5 \def\svnInfoOwner{}%$%
\def\svnId{#1\ #2\ #3\ #4}%
\else
\def\svnInfoOwner{#5}%
\def\svnId{#1\ #2\ #3\ #4\ #5}%
\expandafter\@svnInfoEat
\fi
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoSplitDate}
% This macro sets |\svnInfoYear|, |\svnInfoMonth|, and |\svnInfoDay|.
% It takes a \texttt{x}\emph{YYYY-MM-DD}\texttt{x} style of argument.
% \begin{macrocode}
\if@svnInfoSVK@
\def\@svnInfoSplitDate x#1-#2-#3T#4Zr#5x{%
\@svnInfoDay =#3\relax
\@svnInfoMonth=#2\relax
\@svnInfoYear =#1\relax
\ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\)
\OR \( \svnInfoMaxRevision < #5 \)}{%
\def\svnInfoMaxYear{#1}%
\def\svnInfoMaxMonth{#2}%
\def\svnInfoMaxDay{#3}%
}{}%
}
\else%
\def\@svnInfoSplitDate x#1-#2-#3r#4x{%
\@svnInfoDay =#3\relax
\@svnInfoMonth=#2\relax
\@svnInfoYear =#1\relax
\ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\)
\OR \( \svnInfoMaxRevision < #4 \)}{%
\def\svnInfoMaxYear{#1}%
\def\svnInfoMaxMonth{#2}%
\def\svnInfoMaxDay{#3}%
}{}%
}
\fi%
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoToday}
% Returns the \Svn\ date in the form as |\today| does it.
% To do this, we set |\year|, |\month| and |\day| commands to the
% corresponding \Svn\ information, let |\svnToday| does its work, i.e.\
% transforming the date into a language dependent string and reset
% |\year|, |\month| and |\day| to their previous value.
%
% \begin{macrocode}
\def\@svnInfoToday {%
\begingroup
\year =\@svnInfoYear
\month =\@svnInfoMonth
\day =\@svnInfoDay
\today
\endgroup
}
\def\@svnInfoMaxToday {%
\begingroup
\year =\svnInfoMaxYear
\month =\svnInfoMaxMonth
\day =\svnInfoMaxDay
\today
\endgroup
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoDefaults}
% This macro sets the default values.
% \begin{macrocode}
\def\@svnInfoDefaults {%
\@svnInfoYear =\year
\@svnInfoMonth =\month
\@svnInfoDay =\day
\ifthenelse{\isundefined{\svnInfoMaxYear}}{\def\svnInfoMaxYear{\the\year}}{}
\ifthenelse{\isundefined{\svnInfoMaxMonth}}{\def\svnInfoMaxMonth{\the\month}}{}
\ifthenelse{\isundefined{\svnInfoMaxDay}}{\def\svnInfoMaxDay{\the\day}}{}
\def\svnInfoFile{--sourcefile--}%
\def\svnInfoHeadURL{--head-url--}%
\def\svnInfoDate{\the\@svnInfoYear-\two@digits\@svnInfoMonth-%
\two@digits\@svnInfoDay}%
\def\svnInfoTime{--time--}%
\def\svnInfoRevision{--revision--}%
\ifthenelse{\isundefined{\svnInfoMinRevision}}{\def\svnInfoMinRevision{--minrevision--}}{}%
\ifthenelse{\isundefined{\svnInfoMaxRevision}}{\def\svnInfoMaxRevision{--maxrevision--}}{}%
\def\svnInfoOwner{--owner--}%
\def\svnInfoYear{\the\@svnInfoYear}%
\def\svnInfoMonth{\the\@svnInfoMonth}%
\def\svnInfoDay{\the\@svnInfoDay}%
\def\svnInfoLongDate{\@svnInfoToday}%
\def\svnInfoMaxToday{\@svnInfoMaxToday}%
\def\svnMaxToday{\@svnInfoMaxToday}%
\def\svnId{\svnInfoFile\ \svnInfoRevision\ \svnInfoTime\ \svnInfoOwner}%
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoFancyFoot}
% This defines the contents of the footline
% \begin{macrocode}
\def\@svnInfoFancyFoot {%
\if@svnInfoRevRange@
\def\@svnInfoRevisionRange{{ (\svnInfoMinRevision : \svnInfoMaxRevision)}}%
\else
\def\@svnInfoRevisionRange{\relax}%
\fi
\if@svnInfoLong@
\def\@svnInfoFancyInfo{{\footnotesize
\emph{Rev: \svnInfoRevision\@svnInfoRevisionRange, %
\svnInfoLongDate}}}%
\else
\def\@svnInfoFancyInfo{{\footnotesize
\emph{Rev: \svnInfoRevision\@svnInfoRevisionRange, %
\svnInfoDate}}}%
\fi
\def\@svnInfoFancyFile{{\footnotesize\emph{\svnInfoFile}}}%
% \end{macrocode}
% and set it for the \texttt{fancyheadings} package,
% package page style.
% \begin{macrocode}
\if@svnInfoDraft@
\if@svnInfoUseFancy@
\rfoot[\fancyplain{\@svnInfoFancyFile}{\@svnInfoFancyFile}]%
{\fancyplain{\@svnInfoFancyInfo}{\@svnInfoFancyInfo}}%
\lfoot[\fancyplain{\@svnInfoFancyInfo}{\@svnInfoFancyInfo}]%
{\fancyplain{\@svnInfoFancyFile}{\@svnInfoFancyFile}}%
\setlength{\footrulewidth}{0.4pt}%
\setlength{\plainfootrulewidth}{0.4pt}%
\fi
\fi
% \end{macrocode}
% for the \texttt{fancyhdr} package,
% \begin{macrocode}
\if@svnInfoDraft@
\if@svnInfoUseFancyhdr@
\if@twoside
\fancyfoot[LE,RO]{\@svnInfoFancyInfo}%
\fancyfoot[LO,RE]{\@svnInfoFancyFile}%
\fancyfoot[CO,CE]{\thepage}%
\renewcommand{\footrulewidth}{0.4pt}%
\fancypagestyle{plain}{%
\fancyfoot[LE,RO]{\@svnInfoFancyInfo}%
\fancyfoot[LO,RE]{\@svnInfoFancyFile}%
\fancyfoot[CO,CE]{\thepage}%
\renewcommand{\footrulewidth}{0.4pt}%
}
\else
\fancyfoot[L]{\@svnInfoFancyInfo}%
\fancyfoot[R]{\@svnInfoFancyFile}%
\fancyfoot[C]{\thepage}%
\renewcommand{\footrulewidth}{0.4pt}%
\fancypagestyle{plain}{%
\fancyfoot[L]{\@svnInfoFancyInfo}%
\fancyfoot[R]{\@svnInfoFancyFile}%
\fancyfoot[C]{\thepage}%
\renewcommand{\footrulewidth}{0.4pt}%
}
\fi
\fi
\fi
% \end{macrocode}
% for the \texttt{srcpage2} package,
% \begin{macrocode}
\if@svnInfoDraft@
\if@svnInfoUseScrpage@
\clearscrheadfoot%
\ohead{\headmark}%
\cfoot[\emph{\@svnInfoFancyInfo}]{\emph{\@svnInfoFancyInfo}}%
\ifoot[\@svnInfoFancyFile]{\@svnInfoFancyFile}%
\ofoot[\pagemark]{\pagemark}%
\pagestyle{scrheadings}%
\fi
\fi
% \end{macrocode}
% for the \texttt{eso-pic} package,
% \begin{macrocode}
\if@svnInfoDraft@
\if@svnInfoUseEsofoot@
\AddToShipoutPicture{%
\setlength{\unitlength}{1mm}%
\put(5,5){\tiny\svnInfoFile\quad\svnInfoRevision\quad\svnInfoDate%
\quad\svnInfoTime\quad\svnInfoOwner}%
}
\fi
\fi
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\@svnInfoMargin}
% for the \texttt{margin} option.
% \begin{macrocode}
\def\@svnInfoMargin{
\if@svnInfoDraft@
\if@svnInfoNotPreamble@
\if@svnInfoUseMargin@
\expandafter\marginpar[%
{\raggedleft\tiny\svnInfoFile, \svnInfoRevision, %
\svnInfoDate, \svnInfoTime, \svnInfoOwner}%
]{%
{\raggedright\tiny\svnInfoFile, \svnInfoRevision, %
\svnInfoDate, \svnInfoTime, \svnInfoOwner}%
}%
\fi
\fi
\fi
}
% \end{macrocode}
%
% \end{macro}
%
% Initialize the defaults
% \begin{macrocode}
\@svnInfoDefaults
% \end{macrocode}
% At the start of the document, if we use the
% \texttt{fancyhdr} footline, we should set it here.
% \begin{macrocode}
\AtBeginDocument{%
\@svnInfoNotPreamble@true
\if@svnInfoDraft@
\if@svnInfoUseFancy@
\@svnInfoFancyFoot
\fi
\if@svnInfoUseFancyhdr@
\@svnInfoFancyFoot
\fi
\if@svnInfoUseScrpage@
\@svnInfoFancyFoot
\fi
\if@svnInfoUseEsofoot@
\@svnInfoFancyFoot
\fi
\fi
}
% \end{macrocode}
% At the end of the document
% \begin{macrocode}
\AtEndDocument{%
\immediate\write\@mainaux{\string\gdef\string\svnInfoMinRevision{\svnInfoMinRevision}}%
\immediate\write\@mainaux{\string\gdef\string\svnInfoMaxRevision{\svnInfoMaxRevision}}%
\immediate\write\@mainaux{\string\gdef\string\svnInfoMaxDay{\svnInfoMaxDay}}%
\immediate\write\@mainaux{\string\gdef\string\svnInfoMaxMonth{\svnInfoMaxMonth}}%
\immediate\write\@mainaux{\string\gdef\string\svnInfoMaxYear{\svnInfoMaxYear}}%
}
% \end{macrocode}
%\subsection{The generic \texttt{\string\svnKeyword} command}
% \begin{macro}{\svnKeyword}
% |\svnKeyword| is the main construct. The single argument
% should be of the form |$|\meta{Keyword}|$| or
% |$|\meta{Keyword}:\meta{space}\meta{value}\meta{space}|$|, where
% \meta{Keyword} and \meta{value} must be non-empty as well as
% brace- and |\if|--|\fi|- balanced. \meta{space} is a single space
% (if more are present they will be subsumed into \meta{value}). If
% `|$empty$|', `|$generic$|', |$Time$| or ever become keywords, or
% if keywords containing |@| ever exist then we may have problems.
% \begin{macrocode}
\def\svnKeyword $#1${\svn@$#1: $}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\svnKeywordempty}
% If \meta{Keyword} is unexpanded then |\svnKeywordKeyword| is
% set to the macro |\svnKeywordempty|, which is initially empty.
% \begin{macrocode}
\let\svnKeywordempty\relax
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\svn@}
% \begin{macro}{\svn@tmp}
% |\svn@| does the work for |\svnKeyword|. It takes two
% arguments, the first is the \meta{Keyword}'s name, the second is
% empty (in which case \meta{Keyword} was unexpanded) or
% \meta{value}, the expansion of \meta{keyword}.
% \begin{macrocode}
\def\svn@$#1: #2${%
\def\svn@tmp{#2}%
% \end{macrocode}
% \begin{macro}{\svn@suffix}
% If \param2 is empty, then the keyword was unexpanded and
% |\svn@suffix| is set to |@unexp|, otherwise we had an
% expanded keyword so |\svn@suffix| is set to |@exp|.
% \begin{macrocode}
\ifx\svn@tmp\@empty
\def\svn@suffix{@unexp}%
\else
\def\svn@suffix{@exp}%
\fi
% \end{macrocode}
% If |\svnKeyword@|\param1\meta{suffix} is defined then run it
% with arguments `\param1\param2', else run
% |\svnKeyword@generic@|\meta{suffix} (again with argument
% \param1\param2---by default this defines `|\svnKeyword|\meta{\param1}' to
% be \param2, or |\svnKeywordempty| in the unexpanded case).
% \begin{macrocode}
\@ifundefined{svnKeyword@#1\svn@suffix}%
{\@nameuse{svnKeyword@generic\svn@suffix}{#1}{#2}}%
{\@nameuse{svnKeyword@#1\svn@suffix}{#1}{#2}}%
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \subsubsection{Dealing with general \texttt{\string$Keyword\string$}s}
% \begin{macro}{\svnKeyword@generic@exp}
% When we see |\svnKeyword $KeyWord: <stuff> $|, and
% |\svnKeyword@KeyWord@exp| is undefined, then we define the macro
% |\svnKeywordKeyWord| to be |<stuff>| using
% |\svnKeyword@generic@exp{KeyWord}{<stuff>}|.
% \begin{macrocode}
\def\svnKeyword@generic@exp#1#2{%
\expandafter\svn@set\csname svnKeyword#1\endcsname$#2$%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\svnKeyword@generic@unexp}
% When we see |\svnKeyword $KeyWord$| and
% |\svnKeyword@KeyWord@unexp| is undefined, we define
% |\svnKeywordKeyWord| to be |\svnKeywordempty| using
% |\svnKeyword@generic@unexp{KeyWord}|.
% \begin{macrocode}
\def\svnKeyword@generic@unexp#1#2{%
\expandafter\global\expandafter\let\csname svnKeyword#1\endcsname\svnKeywordempty
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\svn@set}
% |\svn@set#1$#2$| defines the command in \param{1} to be \param{2}
% without the trailing `\verb*| : |' that the call to |\svn@| added.
% \begin{macrocode}
\def\svn@set#1$#2 : ${\gdef#1{#2}}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Dealing with the \texttt{\string$Date\string$} keyword}
% \begin{macro}{\svnKeyword@Date@unexp}
% \begin{macro}{\svnKeyword@LastChangedDate@unexp}
% \begin{macrocode}
\def\svnKeyword@Date@unexp#1#2{}%
\let\svnKeyword@LastChangedDate@unexp\svnKeyword@Date@unexp%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\svnKeyword@Date@exp}
% \begin{macro}{\svnKeyword@LastChangedDate@exp}
% \begin{macrocode}
\def\svnKeyword@Date@exp#1#2{%
\svn@parse@date$#2$%
}%
\let\svnKeyword@LastChangedDate@exp\svnKeyword@Date@exp
% \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\svn@parse@date}
% \begin{macrocode}
\if@svnInfoSVK@
\def\svn@parse@date$#1-#2-#3T#4:#5:#6.#7${%
\@svnInfoDay =#3\relax%
\@svnInfoMonth=#2\relax%
\@svnInfoYear =#1\relax%
\def\svnInfoLongDate{\@svnInfoToday}%
\if@svnInfoToday@
\year =\@svnInfoYear
\month =\@svnInfoMonth
\day =\@svnInfoDay
\fi
% \end{macrocode}
% We could add `GMT' to |\svnKeywordTime|. Or not bother.
% \begin{macrocode}
\def\svnInfoTime{#4:#5:#6}%
}
\else
\def\svn@parse@date$#1-#2-#3 #4:#5:#6 #7${%
\@svnInfoDay =#3\relax%
\@svnInfoMonth=#2\relax%
\@svnInfoYear =#1\relax%
\def\svnInfoLongDate{\@svnInfoToday}%
\if@svnInfoToday@
\year =\@svnInfoYear
\month =\@svnInfoMonth
\day =\@svnInfoDay
\fi
\def\svnInfoTime{#4:#5:#6}%
}
\fi
% \end{macrocode}
% \end{macro}
% \subsubsection{Dealing with the \texttt{\string$Id\string$} keyword}
% \begin{macro}{\svnKeyword@Id@unexp}
% \begin{macrocode}
\def\svnKeyword@Id@unexp#1#2{}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\svnKeyword@Id@exp}
% \begin{macrocode}
\def\svnKeyword@Id@exp#1#2{%
\svn@parse@id$#2$
}%
\def\svn@parse@id$#1 : ${%
\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $ %
}%
% \end{macrocode}
% \end{macro}
% \subsubsection{Dealing with the \texttt{\string$Author\string$} keyword}
% \begin{macro}{\svnKeyword@Author@unexp}
% \begin{macro}{\svnKeyword@LastChangedBy@exp}
% \begin{macrocode}
\def\svnKeyword@Author@unexp#1#2{}%
\let\svnKeyword@LastChangedBy@unexp\svnKeyword@Author@unexp%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\svnKeyword@Author@exp}
% \begin{macro}{\svnKeyword@LastChangedBy@exp}
% \begin{macrocode}
\def\svnKeyword@Author@exp#1#2{%
\svn@parse@Author$#2$
}%
\def\svn@parse@Author$#1 : ${%
\def\svnInfoOwner{#1}%
}%
\let\svnKeyword@LastChangedBy\svnKeyword@Author@exp%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \subsubsection{Dealing with the \texttt{\string$Revision\string$} keyword}
% \begin{macro}{\svnKeyword@Revision@unexp}
% \begin{macro}{\svnKeyword@LastChangedRevision@unexp}
% \begin{macro}{\svnKeyword@Rev@unexp}
% \begin{macrocode}
\def\svnKeyword@Revision@unexp#1#2{}%
\let\svnKeyword@LastChangedRevision@unexp\svnKeyword@Revision@unexp%
\let\svnKeyword@Rev@unexp\svnKeyword@Revision@unexp%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\svnKeyword@Revision@exp}
% \begin{macro}{\svnKeyword@LastChangedRevision@exp}
% \begin{macro}{\svnKeyword@Rev@exp}
% \begin{macrocode}
\def\svnKeyword@Revision@exp#1#2{%
\svn@parse@Revision$#2$%
}%
\def\svn@parse@Revision$#1 : ${%
\def\svnInfoRevision{#1}%
\ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\) %
\OR \(#1 > \svnInfoMaxRevision \)}{\def\svnInfoMaxRevision{#1}}{}%
\ifthenelse{\(\equal{\svnInfoMinRevision}{--minrevision--}\) %
\OR \( #1 < \svnInfoMinRevision \)}{\def\svnInfoMinRevision{#1}}{}%
}%
\let\svnKeyword@LastChangedRevision@exp\svnKeyword@Revision@exp%
\let\svnKeyword@Rev@unexp\svnKeyword@Revision@exp%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \subsubsection{Dealing with the \texttt{\string$HeadURL\string$} keyword}
% \begin{macro}{\svnKeyword@HeadURL@unexp}
% \begin{macrocode}
\def\svnKeyword@HeadURL@unexp#1#2{}%
\let\svnKeyword@URL@unexp\svnKeyword@HeadURL@unexp%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\svnKeyword@HeadURL@exp}
% \begin{macrocode}
\def\svnKeyword@HeadURL@exp#1#2{%
\svn@parse@HeadURL$#2$%
}%
\def\svn@parse@HeadURL$#1 : ${%
\def\svnInfoHeadURL{#1}%
}%
\let\svnKeyword@URL@exp\svnKeyword@HeadURL@exp%
%</package>
% \end{macrocode}
% \end{macro}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \centerline{That's the end}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \Finale
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% svninfo.ins
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*ins>
\def\batchfile{svninfo.ins}
\input docstrip.tex
\Msg{}
\Msg{***********************************************************}
\Msg{** Hello to the installation of the `svninfo' package.}
\Msg{** Version 0.7.4, March 22, 2010}
\Msg{***********************************************************}
\Msg{}
\generate{
\askforoverwritefalse
% \file{svninfo.ins}{\from{svninfo.dtx}{header,ins}}
\file{svninfo.sty}{\from{svninfo.dtx}{header,package}}
\usepreamble\empty
\usepostamble\empty
\file{svninfo.perl}{\from{svninfo.dtx}{perl}}
\file{svninfo.init}{\from{svninfo.dtx}{init}}
\file{svninfo.cfg}{\from{svninfo.dtx}{header,config}}
}
\Msg{}
\Msg{***********************************************************}
\Msg{** Edit the file svninfo.cfg and set the default fancy headings package}
\Msg{** To finish the installation move the file `svninfo.sty' and}
\Msg{** svninfo.cfg to a place where LaTeX will find it.}
\Msg{** To Get the documentation: `latex svninfo.dtx'}
\Msg{** Happy TeXing}
\Msg{***********************************************************}
\Msg{}
%</ins>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% E N D of S V N I N F O . D T X
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\fi