%\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.
%% A PERL-package supporting svninfo and LaTeX2HTML is provieded too.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%% Copyright (C) 2003-2005 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 of the License, or any later version.
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
%\iffalse
% to test the checksum, uncomment    \OnlyDescription
% in the driver
%\fi
%
%% \CheckSum{345}
%% \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}}
% \newcommand{\Cmd}[1]{\texttt{$\backslash$#1}}
% \newcommand{\SVN}{\emph{Subversion}}
% \newcommand{\blank}{{\tiny$_\sqcup$}}
% \newcommand{\Id}{\texttt{\$Id\$}}
% \newcommand{\SvnInfoCmd}[1]{\texttt{$\backslash$svnInfo\blank\$Id#1\$}}
%
% \changes{v0.3}{2005/09/30}{Added support for \texttt{\$Id:\$} keywords without
% owner information (a bug reported by Uwe Ziegenhagen).}
% \changes{v0.2.1}{2005/04/07}{Added \texttt{\\svnId} (suggested by Thomas Weber).}
% \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 email: brucker@freiburg.linux.de}}
% \date{Oktober 3, 2005\\Version 0.3}
%
% \maketitle
%
% \begin{abstract}
% \noindent This package is used to extract the revision and file
% information provided by the \SVN\ revision control system
% (\texttt{http://subversion.tigris.org}). Support for the \LatexToHtml\
% conversion tool is provided\footnote{\LatexToHtml\ is a conversion
% tool that allows documents written in \LaTeX\ to become part of the
% World Wide Web. It's written by \emph{Nikos Drakos, Computer Based
% Learning Unit, University of Leeds.}}.
% \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 revison control system like \emph{SCCS}, 
% \emph{CVS}, or \SVN.
% This package assumes you are using the \SVN\ system.
% To present the version information of a document, one needs to extract it
% from some kind of text inserted by the revision control system.
% \SVN\ offers therefore the \Id\ keyword, which is expanded by the \SVN\
% \emph{update} command and contains a
% lot of useful information. This information is made available through
% this package.
%
% 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 the user wishes, the |\today| macro is redefined, so that it returns
% the \SVN\ date.
%
% 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[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[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[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.
% \end{description}
% If the \texttt{babel} package is used, the |\today| string is language
% dependent.
%
% The default options are: \emph{today,long}. In the configuration file
% |svninfo.cfg| one of fancy heading packages may be set as a default
% option too.
%
%\subsection{Commands}
%
% \subsubsection{Defining the \SVN\ 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 surrouned by \$.
% 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}}
%
% 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 (this is not valid, when translating with \LatexToHtml, see below).
%
% \subsubsection{Accessing the \SVN\ 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 \SVN\ revision number, of the
%       \emph{checked out} file.
%       Default: \texttt{--revision--}.
% \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 dependend.
%       Default: the current date.
% \item \DescribeMacro{\svnId} Mimicks the behavior of the \Id\ strings, i.e.\ it
%       prints a string with a summary of the above described information.
% \end{itemize}
%
% \subsection{\LatexToHtml}
%
% When converting a \LaTeX\ document to \texttt{HTML} using the
% \LatexToHtml\ tool,
% it's possible to use the \SVN\ information in the \texttt{HTML} document too.
% This functionality is offered by the extension file \texttt{svninfo.perl}
% which should be placed into the directory \texttt{LATEX2HTML/styles}.
% For more information have a look at the documentation of \LatexToHtml.
%
% An example is given in the file \texttt{svninfo2html.tex}.
%
% \noindent\underline{Notes}
% \begin{itemize}
% \item Use at least version \emph{99.1 release (March 30, 1999)} of
%       \LatexToHtml.
%
% \item You should |\usepackage{html}|.
%
% \item You must run \LaTeX\ on the input file before running \LatexToHtml.
%
% \item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
%       either:
%       \begin{itemize}
%       \item call \LatexToHtml\ with the option
%                  \verb|-show_section_numbers| or
%       \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
%             adding the lines in the preamble:\\
%		\verb|\begin{htmlonly}|\\
%		\verb|\input{|\emph{source}\verb|.aux}|\\
%		\verb|\end{htmlonly}|\\
% 	    which requires \verb|\usepackage{html}|.
%       \end{itemize}
%       If you don't do so, the \verb|\svnInfo...| commands give no value.
%
% \item If using the \LatexToHtml\ tool, only the last |\svnInfo| takes
%       effect, e.g.~if using several input files each having the |\svnInfo|
%       command, only the vales of the last included file are used.
%       (If this is a serious problem for you, drop me a mail).
%
% \item If the \verb|fancy| / \verb|fancyhdr| option is given to the
%       \verb|svninfo| package,
%       the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
%       page is set to the \SVN\ date.
%
% \item If you would like to set your own \verb|ADDRESS| text, you should
%       define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
%       variable in your local \texttt{.latex2html} initialization file.
%       The routine may use the \texttt{perl}
%       variables shown below. Assign a reference of this procdure to the
%       \texttt{perl}-variable
%       \verb|$svninfo::SetAddressProc|.
%       E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
%       then \\
%       \verb|$svninfo::SetAddressProc = &my_address_field|.
% \end{itemize}
%
% \newcommand{\Var}[1]{\texttt{\$svninfo::#1}}
% \noindent
% Here are the commands, the Perl-variables and their output:\\
% \begin{tabular}{lll}
% \LaTeX-command              & \texttt{perl} variable & Result for this file \\\hline
% \verb|\today|               & \texttt{\$today}       & \today           \\
% \verb|\svnInfoFile|         & \Var{File}             & \svnInfoFile     \\
% \verb|\svnInfoRevision|     & \Var{Revision}         & \svnInfoRevision     \\
% \verb|\svnInfoOwner|        & \Var{Owner}            & \svnInfoOwner    \\
% \verb|\svnInfoDate|         & \Var{Date}             & \svnInfoDate     \\
% \verb|\svnInfoLongDate|     & \Var{LongDate}         & \svnInfoLongDate \\
% \verb|\svnInfoDay|          & \Var{Day}              & \svnInfoDay      \\
% \verb|\svnInfoMonth|        & \Var{Month}            & \svnInfoMonth    \\
% \verb|\svnInfoYear|         & \Var{Year}             & \svnInfoYear     \\
% \end{tabular}
%
% \section{Examples}
%
% \newcommand{\svnExample}{
% \begin{tabular}[t]{rl}
% \Cmd{svnInfoFile}     & \svnInfoFile     \\
% \Cmd{svnInfoRevision} & \svnInfoRevision \\
% \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{today}           & \today           \\
% \end{tabular}\\
% \Cmd{svnId} \svnId
% \bigskip
%}
%
% \svnInfo $Id$
% |\svnInfo| not expanded, no colon\\
% \verb+\svnInfo $+\verb+Id$+\\
% \svnExample
%
% \svnInfo $Id:$
% |\svnInfo| not expanded, having colon\\
% \verb+\svnInfo $+\verb+Id:$+\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
% |\svnInfo| standard version\\
% {\small\verb+\svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $+}\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z $
% |\svnInfo| standard version without owner\\
% {\small\verb+\svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z $+}\\
% \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{Acknowledgements}
% %%%%%%%%%%%%%%%%%%%%%%%%%
% This package is directly based on \texttt{rcsinfo} from  
% Dr.~J{\"u}rgen Vollmer which is distributed via the CTAN archives
% in directory '\texttt{macros/latex/contrib/rcsinfo}'. All the honour
% belongs to him, I only adopted his code to the format of the 
% \verb+Id+ line subversion uses % and removed the support for 
% the outdated fancyheadings package.
%
% \section{Copyright and License}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{tabular}{ll}
% Copyright (\copyright) 1995 & Dr. J{\"u}rgen Vollmer\\
% Copyright (\copyright) 2003--2005 & Achim D.~Brucker \texttt{brucker@freiburg.linux.de}\\
% \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 of the License, or 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{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. To support
% \LatexToHtml\ some macro definitions are written to the |.aux| file.
% These macros are the used by \LatexToHtml\ and |svninfo.perl| to extract
% the \SVN\ info.
%
% What do we need, and who we are:
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{svninfo}[2005/09/29 v0.3]
%    \end{macrocode}
%
% Declare some local counters to store the \SVN\ date
%    \begin{macrocode}
\newcount\@svnInfoDay
\newcount\@svnInfoMonth
\newcount\@svnInfoYear
%    \end{macrocode}
% Declare some local counters to hold some temporary information
%    \begin{macrocode}
\newcount\@svnInfoYearTmp
\newcount\@svnInfoMonthTmp
\newcount\@svnInfoDayTmp
%    \end{macrocode}
%
% To memorize, that we want to set |\today| to the date obtained by the
% \SVN\ information.
%    \begin{macrocode}
\newif\if@svnInfoToday@
%    \end{macrocode}
%
% |\today| 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, that we want to have the the new
% \texttt{fancyhdr} footline filled with \SVN\ information.
%    \begin{macrocode}
\newif\if@svnInfoUseFancyhdr@
%    \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}{
  \@svnInfoUseFancyhdr@false
}
\DeclareOption{fancyhdr}{
  \@svnInfoUseFancyhdr@true
}
%    \end{macrocode}
%
% Ok we don't want do use it.
%    \begin{macrocode}
\DeclareOption{nofancy}{
  \@svnInfoUseFancyhdr@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{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
%    \end{macrocode}
% Load \texttt{fancyhdr} if neccessary.
%    \begin{macrocode}
\if@svnInfoUseFancyhdr@
    \RequirePackage{fancyhdr}
\fi
%    \end{macrocode}
%
% If no language for the |babel| package is given in the document,
% we have to redefine |\today| (otherwise the changed |\year|, |\month| and
% |\day| won't work). In this case use the english version of |\today|.
%    \begin{macrocode}
\def\today{\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 ``contuinuation passing'' style of
% programming.
% |\@svnInfoNext| contains the action to be done next.
%
% Some packages (e.g.\ the |babel|-package with the |french|-option)
% change the catcode of |:| (colon). If this happens, we have to
% undo this in order to parse the \Id\ string (which contains a colon)
% and restore its original catcode afterwards.
% This flag is used to store whether the state of the colon was changed to
% be active.
%    \begin{macrocode}
\newif\if@svnInfoColonIsActive@
%    \end{macrocode}

%\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}
\def\svnInfo {
   \catcode`\_=13
   \ifnum\catcode`\:=13
      \@svnInfoColonIsActive@true
      \catcode`:=12
   \else
      \@svnInfoColonIsActive@false
   \fi
   \@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 {
  \@svnInfoDefaults
  \if $#2 \let \@svnInfoNext = \@svnInfoEat
  \else   \let \@svnInfoNext = \@svnInfoEatColon
  \fi
%    \end{macrocode}
% |#2| contains either |$| or |:$| or |:|\blank\ hence we have read the colon
% and can restore the catode of it.
%    \begin{macrocode}
  \if@svnInfoColonIsActive@
     \catcode`:=13
  \fi
%    \end{macrocode}
% Start processing the \Id\ string.
%    \begin{macrocode}
  \@svnInfoNext $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 {\catcode`\_=8}
%    \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 {
  \if $#1 \let \@svnInfoNext = \@svnInfoEat
  \else   \let \@svnInfoNext = \@svnInfoCrackAndEat
  \fi
  \@svnInfoNext #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  {
  \@svnInfoCrackString #2 #3 #4 #5 #6 
  \@svnInfoNext
}
%    \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, |\today| returns from now
% on the \SVN\ date.
%
% Write some macro definitions to the |.aux| file, to support \LatexToHtml.
%    \begin{macrocode}
\def\@svnInfoCrackString #1 #2 #3 #4 #5 {
  \def\svnInfoFile{#1}
  \def\svnInfoRevision{#2}
  \def\svnInfoTime{#4}
  \if $#5 \let \@svnInfoNext = \relax
           \def\svnInfoOwner{} 
           \def\svnId{#1\ #2\ #3\ #4} 
  \else   \let \@svnInfoNext = \@svnInfoEat
           \def\svnInfoOwner{#5}
           \def\svnId{#1\ #2\ #3\ #4\ #5} 
  \fi
  \write\@mainaux{\string\def\string\svnInfoFILE{#1}}
  \write\@mainaux{\string\def\string\svnInfoREVISION{#2}}
  \write\@mainaux{\string\def\string\svnInfoTIME{#4}}
  \write\@mainaux{\string\def\string\svnInfoOWNER{#5}}

 

  \catcode`\_=8
  \@svnInfoSplitDate x#3x
  \def\svnInfoLongDate{\@svnInfoToday}
  \if@svnInfoToday@
    \year  = \@svnInfoYear
    \month = \@svnInfoMonth
    \day   = \@svnInfoDay
  \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}
\def\@svnInfoSplitDate x#1-#2-#3x{
  \@svnInfoDay  = #3
  \@svnInfoMonth= #2
  \@svnInfoYear = #1
  \write\@mainaux{\string\def\string\svnInfoDAY{#3}}
  \write\@mainaux{\string\def\string\svnInfoMONTH{#2}}
  \write\@mainaux{\string\def\string\svnInfoYEAR{#1}}
}
%    \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 |\today| 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 {%
   \@svnInfoYearTmp  = \year
   \@svnInfoMonthTmp = \month
   \@svnInfoDayTmp   = \day
   \year  = \@svnInfoYear
   \month = \@svnInfoMonth
   \day   = \@svnInfoDay
   \today%
   \year  = \@svnInfoYearTmp
   \month = \@svnInfoMonthTmp
   \day   = \@svnInfoDayTmp
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoDefaults}
% This macro sets the default values.
%    \begin{macrocode}
\def\@svnInfoDefaults {
  \@svnInfoYear  = \year
  \@svnInfoMonth = \month
  \@svnInfoDay   = \day
  \def\svnInfoFile{--sourcefile--}
  \def\svnInfoDate{\the\@svnInfoYear-\two@digits\@svnInfoMonth-%
                   \two@digits\@svnInfoDay}
  \def\svnInfoTime{--time--}
  \def\svnInfoRevision{--revision--}
  \def\svnInfoOwner{--owner--}
  \def\svnInfoYear{\the\@svnInfoYear}
  \def\svnInfoMonth{\the\@svnInfoMonth}
  \def\svnInfoDay{\the\@svnInfoDay}
  \def\svnInfoLongDate{\@svnInfoToday}
  \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@svnInfoLong@
    \def\@svnInfoFancyInfo{{\footnotesize%
                           \emph{Rev: \svnInfoRevision,
			              \svnInfoLongDate}}}
  \else
    \def\@svnInfoFancyInfo{{\footnotesize%
                          \emph{Rev: \svnInfoRevision,
				     \svnInfoDate}}}
  \fi
  \def\@svnInfoFancyFile{{\footnotesize\emph{\svnInfoFile}}}
%    \end{macrocode}
% and set it for the \texttt{fancyhdr} package.
%    \begin{macrocode}
  \if@svnInfoUseFancyhdr@
    \if@twoside
    \fancyfoot[LE,RO]{\@svnInfoFancyInfo}
    \fancyfoot[LO,RE]{\@svnInfoFancyFile}
    \fancyfoot[CO,CE]{\thepage}
    \else
    \fancyfoot[L,RO]{\@svnInfoFancyInfo}
    \fancyfoot[LO,R]{\@svnInfoFancyFile}
    \fancyfoot[C]{\thepage}
    \fi
    \renewcommand{\footrulewidth}{0.4pt}
    \if@twoside
    \fancypagestyle{plain}{%
       \fancyfoot[LE,RO]{\@svnInfoFancyInfo}
       \fancyfoot[LO,RE]{\@svnInfoFancyFile}
       \fancyfoot[CO,CE]{\thepage}
       \renewcommand{\footrulewidth}{0.4pt}
    }
    \else
      \fancypagestyle{plain}{%
         \fancyfoot[L,RO]{\@svnInfoFancyInfo}
         \fancyfoot[LO,R]{\@svnInfoFancyFile}
         \fancyfoot[C]{\thepage}
         \renewcommand{\footrulewidth}{0.4pt}
       }
    \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{
  \if@svnInfoUseFancyhdr@
    \@svnInfoFancyFoot
  \fi
}
%</package>
%    \end{macrocode}
% \centerline{That's the end}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \Finale
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
%
% svninfo2html.tex: the example file for transforming to HTML
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%<*html>
\documentclass{article}
\IfFileExists{html.sty}{\usepackage{html}}{}
\usepackage{svninfo}

\IfFileExists{html.sty}{%
% the svninfo.perl stuff needs that the .aux file has been read!
\begin{htmlonly}%
\input{svninfo2html.aux}%
\end{htmlonly}%
}{}

\newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
\newcommand{\Var}[1]{\texttt{\$svninfo::#1}}
\newcommand{\SVN}{\emph{SVN}}

\pagestyle{fancy}

\begin{document}
\svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $

\author{Achim D. Brucker\\
        \small{\texttt{brucker@freiburg.linux.de}}}
\date{\today}
\title{Example for converting a \LaTeX\ document to \texttt{HTML}\\
       using \LatexToHtml\ and the \texttt{svninfo}-package}
\maketitle

\section{Notes}
%%%%%%%%%%%%%%%

\begin{itemize}
\item Use at least version \emph{99.1 release (March 30, 1999)} of
      \LatexToHtml.

\item You should \verb|\usepackage{html}|.

\item You must run \LaTeX\ on the input file before running \LatexToHtml.

\item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
      either:
      \begin{itemize}
      \item call \LatexToHtml\ with the option
                 \verb|-show_section_numbers| or
      \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
            adding the lines in the preamble:\\
		\verb|\begin{|\verb|htmlonly}|\\  % looks ulgy, but otherwise
		\verb|\input{|\emph{source}\verb|.aux}|\\
		\verb|\end{|\verb|htmlonly}|\\    % latex2html fails.
	    which requires \verb|\usepackage{html}|.
      \end{itemize}
      If you don't do so, the \verb|\svnInfo...| commands give no value.

\item If using the \LatexToHtml\ tool, only the last \verb|\svnInfo| takes
      effect, e.g.~if using several input files each having the \verb|\svnInfo|
      command, only the vales of the last included file are used.
      (If this is a serious problem for you, drop me a mail).

\item If the \verb|fancy| / \verb|fancyhdr| option is given to the
      \verb|svninfo| package,
      the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
      page is set to the \SVN\ date.

\item If you would like to set your own \verb|ADDRESS| text, you should
      define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
      variable in your local \texttt{.latex2html} initialization file.
      The routine may use the \texttt{perl}
      variables shown below. Assign a reference of this procdure to the
      \texttt{perl}-variable
      \verb|$svninfo::SetAddressProc|.
      E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
      then \\
      \verb|$svninfo::SetAddressProc = &my_address_field|.

      For example the follownig \texttt{perl}-code does the job:
\begin{verbatim}
sub my_address_field
{
 $ADDRESS = '<hr>This file was last updated on ' .
            $svninfo::Date  .
            '&nbsp; by ' .
            '<a href="mailto: brucker@freiburg.linux.de">' .
            'Achim D. Brucker ' .
	    '&lt;brucker@freiburg.linux.de&gt;</a>';
}
$svninfo::SetAddressProc = \&my_address_field;
\end{verbatim}
\end{itemize}

\newpage

\section{Example}
%%%%%%%%%%%%%%%%%

\label{sec-examples}
Here are the commands and their output:

\begin{tabular}{lll}
\LaTeX-command              & \texttt{perl} variable & Result for this file \\\hline
\verb|\today|               & \texttt{\$today}       & \today           \\
\verb|\svnInfoFile|         & \Var{File}             & \svnInfoFile     \\
\verb|\svnInfoRevision|     & \Var{Revision}         & \svnInfoRevision  \\
\verb|\svnInfoOwner|        & \Var{Owner}            & \svnInfoOwner    \\
\verb|\svnInfoDate|         & \Var{Date}             & \svnInfoDate     \\
\verb|\svnInfoLongDate|     & \Var{LongDate}         & \svnInfoLongDate \\
\verb|\svnInfoDay|          & \Var{Day}              & \svnInfoDay      \\
\verb|\svnInfoMonth|        & \Var{Month}            & \svnInfoMonth    \\
\verb|\svnInfoYear|         & \Var{Year}             & \svnInfoYear     \\
\end{tabular}

\end{document}
%</html>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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.3, September 29, 2005}
\Msg{***********************************************************}
\Msg{}

\generate{
        \askforoverwritefalse
%        \file{svninfo.ins}{\from{svninfo.dtx}{header,ins}}
        \file{svninfo.sty}{\from{svninfo.dtx}{header,package}}
        \file{svninfo2html.tex}{\from{svninfo.dtx}{header,html}}
        \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{** and `latex svninfo2html.dtx'}
\Msg{** If you are using LaTeX2HTML, move the PERL-package}
\Msg{** `svninfo.perl' to a place where LaTeX2HTML will find it.}
\Msg{** `svninfo.perl' is created by running `latex svninfo.dtx'.}
\Msg{** Happy TeXing}
\Msg{***********************************************************}
\Msg{}
%</ins>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% 				svninfo.perl
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*perl>
###############################################################################
# SVNINFO.PERL
# Copyright 1995 Dr. Juergen Vollmer <Juergen.Vollmer@acm.org>
# Copyright 2003-2005 Achim D. Brucker <brucker@freiburg.linux.de>
#
# Extension to LaTeX2HTML to translate LaTeX commands of the
#               svninfo
# package to equivalent HTML commands.
#
# This is file `svninfo.perl',
# generated with the docstrip utility.
#
# The original source files were:
#
# svninfo.dtx  (with options: `perl')
#
# IMPORTANT NOTICE:
#
# For the copyright see the source file.
#
# Any modified versions of this file must be renamed
# with new filenames distinct from svninfo.perl.
#
# For distribution of the original source see the terms
# for copying and modification in the file svninfo.dtx.
#
# This generated file may be distributed as long as the
# original source files, as listed above, are part of the
# same distribution. (The sources need not necessarily be
# in the same archive or directory.)
#
# $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
#
###############################################################################

package svninfo;

($Dummy1,$PackageVersionDate,$PackageVersionTime,$Dummy2) =
        split (/ /,'$Date: 2005-04-08 08:18:47 +0200 (Fr, 08 Apr 2005) $');

print "\n\t svninfo style interface for LaTeX2HTML, $PackageVersionDate\n";

# set defaults options
$OptionFancy = 1;
$OptionToday = 1;
$OptionLong  = 1;

# set default values
$Date     = `date '+%Y/%m/%d'`;
$Time     = `date '+%H:%M:%S'`;
$File     = "--sourcefile--";
$Revision = "--revision--";
$Owner    = "--owner--";
$Year     = `date '+%Y'`;
$Month    = `date '+%m'`;
$Day      = `date '+%d'`;
$LongDate = $Date;

sub SetAddress
{
    $main::address_data[1] = "Revision: $svninfo::Revision, $svninfo::LongDate";
    # Supply your own string if you don't like the default <Name> <Date>
    $main::ADDRESS = "<I>$main::address_data[0] <BR>\n$main::address_data[1]</I>";
}
if ($SetAddressProc == "") {
  $SetAddressProc = \&svninfo::SetAddress;
}
sub make_cmds
{
  my $cmd;
  foreach $cmd (File,Revision,Date,Time,Owner,Year,Month,Day,LongDate) {
        eval "sub main::do_cmd_svnInfo$cmd { "
            . 'my $val = $svninfo::' . "$cmd; "
#           . 'printf STDERR "\ndo_cmd_svnInfo%s=%s\n", ' . $cmd .', $val;'
            . "join('',\$val,\$_[0]);"
            . "}";
  }
}

@GermanMonthName  = ('','Januar','Februar','M&auml;rz','April','Mai','Juni','Juli',
                    'August','September','Oktober','November','Dezember');
@EnglishMonthName = ('','January','February','March','April','May','June','July',
                    'August','September','October','November','December');
@FrenchMonthName  = ('','Janvier','F&eacute;vrier','Mars','Avril','Mai','Juin',
                     'Juillet','Ao&ucirc;t','Septembre','Octobre','Novembre',
                     'D&eacute;cembre');

###############################################################################

package main;

# handling package options
sub do_svninfo_fancyhdr { $svninfo::OptionFancy = 1; }
sub do_svninfo_fancy    { $svninfo::OptionFancy = 1; }
sub do_svninfo_nofancy  { $svninfo::OptionFancy = 0; }
sub do_svninfo_today    { $svninfo::OptionToday = 1; }
sub do_svninfo_notoday  { $svninfo::OptionToday = 0; }
sub do_svninfo_short    { $svninfo::OptionLong  = 0; }
sub do_svninfo_long     { $svninfo::OptionLong  = 1; }

# handling of LaTeX commands
sub do_cmd_svnInfo
{

    local ($_) = @_;

    # printf STDERR "\ndo_cmd_svnInfo\n";

    # see latex2html, procedure: substitute_meta_cmds, process_body_newcommand
    # the format of the variable $new_command{cmd} is:
    #   $new_command{$cmd} = join(':!:',$argn,$body,$opt);
    # note: opt = "}" means:  Flag for no optional arg
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoFILE};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoREVISION};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoYEAR};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoMONTH};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoDAY};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoTIME};
    # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoOWNER};

    # the following assumes: LaTeX2HTML Version 99.1 release (March 30, 1999)
    # may be later
    my ($argn, $opt);
    if (exists $new_command{svnInfoFILE}) {
        ($argn, $svninfo::File, $opt) = split(/:!:/, $new_command{svnInfoFILE});
    } else {
         $svninfo::File = $File
    }
    if (exists $new_command{svnInfoREVISION}) {
        ($argn, $svninfo::Revision, $opt) = split(/:!:/, $new_command{svnInfoREVISION});
    } else {
         $svninfo::Revision = $Revision
    }
    if (exists $new_command{svnInfoYEAR}) {
        ($argn, $svninfo::Year, $opt) = split(/:!:/, $new_command{svnInfoYEAR});
    } else {
         $svninfo::Year = $Year
    }
    if (exists $new_command{svnInfoMONTH}) {
        ($argn, $svninfo::Month, $opt) = split(/:!:/, $new_command{svnInfoMONTH});
    } else {
         $svninfo::Month = $Month
    }
    if (exists $new_command{svnInfoDAY}) {
        ($argn, $svninfo::Day, $opt) = split(/:!:/, $new_command{svnInfoDAY});
    } else {
         $svninfo::Day = $Day
    }
    if (exists $new_command{svnInfoTIME}) {
        ($argn, $svninfo::Time, $opt) = split(/:!:/, $new_command{svnInfoTIME});
    } else {
         $svninfo::Time = $Time
    }
    if (exists $new_command{svnInfoOWNER}) {
        ($argn, $svninfo::Owner, $opt) = split(/:!:/, $new_command{svnInfoOWNER});
    } else {
         $svninfo::Owner = $Owner
    }

    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::File;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::Revision;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::Year;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::Month;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::Day;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::Time;
    # printf STDERR "yyyyyyyyyyy `%s'\n",  $svninfo::Owner;

    # the following code is for oldfashioned latex2hmtl, not anymore supported
    # format of $_:
    #                  vvvvvv that's text following the SVN-Id-string
    # <#nr#>.....<#nr>......
    #       ^ ^ ^  that's the SVN-Id-string
#    my ($Nr,$IdString,$Rest) = /(<#\d+#>)(.*)\1(.*)/s ;

    # The Id-String  may contain various tags, remove them
#    $IdString =~ s/<[^>]*>//g;

     # The Id-String  may contain various tags, remove them
#    $IdString =~ s/<[^>]*>//g;

    # split the Id-string
#    my ($id,$file,$revision,$date,$time,$owner) = split(/\s/,$IdString);

    # remove trailing ,v
#    $file =~ s/,v$//;

    # split date
#    ($svninfo::Year,$svninfo::Month,$svninfo::Day) = split (/\//,$date);

#    $svninfo::Revision = $revision;
#    $svninfo::File     = $file;
#    $svninfo::Date     = $date;
#    $svninfo::Time     = $time;
#    $svninfo::Owner    = $owner;

    if ($default_language eq 'german' || $default_language eq 'austrian') {
        $svninfo::LongDate = $svninfo::Day . '.&nbsp;' .
                 $svninfo::GermanMonthName[$svninfo::Month] . '&nbsp;' .
                 $svninfo::Year;
        $svnInfo::Date = $svninfo::Day . '.&nbsp;' . $svninfo::Month . '.&nbsp;' . $svninfo::Year;
    } elsif ($default_language eq 'french') {
        $svninfo::LongDate = $svninfo::Day . '.&nbsp;' .
                 $svninfo::FrenchMonthName[$svninfo::Month] . '&nbsp;' .
                 $svninfo::Year;
        $svnInfo::Date = $svninfo::Day . '.&nbsp;' .$svninfo::Month . '.&nbsp;' . $svninfo::Year;
    } else { # english is the default
        $svninfo::LongDate = $svninfo::EnglishMonthName[$svninfo::Month] . '&nbsp;' .
                 $svninfo::Day . ',&nbsp;' .
                 $svninfo::Year;
        $svnInfo::Date = $svninfo::Year . '/' .$svninfo::Month . '/' . $svninfo::Day;
    }

    if ($svninfo::OptionFancy == 1) {
       &$svninfo::SetAddressProc;
    }
    svninfo::make_cmds();

    # printf STDERR "xxx $HTML_VERSION, $HTML_OPTIONS\n";
    # remove stuff generated for the $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $-string
    # we assume that noting follows the "\svnInfo $Id....$"
    if ($HTML_VERSION >= 3.2) {
        /^<tex2html_verbatim_mark>[^\n]*/;
        return $';
    } elsif ($HTML_VERSION == 3.1 || $HTML_VERSION == 2.1) {
        /^<tex2html_image_mark>[^\n]*/;
        return $';
    } else {
        if ($HTML_OPTIONS =~ /math/) {
            /^<tex2html_verbatim_mark>[^\n]*/;
            return $';
        } else {
            /^<tex2html_image_mark>[^\n]*/;
            return $';
        }
    }
}

# Replace do_cmd_today (\today) using the SVN date.
sub do_cmd_today {
    local($today);
    if ($svninfo::OptionToday == 1) {
        $today = $svninfo::LongDate;
    } else {
        if ($default_language eq 'german' || $default_language eq 'austrian') {
            $today = (`date "+%m:%d, 20%y"`);
            $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2. $svninfo::GermanMonthName[$1]/o;
            $today =~ s/20([7|8|9]\d{1})/19$1/o;
        } elsif ($default_language eq 'french') {
            $today = (`date "+%m:%d, 20%y"`);
            $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2 $svninfo::FrenchMonthName[$1]/o;
            $today =~ s/20([7|8|9]\d{1})/19$1/o;
        } else { # english is the default
            $today = (`date "+%m:%d, 20%y"`);
            $today =~ s/(\d{1,2}):0?/$svninfo::EnglishMonthName[$1] /o;
            $today =~ s/20([7|8|9]\d{1})/19$1/o;
        }
    }
    join('',$today,$_[0]);
}

1;

###############################################################################
%</perl>
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% 				latex2html.init
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%<*init>
# This is file `svninfo.init',
# generated with the docstrip utility.
#
# The original source files were:
#
# svninfo.dtx  (with options: `init')
#
# IMPORTANT NOTICE:
#
# For the copyright see the source file.
#
# Any modified versions of this file must be renamed
# with new filenames distinct from svninfo.init.
#
# For distribution of the original source see the terms
# for copying and modification in the file svninfo.dtx.
#
# This generated file may be distributed as long as the
# original source files, as listed above, are part of the
# same distribution. (The sources need not necessarily be
# in the same archive or directory.)
#
# This file should be used as initialization file for LaTeX2HTML
# when transforming svninfo2html.tex --> HTML
#
# $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
###############################################################################
sub my_address_field
{
 $ADDRESS = '<hr>This file was last updated on ' .
            $svninfo::Date  .
            '&nbsp; by ' .
            '<a href="mailto: brucker @ freiburg.linux.de@">' .
            'Achim D. Brucker ' .
	    '&lt;brucker @ freiburg.linux.de&gt;</a>';
}
$svninfo::SetAddressProc = \&my_address_field;
###############################################################################
%</init>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                    E N D     of     R C S I N F O . D T X
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\fi
