Debian Codegraph @

texmf-dist/source/latex/svninfo/svninfo.dtx

raw
1
2 % \iffalse
3 %<*header>
4
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 %%
7 %% `svninfo' package to use with LaTeX2e.
8 %%
9 %% This package is used to extract the revision and file information provided
10 %% by the Subversion revision control system.
11 %%
12 %% Copyright (C) 1995 Dr. Juergen Vollmer
13 %% Copyright (C) 2003-2010 Achim D. Brucker
14 %%
15 %% License:
16 %% This program can be redistributed and/or modified under the terms
17 %% of the LaTeX Project Public License Distributed from CTAN
18 %% archives in directory macros/latex/base/lppl.txt; either
19 %% version 1 of the License, or any later version.
20 %%
21 %%
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23
24 %
25 %\iffalse
26 % to test the checksum, uncomment \OnlyDescription
27 % in the driver
28 %\fi
29 %
30 %% \CheckSum{628}
31 %% \CharacterTable
32 %% {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
33 %% 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
34 %% Digits \0\1\2\3\4\5\6\7\8\9
35 %% Exclamation \! Double quote \" Hash (number) \#
36 %% Dollar \$ Percent \% Ampersand \&
37 %% Acute accent \' Left paren \( Right paren \)
38 %% Asterisk \* Plus \+ Comma \,
39 %% Minus \- Point \. Solidus \/
40 %% Colon \: Semicolon \; Less than \<
41 %% Equals \= Greater than \> Question mark \?
42 %% Commercial at \@ Left bracket \[ Backslash \\
43 %% Right bracket \] Circumflex \^ Underscore \_
44 %% Grave accent \` Left brace \{ Vertical bar \|
45 %% Right brace \} Tilde \~}
46 %</header>
47 %\fi
48
49 % \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
50 % \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
51 % \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
52 % \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
53 % \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
54 % \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
55 % \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
56 % \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
57 % \DoNotIndex{\if,\else,\fi,\emph,\footnotesize,\footrulewidth,\let}
58 % \DoNotIndex{\newcount,\newif,\number,\or,\parindent,\plainfootrulewidth}
59 % \DoNotIndex{\PrintChanges,\PrintIndex,\relax,\setlength,\space}
60 % \DoNotIndex{\the,\textwidth,\thepage,\newcommand,\texttt,\verb,\vfill}
61 % \DoNotIndex{\input,\newpage,\setcounter,\newcounter,\\,\ ,\typeout,\today}
62 %
63 % \MakeShortVerb{\|}
64 % \newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
65 % \def\param#1{\texttt{\##1}}
66 % \newcommand{\Cmd}[1]{\texttt{$\backslash$#1}}
67 % \newcommand{\Svn}{\emph{Subversion}}
68 % \newcommand{\Svk}{\emph{svk}}
69 % \newcommand{\blank}{{\tiny$_\sqcup$}}
70 % \newcommand{\Id}{\texttt{\$Id\$}}
71 % \newcommand{\SvnInfoCmd}[1]{\texttt{$\backslash$svnInfo\blank\$Id#1\$\blank}}
72 %
73 % \changes{v0.7.4}{2010/03/23}{Fixed localization of date formats,
74 % e.g., \texttt{\\svnToday}.}
75 % \changes{v0.7.3}{2008/08/09}{Fixed bug resulting in wrong date for maximal
76 % revision}
77 % \changes{v0.7.2}{2008/04/28}{Fixed documentation: the option for using
78 % the \texttt{scrpage2} package is called \texttt{scrpage}. Fixed
79 % support for \texttt{svk}.}
80 % \changes{v0.7.1}{2007/04/27}{Fixed \texttt{\\svnMaxToday} and
81 % introduced \texttt{\\svnInfoMaxToday} as an alternative
82 % name. Improved documentation}
83 % \changes{v0.7}{2007/03/26}{Added option \texttt{margin} for showing
84 % version info in the margins of the document; added option
85 % \texttt{svk} for supporting the keyword expansion of svk; added command
86 % \texttt{\\svnMaxToday}; and fixed the use of \texttt{fancyhdr} for
87 % single-sided documents.}
88 % \changes{v0.6}{2006/05/11}{Added \texttt{\\svnInfoMinRevision} and
89 % \texttt{\\svnInfoMaxRevision} together with the option
90 % \texttt{revrange}. Also added support for \texttt{\textbackslash} in keywords.}
91 % \changes{v0.5}{2006/01/11}{Removed support for \LatexToHtml{} (it is
92 % non-free software and also seems to be unmaintained) and added new
93 % command \texttt{\\svnKeyword} for defining arbitrary svn keywords
94 % (e.g. \texttt{\string$Author:\string$}).}
95 % \changes{v0.4}{2005/11/07}{Added new package options \texttt{draft}, \texttt{final},
96 % \texttt{eso-foot}, and \texttt{scrpage}. Fixed problem
97 % with `\_' in file names.}
98 % \changes{v0.3}{2005/09/30}{Added support for \texttt{\$Id:\$} keywords without
99 % owner information.}
100 % \changes{v0.2.1}{2005/04/07}{Added \texttt{\\svnId}.}
101 % \changes{v0.2}{2005/01/17}{Removed \LatexToHtml{} build-dependency.}
102 % \changes{v0.1}{2003/08/14}{Initial version, mainly a modified version
103 % of the \texttt{rcsinfo} package.}
104 %
105 % \title{The \texttt{svninfo} package}
106 % \author{Achim D.~Brucker\\
107 % {\footnotesize [email protected]}\\
108 % {\footnotesize http://www.brucker.ch/}}
109 % \date{March 23, 2010\\Version 0.7.4}
110 %
111 % \maketitle
112 %
113 % \begin{abstract}
114 % \noindent This package is used to extract the revision and file
115 % information provided by the \Svn\
116 % (\texttt{http://subversion.tigris.org}) and the \Svk\
117 % (\texttt{http://svk.elixus.org}) revision control system.
118 % \end{abstract}
119 %
120 %\section{Introduction}
121 %
122 % To maintain different versions of a document or to keep track on the
123 % development of one, the document is kept under a revision control
124 % system like \emph{SCCS}, \emph{CVS}, \Svn, or \Svk. This package
125 % assumes you are using either the \Svn\ or the \Svk\ system. To
126 % present the version information of a document, one needs to extract
127 % it from somewhere. For example, \Svk\ and \Svn\ offer several keywords
128 % that are expanded by the \Svn\ and \Svk\ \emph{update}
129 % commands.\footnote{The expansion of keywords has to be enabled
130 % manually, e.g., \texttt{svn propset svn:keywords "Id"
131 % svninfo.dtx}.} The most informative keyword is |$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $| which
132 % contains a lot of useful information. This information is made
133 % available through this package. Additionally, the package allows one
134 % to extract also the information from the more specific keywords,
135 % e.g., |$Author$| or |$Date$|.
136 %
137 % In this documentation we use \Svn\ in the examples; but the results
138 % should be similar if you are using \Svk. Note that you have to use
139 % the \texttt{svk} option if you use \Svk.
140 %
141 % Moreover, one has to set the \Svn\ property for keywords expansion of
142 % that file, e.g., by executing:
143 % \begin{verbatim}
144 % svn propset svn:keywords "Id" svninfo.dtx
145 % \end{verbatim}
146 % Please consult the manual of \Svn\ (e.g., \emph{h}) or \Svk\ for further
147 % details about keyword expansion.
148 %
149 % The information obtained from the expanded \Id\ string are
150 % \begin{itemize}
151 % \item the filename,
152 % \item the revision number,
153 % \item the date and time of the last \Svn\ \emph{co} command, and
154 % \item name of the user who has done this action.
155 % \end{itemize}
156 % For each of these items a macro is defined.
157 % When \emph{updating} a file, the \Svn\ keywords should be contained in
158 % the \emph{updated} source. Further, one has to set the \Svn\ property
159 % for keyword expansion of that file, e.g.\
160 % \begin{verbatim}
161 % svn propset svn:keywords "Id" svninfo.dtx
162 % \end{verbatim}
163 % See the \Svn\ documentation for more details.
164 %
165 % If you want to read about the implementation, put a \% before
166 % |\Only|\-|Description| in the code marked with |<*driver>| in the file
167 % |svninfo.dtx|.
168 %
169 %\section{User Interface}
170 %
171 %\subsection{Options}
172 %
173 % Options for this package are:
174 % \begin{description}
175 % \item[svk]
176 % Use \texttt{svk} for parsing the Id information generated by
177 % \Svk.
178 % \item[today]
179 % Set the date of |\today| to the date obtained by the \Svn\ information.
180 % If the \Id\ string is not expanded (see below), the current date is
181 % used.
182 % \item[notoday]
183 % Don't use the \Svn\ date for |\today|.
184 % \item[revrange] For multi-file documents, display minimum and
185 % maximum revision. Every file of the document must either
186 % include a |\svnInfo| or a |\svnKeyword $Revision:$| statement.
187 % This is information needs two runs of \LaTeX{} to be correct.
188 % \item[fancyhdr]
189 % We use the \texttt{fancyhdr} package to fill the footline with
190 % \Svn\ information: filename, revision-number and date.
191 %
192 % If the \texttt{fancyhdr} package is not already loaded, it will be
193 % loaded
194 % by this package. To use the footnotes, put something like:\\
195 % \hspace*{1em}|\pagestyle{fancyplain}|\\
196 % \hspace*{1em}|\fancyhead[RE,LO]{\leftmark}|\\
197 % \hspace*{1em}|\fancyhead[LE,RO]{\thepage}|\\
198 % in the preamble.
199 % \item[nofancy]
200 % We don't define the footline. The
201 % \texttt{fancyhdr} package is not loaded.
202 % \item[scrpage]
203 % Use \texttt{scrpage2} instead of \texttt{fancyhdr}.
204 % \item[eso-foot]
205 % Use \texttt{eso-pic} for showing a tiny info line at the bottom
206 % line of the paper.
207 % \item[margin] Use \texttt{margin} for showing the version info in
208 % the margin area.
209 % \item[long]
210 % If used together with \texttt{fancy} / \texttt{fancyhdr} the date
211 % string is printed in the long format
212 % as |\today| returns it. If \texttt{fancy} / \texttt{fancyhdr}
213 % is not used, nothing.
214 % \item[short]
215 % If used together with \texttt{fancy} / \texttt{fancyhdr} the date
216 % string is printed in the short
217 % format \emph{YYYY-MM-DD}.
218 % If \texttt{fancy} / \texttt{fancyhdr} is not used, nothing.
219 % \item[final] Don't define the footline. If you want the \Svn\ in the
220 % final document, please use\\
221 % \verb|\usepackage{draft}|
222 % \item[draft] If \texttt{nofancy} is not used, show a footline with \Svn\ information.
223 % \end{description}
224 % If the \texttt{babel} package is used, the |\svnToday| string is language
225 % dependent.
226 %
227 % The default options are: \emph{draft,today,long}. You may also
228 % configure the default fancy heading packages in the configuration
229 % file |svninfo.cfg|.
230 %
231 %\subsection{Commands}
232 %
233 % \subsubsection{Defining the \Svn\ Id information}
234 %
235 % There is only one macro to define the information:
236 % |\svnInfo|\DescribeMacro{\svnInfo}. Since it must collaborate with
237 % \Svn\ it has an ``unusual'' calling sequence: The arguments are
238 % prefaced with a `\$' and completed with a `\$\blank' (note the final
239 % space or carriage return).
240 % The following arguments are valid:\\
241 % \hspace*{0.5em} \SvnInfoCmd{}\\
242 % \hspace*{0.5em} \SvnInfoCmd{:}\\
243 % \hspace*{0.5em}
244 % \SvnInfoCmd{:\blank\emph{file}\blank\emph{rev}\blank\emph{YYYY-MM-DD}\blank\emph{hh:mm:ss}\blank\emph{owner}\blank}
245 %
246 % In the first two forms, \Svn\ has not expanded the \Id\ string.
247 % This form will usually be used before the file is \emph{checked in}
248 % the first time.
249 %
250 % \emph{YYYY-MM-DD} is a date, \emph{hh:mm:ss} a time.
251 % Note: when you perform the \Svn\ \emph{check out} command, the \Id\ string
252 % is expanded by \Svn\ automatically.
253 %
254 % To take effect, |\svnInfo| must follow the |\begin{document}|.
255 % If you are using multiple files for a document, you could place
256 % |\svnInfo| at the
257 % beginning of each file, so the information from the current file is
258 % obtained.
259 %
260 % \subsubsection{Accessing the \Svn\ Id information}
261 % There are the following macros to access the information provided by \Svn.
262 % If \Svn\ has not expanded the \Id\ string, or no |\svnInfo| command is given,
263 % default values are returned.
264 %
265 % \begin{itemize}
266 % \item \DescribeMacro{\svnInfoFile} The name of the source file.
267 % Default: \texttt{--sourcefile--}.
268 % \item \DescribeMacro{\svnInfoRevision} The revision number, of the
269 % \emph{checked out} file.
270 % Default: \texttt{--revision--}.
271 % \item \DescribeMacro{\svnInfoMinRevision} The minimum revision
272 % number of multi-file documents. Every file of the document must either
273 % include a |\svnInfo| or a |\svnKeyword $Revision:$| statement.
274 % This is information needs two runs of \LaTeX{} to be correct.
275 % Default: \texttt{--minrevision--}.
276 % \item \DescribeMacro{\svnInfoMaxRevision} The maximum revision
277 % number of multi-file documents. Every file of the document must either
278 % include a |\svnInfo| or a |\svnKeyword $Revision:$| statement.
279 % This is information needs two runs of \LaTeX{} to be correct.
280 % Default: \texttt{--maxrevision--}.
281 % \item \DescribeMacro{\svnInfoDate} The date in the form \emph{YYYY-MM-DD},
282 % when the file was \emph{checked out}.
283 % Default: the current date.
284 % \item \DescribeMacro{\svnInfoTime} The time, when the file was
285 % \emph{checked out}.
286 % Default: \texttt{--time--}.
287 % \item \DescribeMacro{\svnInfoOwner} The user name of the file owner.
288 % Default: \texttt{--owner--}.
289 % \item \DescribeMacro{\svnInfoYear} The year \emph{YYYY} of |\svnInfoDate|.
290 % Default: the current year.
291 % \item \DescribeMacro{\svnInfoMonth} The month \emph{MM} of |\svnInfoDate|.
292 % Default: the current month.
293 % \item \DescribeMacro{\svnInfoDay} The day \emph{DD} of |\svnInfoDate|.
294 % Default: the current day.
295 % \item \DescribeMacro{\svnInfoLongDate} The date in the form of |\today|
296 % when the file was \emph{checked out}. This is language depended.
297 % Default: the current date.
298 % \item \DescribeMacro{\svnId} Mimics the behavior of the \Id\ strings, i.e.\ it
299 % prints a string with a summary of the above described
300 % information.
301 % \item \DescribeMacro{\svnToday} The date obtained from the \Svn\ information
302 % in the format |\today| is using.
303 % \item \DescribeMacro{\svnInfoMaxToday} The date obtained from the latest
304 % \Svn\ revision in the format |\today| is using.
305 % \end{itemize}
306 % \section{Examples}
307 %
308 % \newcommand{\svnExample}{
309 % \begin{tabular}[t]{rl}
310 % \Cmd{svnInfoFile} & \svnInfoFile \\
311 % \Cmd{svnInfoRevision} & \svnInfoRevision \\
312 % \Cmd{svnInfoMinRevision} & \svnInfoMinRevision \\
313 % \Cmd{svnInfoMaxRevision} & \svnInfoMaxRevision \\
314 % \Cmd{svnInfoDate} & \svnInfoDate \\
315 % \Cmd{svnInfoTime} & \svnInfoTime \\
316 % \Cmd{svnInfoOwner} & \svnInfoOwner \\
317 % \end{tabular}
318 % \begin{tabular}[t]{rl}
319 % \Cmd{svnInfoYear} & \svnInfoYear \\
320 % \Cmd{svnInfoMonth} & \svnInfoMonth \\
321 % \Cmd{svnInfoDay} & \svnInfoDay \\
322 % \Cmd{svnInfoLongDate} & \svnInfoLongDate \\
323 % \Cmd{svnToday} & \svnToday \\
324 % \Cmd{svnInfoMaxYear} & \svnInfoMaxYear \\
325 % \Cmd{svnInfoMaxDay} & \svnInfoMaxDay \\
326 % \Cmd{svnInfoMaxMonth} & \svnInfoMaxMonth \\
327 % \Cmd{svnInfoMaxToday} & \svnInfoMaxToday \\
328 % \end{tabular}\\
329 % \Cmd{svnId} \svnId
330 % \bigskip
331 %}
332 %
333 % \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
334 % |\svnInfo| not expanded, no colon\\
335 % \verb+\svnInfo $+\verb+Id$+\\
336 % \svnExample
337 %
338 % \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
339 % |\svnInfo| not expanded, having colon\\
340 % \verb+\svnInfo $+\verb+Id:$+\\
341 % \svnExample
342 %
343 % \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
344 % |\svnInfo| standard version\\
345 % {\small\verb+\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $+}\\
346 % \svnExample
347 %
348 % \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
349 % |\svnInfo| standard version without owner\\
350 % {\small\verb+\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $+}\\
351 % \svnExample
352 %
353 % \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $
354 % |\svnInfo| standard version with \\ in the owner \\
355 % {\small\verb+\svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $+}\\
356 % \svnExample
357 %
358 % \svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $
359 % |\svnInfo| no leading \$\\
360 % {\footnotesize\verb+\svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $+}\\
361 % \svnExample
362 %
363 % \section{The generic \Svn\ keyword interface}
364 % In addition to the already presented |\svnInfo| macro which is
365 % specially built for analyzing the \Svn\ |$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $| information we also
366 % provide a generic interface via
367 % |\svnKeyword|\DescribeMacro{\svnKeyword}. This interface can
368 % be used to extract information from the remaining keywords:
369 % \begin{itemize}
370 % \item |$Date$|: The date of the last commit with changes. This
371 % information can also be accessed using the keyword
372 % |$LastChangedDate$|.
373 % \item |$Revision$|: The revision of the last commit with
374 % changes. This information can also be accessed using the keyword
375 % |$LastChangedRevision$| or |$Rev$|.
376 % \item |$Author$|: The author of the last commit with changes. This
377 % information can also be accessed using the keyword
378 % |$LastChangeBy$|.
379 % \item |$HeadURL$|: The the full URL to the latest version of the
380 % file in the repository. This information can also be accessed
381 % using the keyword |$URL$|.
382 % \end{itemize}
383 % These keywords can be accessed using the |\svnKeyword|
384 % macro. This macro accepts a single argument that should be of the
385 % form |$|\meta{Keyword}|$| (unexpanded) or
386 % |$|\meta{Keyword}:\blank\meta{value}\blank|$| (expanded), e.g.:
387 % \begin{verbatim}
388 % \svnKeyword $Author: brucker $
389 % \end{verbatim}
390 % The |\svnKeyword| updates the corresponding \Svn\ Id
391 % information, e.g., our example updates |\svnInfoOwner|. In more
392 % detail:
393 % \begin{itemize}
394 % \item |\svnKeyword $Date:$| updates the date and time
395 % information, e.g., |\svnInfoDate|\DescribeMacro{\svnInfoDate},
396 % |\svnInfoMonth|\DescribeMacro{\svnInfoMonth}, or
397 % |\svnInfoTime|\DescribeMacro{\svnInfoTime}.
398 % \item |\svnKeyword $Revision:$| updates
399 % |\svnInfoRevision|\DescribeMacro{\svnInfoRevision}.
400 % \item |\svnKeyword $Author:$| updates
401 % |\svnInfoOwner|\DescribeMacro{\svnInfoOwner}.
402 % \item |\svnKeyword $HeadURL:$| updates
403 % |\svnInfoHeadURL|\DescribeMacro{\svnInfoHeadURL}.
404 % \end{itemize}
405 %
406 % Note, the parser used by |\svnKeyword| is not that powerful than
407 % the one used by |\svnInfo|. Thus it is advisable to use
408 % |\svnKeywordId| for the |$Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $| keyword and |\svnKeyword|
409 % only for the keywords described in this section.
410 %
411 % Further, the |\svnKeyword| macro does not reset all keyword
412 % definitions globally, i.e., you can combine the |$Revision$|
413 % of one file, with the |$Author$| of another file. Please take
414 % care of that!
415 %
416 % \section{Acknowledgments}
417 % %%%%%%%%%%%%%%%%%%%%%%%%%
418 % This package is based on \texttt{rcsinfo} from Dr.~J{\"u}rgen
419 % Vollmer. The \texttt{rcsinfo} package is distributed via the CTAN
420 % archives ('\texttt{macros/latex/contrib/rcsinfo}').
421 %
422 % The code for parsing generic \Svn{} keywords was taken from the
423 % \texttt{svn} packages written by Richard Lewis. The \texttt{svn}
424 % package is distributed via the CTAN archives
425 % ('\texttt{macros/latex/contrib/svn}').
426 %
427 % Further I want to thank all the people that reported bugs and ideas
428 % for improvements, often including patches: Andreas Haller, Benjamin
429 % Hiller, Christophe Jacquet, Dries Kimpe, Jami Lawrence, Henning
430 % Lenz, Stefan Mann, Nigel Metheringham, Igor Nikolic, Michael
431 % Niedermair, Heiko Oberdiek, Oliver Pons, Bernd Raichle, Krzysztof
432 % Retel, J\"org, Sommer, Arnout Standaert, Daniel Tr\"umper, Thomas
433 % Weber, and Uwe Ziegenhagen.
434 %
435 % \section{Copyright and License}
436 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437 %
438 % \begin{tabular}{ll}
439 % Copyright (\copyright) 1995 & Dr. J{\"u}rgen Vollmer\\
440 % Copyright (\copyright) 2003--2010 & Achim D.~Brucker \texttt{[email protected]}\\
441 % \end{tabular}
442 %
443 % \noindent This program can be redistributed and/or modified under
444 % the terms of the \LaTeX{} Project Public License Distributed from
445 % CTAN archives in directory '\texttt{macros/latex/base/lppl.txt}';
446 % either version 1 of the License, or any later version.
447 %
448 % \StopEventually{}
449 %
450 % \section{The Documentation Driver File}
451 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452 %
453 % The next bit of code contains the documentation driver file for
454 % \TeX\, i.e., the file that will produce the documentation you are
455 % currently reading. It will be extracted from this file by the
456 % \texttt{docstrip} program.
457 %
458 % If you want to read about the implementation, put a \% before
459 % |\OnlyDescription| in the following code.
460 % \begin{macrocode}
461 %<*driver>
462 \documentclass{article}
463 \usepackage{doc}
464 \usepackage[nofancy]{svninfo}
465 \OnlyDescription
466 \makeatletter
467 \if@svnInfoUseFancyhdr@
468 \pagestyle{fancyplain}
469 \if@twoside
470 \fancyhead[RE,LO]{\leftmark}
471 \fancyhead[LE,RO]{\thepage}
472 \else
473 \fancyhead[R]{\leftmark}
474 \fancyhead[L]{\thepage}
475 \fi
476 \fi
477 \makeatother
478 \RecordChanges
479 \EnableCrossrefs
480 \CodelineIndex
481 \begin{document}
482 \DocInput{svninfo.dtx}
483 \PrintChanges
484 \setcounter{IndexColumns}{2}
485 \PrintIndex
486 \end{document}
487 %</driver>
488 % \end{macrocode}
489 %
490 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492 %
493 % \section{The Configuration File}
494 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
495 %
496 % You can set up the default fancy headings package in the file
497 % |svninfo.cfg|.
498 % Use the |fancyhdr| package, by setting the default option: |fancyhdr|.
499 % \begin{macrocode}
500 %<*config>
501 \ExecuteOptions{fancyhdr}
502 %</config>
503 % \end{macrocode}
504 %
505 %
506 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 %
509 % \section{The Implementation}
510 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%
511 %
512 % The implementation is based on cracking the \Id\ string.
513 %
514 % What do we need, and who we are:
515 % \begin{macrocode}
516 %<*package>
517 \NeedsTeXFormat{LaTeX2e}
518 \ProvidesPackage{svninfo}[2010/03/22 v0.7.4]
519 % \end{macrocode}
520 %
521 % Declare some local counters to store the \Svn\ date
522 % \begin{macrocode}
523 \newcount\@svnInfoDay
524 \newcount\@svnInfoMonth
525 \newcount\@svnInfoYear
526 % \end{macrocode}
527 %
528 % To memorize, that we want to set |\svnToday| to the date obtained by the
529 % \Svn\ information.
530 % \begin{macrocode}
531 \newif\if@svnInfoToday@
532 % \end{macrocode}
533 %
534 % |\svnToday| should return the date obtained by the \Svn\ information.
535 % \begin{macrocode}
536 \DeclareOption{today}{
537 \@svnInfoToday@true
538 }
539 % \end{macrocode}
540 %
541 % Ok we don't want do use it.
542 % \begin{macrocode}
543 \DeclareOption{notoday}{
544 \@svnInfoToday@false
545 }
546 % \end{macrocode}
547 % To memorize if we should show ranges of revision (for multiple-file
548 % documents):
549 % \begin{macrocode}
550 \newif\if@svnInfoRevRange@
551 \@svnInfoRevRange@false
552 % \end{macrocode}
553 % \begin{macrocode}
554 \DeclareOption{revrange}{
555 \@svnInfoRevRange@true
556 }
557 % \end{macrocode}
558 % \begin{macrocode}
559 % To memorize if we are in final or draft mode:
560 % \begin{macrocode}
561 \newif\if@svnInfoDraft@
562 % \end{macrocode}
563 % \begin{macrocode}
564 \DeclareOption{final}{
565 \@svnInfoDraft@false
566 }
567 \DeclareOption{draft}{
568 \@svnInfoDraft@true
569 }
570 % \end{macrocode}
571 %
572 % To memorize, that we want to have the old \texttt{fancyheadings}, the new
573 % \texttt{fancyhdr}, \texttt{srcpage2}, \texttt{eso-pic}, or \texttt{margin}.
574 % footline filled with \Svn\ information.
575 % \begin{macrocode}
576 \newif\if@svnInfoNotPreamble@%
577 \@svnInfoNotPreamble@false%
578 \newif\if@svnInfoUseFancy@
579 \newif\if@svnInfoUseFancyhdr@
580 \newif\if@svnInfoUseScrpage@
581 \newif\if@svnInfoUseEsofoot@
582 \newif\if@svnInfoUseMargin@
583 \newif\if@svnInfoSVK@
584 % \end{macrocode}
585 %
586 % We want to use the \texttt{fancyhdr}
587 % package, and set the footline with the \Svn\ information.
588 % Only one option may be in effect.
589 % \begin{macrocode}
590 \DeclareOption{fancy}{
591 \@svnInfoUseFancy@true
592 \@svnInfoUseFancyhdr@false
593 \@svnInfoUseScrpage@false
594 \@svnInfoUseEsofoot@false
595 }
596 \DeclareOption{fancyhdr}{
597 \@svnInfoUseFancy@false
598 \@svnInfoUseFancyhdr@true
599 \@svnInfoUseScrpage@false
600 \@svnInfoUseEsofoot@false
601 }
602 \DeclareOption{scrpage}{
603 \@svnInfoUseFancy@false
604 \@svnInfoUseFancyhdr@false
605 \@svnInfoUseScrpage@true
606 \@svnInfoUseEsofoot@false
607 }
608 \DeclareOption{eso-foot}{
609 \@svnInfoUseFancy@false
610 \@svnInfoUseFancyhdr@false
611 \@svnInfoUseScrpage@false
612 \@svnInfoUseEsofoot@true
613 }
614 \DeclareOption{margin}{
615 \@svnInfoUseMargin@true
616 }
617 \DeclareOption{svk}{
618 \@svnInfoSVK@true
619 }
620 % \end{macrocode}
621 %
622 % Ok we don't want do use it.
623 % \begin{macrocode}
624 \DeclareOption{nofancy}{
625 \@svnInfoUseFancy@false
626 \@svnInfoUseFancyhdr@false
627 \@svnInfoUseScrpage@false
628 \@svnInfoUseEsofoot@false
629 }
630 % \end{macrocode}
631 %
632 % To memorize, that we want to use the long date format.
633 % \begin{macrocode}
634 \newif\if@svnInfoLong@
635 % \end{macrocode}
636 %
637 % We want to use the long date format.
638 % \begin{macrocode}
639 \DeclareOption{long}{
640 \@svnInfoLong@true
641 }
642 % \end{macrocode}
643 %
644 % Ok we don't want do use it.
645 % \begin{macrocode}
646 \DeclareOption{short}{
647 \@svnInfoLong@false
648 }
649 % \end{macrocode}
650 %
651 % Use these default options,
652 % \begin{macrocode}
653 \ExecuteOptions{draft,today,long}
654 % \end{macrocode}
655 %
656 % read the configuration file, to set the default fancy headings package,
657 % \begin{macrocode}
658 \IfFileExists{svninfo.cfg}{\input{svninfo.cfg}}{}
659 % \end{macrocode}
660 %
661 % and the process the user options.
662 % \begin{macrocode}
663 \ProcessOptions*\relax
664 % \end{macrocode}
665 % Load packages for page headers of footers if necessary.
666 % \begin{macrocode}
667 \if@svnInfoDraft@
668 \if@svnInfoUseFancy@
669 \RequirePackage{fancyheadings}
670 \fi
671 \if@svnInfoUseFancyhdr@
672 \RequirePackage{fancyhdr}
673 \fi
674 \if@svnInfoUseScrpage@
675 \RequirePackage{scrpage2}
676 \fi
677 \if@svnInfoUseEsofoot@
678 \RequirePackage{eso-pic}
679 \fi
680 \fi
681 % \end{macrocode}
682 %
683 % \begin{macrocode}
684 \RequirePackage{ifthen}
685 % \end{macrocode}
686 %
687 % If no language for the |babel| package is given in the document,
688 % we have to redefine |\svnToday| (otherwise the changed |\year|, |\month| and
689 % |\day| won't work). In this case use the English version of |\svnToday|.
690 % \begin{macrocode}
691 \def\svnToday{\@svnInfoToday}
692 %ifcase\month\or
693 % January\or February\or March\or April\or May\or June\or
694 % July\or August\or September\or October\or November\or December\fi
695 % \space\number\day, \number\year}
696 % \end{macrocode}
697 %
698 % We have a problem, since the number of arguments of |\svnInfo| vary from
699 % zero to five.
700 % To deal with that, we use some kind ``continuation passing'' style of
701 % programming.
702 % |\@svnInfoNext| contains the action to be done next.
703 %
704
705 %\begin{macro}{\svnInfo}
706 % Extract the \Svn\ information, and give commands shown above their values.
707 % Check the catcode of |:| and set the flag. The restoration is done after the
708 % |:| has been read. Allow \_ (underscore) in file names, hence change the
709 % |\catcode| of it.
710 % \begin{macrocode}
711
712 %
713 % Whenever reading another portion of the SVN/RCS info,
714 % expand \@svnBeginRead before calling the reading macro
715 % and call \@svnEndRead as first thing inside the reading macro.
716 \def\@svnBeginRead{\begingroup
717 \catcode`\_=13 %
718 \catcode`:=12 %
719 \catcode`\\=12 %
720 }
721 \def\@svnEndRead{\endgroup
722 }
723
724
725 \def\svnInfo {\@svnBeginRead
726 \@svnInfoReadArgs
727 }
728 % \end{macrocode}
729 %\end{macro}
730
731 %\begin{macro}{\@svnInfoReadArgs}
732 % First check, if the \Id\ string is not-expanded.
733 % Set the default values, so that for not expanded \Id\ strings, we get them.
734 % The \$ before |Id| may be omitted (I use this to avoid expansion of
735 % \$Id-Tags to be expanded by SVN in some cases).
736 % Restore the catcode of the |:|.
737 % \begin{macrocode}
738
739 \def\@svnInfoReadArgs #1Id#2 {\@svnEndRead
740 \@svnInfoDefaults
741 \if $#2 \expandafter\@svnInfoEat
742 \else \@svnBeginRead
743 \expandafter\@svnInfoEatColon
744 \fi
745 $Id#2 %
746 }
747 % \end{macrocode}
748 %\end{macro}
749
750 %\begin{macro}{\@svnInfoEat}
751 % This macro eats up its argument, i.e.\ removes it from the input.
752 % Reset the |\catcode| of the underscore.
753 % \begin{macrocode}
754 \def\@svnInfoEat #1 {}
755 % \end{macrocode}
756 %\end{macro}
757
758 %\begin{macro}{\@svnInfoEatColon}
759 % This macro eats up the colon following \texttt{Id}.
760 % The colon may be followed by a \$, which means that the \Id\ string is not
761 % expanded.
762 % \begin{macrocode}
763 \def\@svnInfoEatColon $Id:#1 {\@svnEndRead
764 \if $#1 \expandafter\@svnInfoEat
765 \else \@svnBeginRead
766 \expandafter\@svnInfoCrackAndEat
767 \fi
768 #1 %
769 }
770 % \end{macrocode}
771 %\end{macro}
772
773 %\begin{macro}{\@svnInfoCrackAndEat}
774 % Take an expanded \Id\ string pass it to the crack routine
775 % |\@svnInfoCrack|\-|String|, which specifies what has to be done
776 % after it. We have already eaten the \$.
777 % Note: here we don't give an argument to |\@svnInfoNext|, since it is taken
778 % form the source, in case of |\@svnInfoEat|.
779 % We have to take the next 7 tokens.
780 % Note, first argument (\verb|#1|) contains only spaces.
781 % \begin{macrocode}
782 \def\@svnInfoCrackAndEat #1 #2 #3 #4 #5 #6 {\@svnEndRead
783 \@svnInfoCrackString #2 #3 #4 #5 #6 %
784 }
785 % \end{macrocode}
786 %\end{macro}
787
788 %\begin{macro}{\@svnInfoCrackString}
789 % Take an expanded \Id\ string and crack it:\\
790 % \#1: filename, \#2 revision, \#3 date, \#4 time, \#5 owner\\
791 % Hence we have to consume the terminating \$ afterwards. Reset
792 % the |\catcode| of the underscore.
793 %
794 % If the document checked into the repository without authentication,
795 % the owner may be empty. In that case the argument \#5 is \$ and
796 % we already consumed the terminating \$.
797 %
798 % Split the date into year,month and day.
799 % If the option \texttt{today} is given, |\svnToday| returns from now
800 % on the \Svn\ date.
801 %
802 % \begin{macrocode}
803 \def\@svnInfoCrackString #1 #2 #3 #4 #5 {%
804 \def\svnInfoFile{#1}%
805 \def\svnInfoRevision{#2}%
806 \def\svnInfoTime{#4}%
807 %
808 \@svnInfoSplitDate x#3r#2x%
809 \@svnInfoMargin%
810 \def\svnInfoLongDate{\@svnInfoToday}%
811 %
812 \if@svnInfoToday@
813 \year =\@svnInfoYear
814 \month =\@svnInfoMonth
815 \day =\@svnInfoDay
816 \fi
817 \ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\) %
818 \OR \( \svnInfoMaxRevision < #2 \)}{%
819 \def\svnInfoMaxRevision{#2}%
820 }{}%
821 \ifthenelse{\(\equal{\svnInfoMinRevision}{--minrevision--}\) %
822 \OR \( #2 < \svnInfoMinRevision \)}{\def\svnInfoMinRevision{#2}}{}%
823 \if $#5 \def\svnInfoOwner{}%$%
824 \def\svnId{#1\ #2\ #3\ #4}%
825 \else
826 \def\svnInfoOwner{#5}%
827 \def\svnId{#1\ #2\ #3\ #4\ #5}%
828 \expandafter\@svnInfoEat
829 \fi
830 }
831 % \end{macrocode}
832 %\end{macro}
833 %
834 %\begin{macro}{\@svnInfoSplitDate}
835 % This macro sets |\svnInfoYear|, |\svnInfoMonth|, and |\svnInfoDay|.
836 % It takes a \texttt{x}\emph{YYYY-MM-DD}\texttt{x} style of argument.
837 % \begin{macrocode}
838 \if@svnInfoSVK@
839 \def\@svnInfoSplitDate x#1-#2-#3T#4Zr#5x{%
840 \@svnInfoDay =#3\relax
841 \@svnInfoMonth=#2\relax
842 \@svnInfoYear =#1\relax
843 \ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\)
844 \OR \( \svnInfoMaxRevision < #5 \)}{%
845 \def\svnInfoMaxYear{#1}%
846 \def\svnInfoMaxMonth{#2}%
847 \def\svnInfoMaxDay{#3}%
848 }{}%
849 }
850 \else%
851 \def\@svnInfoSplitDate x#1-#2-#3r#4x{%
852 \@svnInfoDay =#3\relax
853 \@svnInfoMonth=#2\relax
854 \@svnInfoYear =#1\relax
855 \ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\)
856 \OR \( \svnInfoMaxRevision < #4 \)}{%
857 \def\svnInfoMaxYear{#1}%
858 \def\svnInfoMaxMonth{#2}%
859 \def\svnInfoMaxDay{#3}%
860 }{}%
861 }
862 \fi%
863 % \end{macrocode}
864 %\end{macro}
865 %
866 %\begin{macro}{\@svnInfoToday}
867 % Returns the \Svn\ date in the form as |\today| does it.
868 % To do this, we set |\year|, |\month| and |\day| commands to the
869 % corresponding \Svn\ information, let |\svnToday| does its work, i.e.\
870 % transforming the date into a language dependent string and reset
871 % |\year|, |\month| and |\day| to their previous value.
872 %
873 % \begin{macrocode}
874 \def\@svnInfoToday {%
875 \begingroup
876 \year =\@svnInfoYear
877 \month =\@svnInfoMonth
878 \day =\@svnInfoDay
879 \today
880 \endgroup
881 }
882 \def\@svnInfoMaxToday {%
883 \begingroup
884 \year =\svnInfoMaxYear
885 \month =\svnInfoMaxMonth
886 \day =\svnInfoMaxDay
887 \today
888 \endgroup
889 }
890
891 % \end{macrocode}
892 %\end{macro}
893 %
894 %\begin{macro}{\@svnInfoDefaults}
895 % This macro sets the default values.
896 % \begin{macrocode}
897 \def\@svnInfoDefaults {%
898 \@svnInfoYear =\year
899 \@svnInfoMonth =\month
900 \@svnInfoDay =\day
901 \ifthenelse{\isundefined{\svnInfoMaxYear}}{\def\svnInfoMaxYear{\the\year}}{}
902 \ifthenelse{\isundefined{\svnInfoMaxMonth}}{\def\svnInfoMaxMonth{\the\month}}{}
903 \ifthenelse{\isundefined{\svnInfoMaxDay}}{\def\svnInfoMaxDay{\the\day}}{}
904 \def\svnInfoFile{--sourcefile--}%
905 \def\svnInfoHeadURL{--head-url--}%
906 \def\svnInfoDate{\the\@svnInfoYear-\two@digits\@svnInfoMonth-%
907 \two@digits\@svnInfoDay}%
908 \def\svnInfoTime{--time--}%
909 \def\svnInfoRevision{--revision--}%
910 \ifthenelse{\isundefined{\svnInfoMinRevision}}{\def\svnInfoMinRevision{--minrevision--}}{}%
911 \ifthenelse{\isundefined{\svnInfoMaxRevision}}{\def\svnInfoMaxRevision{--maxrevision--}}{}%
912 \def\svnInfoOwner{--owner--}%
913 \def\svnInfoYear{\the\@svnInfoYear}%
914 \def\svnInfoMonth{\the\@svnInfoMonth}%
915 \def\svnInfoDay{\the\@svnInfoDay}%
916 \def\svnInfoLongDate{\@svnInfoToday}%
917 \def\svnInfoMaxToday{\@svnInfoMaxToday}%
918 \def\svnMaxToday{\@svnInfoMaxToday}%
919 \def\svnId{\svnInfoFile\ \svnInfoRevision\ \svnInfoTime\ \svnInfoOwner}%
920 }
921
922 % \end{macrocode}
923 %\end{macro}
924 %
925 %\begin{macro}{\@svnInfoFancyFoot}
926 % This defines the contents of the footline
927 % \begin{macrocode}
928 \def\@svnInfoFancyFoot {%
929 \if@svnInfoRevRange@
930 \def\@svnInfoRevisionRange{{ (\svnInfoMinRevision : \svnInfoMaxRevision)}}%
931 \else
932 \def\@svnInfoRevisionRange{\relax}%
933 \fi
934 \if@svnInfoLong@
935 \def\@svnInfoFancyInfo{{\footnotesize
936 \emph{Rev: \svnInfoRevision\@svnInfoRevisionRange, %
937 \svnInfoLongDate}}}%
938 \else
939 \def\@svnInfoFancyInfo{{\footnotesize
940 \emph{Rev: \svnInfoRevision\@svnInfoRevisionRange, %
941 \svnInfoDate}}}%
942 \fi
943 \def\@svnInfoFancyFile{{\footnotesize\emph{\svnInfoFile}}}%
944 % \end{macrocode}
945 % and set it for the \texttt{fancyheadings} package,
946 % package page style.
947 % \begin{macrocode}
948 \if@svnInfoDraft@
949 \if@svnInfoUseFancy@
950 \rfoot[\fancyplain{\@svnInfoFancyFile}{\@svnInfoFancyFile}]%
951 {\fancyplain{\@svnInfoFancyInfo}{\@svnInfoFancyInfo}}%
952 \lfoot[\fancyplain{\@svnInfoFancyInfo}{\@svnInfoFancyInfo}]%
953 {\fancyplain{\@svnInfoFancyFile}{\@svnInfoFancyFile}}%
954 \setlength{\footrulewidth}{0.4pt}%
955 \setlength{\plainfootrulewidth}{0.4pt}%
956 \fi
957 \fi
958 % \end{macrocode}
959 % for the \texttt{fancyhdr} package,
960 % \begin{macrocode}
961 \if@svnInfoDraft@
962 \if@svnInfoUseFancyhdr@
963 \if@twoside
964 \fancyfoot[LE,RO]{\@svnInfoFancyInfo}%
965 \fancyfoot[LO,RE]{\@svnInfoFancyFile}%
966 \fancyfoot[CO,CE]{\thepage}%
967 \renewcommand{\footrulewidth}{0.4pt}%
968 \fancypagestyle{plain}{%
969 \fancyfoot[LE,RO]{\@svnInfoFancyInfo}%
970 \fancyfoot[LO,RE]{\@svnInfoFancyFile}%
971 \fancyfoot[CO,CE]{\thepage}%
972 \renewcommand{\footrulewidth}{0.4pt}%
973 }
974 \else
975 \fancyfoot[L]{\@svnInfoFancyInfo}%
976 \fancyfoot[R]{\@svnInfoFancyFile}%
977 \fancyfoot[C]{\thepage}%
978 \renewcommand{\footrulewidth}{0.4pt}%
979 \fancypagestyle{plain}{%
980 \fancyfoot[L]{\@svnInfoFancyInfo}%
981 \fancyfoot[R]{\@svnInfoFancyFile}%
982 \fancyfoot[C]{\thepage}%
983 \renewcommand{\footrulewidth}{0.4pt}%
984 }
985 \fi
986 \fi
987 \fi
988 % \end{macrocode}
989 % for the \texttt{srcpage2} package,
990 % \begin{macrocode}
991 \if@svnInfoDraft@
992 \if@svnInfoUseScrpage@
993 \clearscrheadfoot%
994 \ohead{\headmark}%
995 \cfoot[\emph{\@svnInfoFancyInfo}]{\emph{\@svnInfoFancyInfo}}%
996 \ifoot[\@svnInfoFancyFile]{\@svnInfoFancyFile}%
997 \ofoot[\pagemark]{\pagemark}%
998 \pagestyle{scrheadings}%
999 \fi
1000 \fi
1001 % \end{macrocode}
1002 % for the \texttt{eso-pic} package,
1003 % \begin{macrocode}
1004 \if@svnInfoDraft@
1005 \if@svnInfoUseEsofoot@
1006 \AddToShipoutPicture{%
1007 \setlength{\unitlength}{1mm}%
1008 \put(5,5){\tiny\svnInfoFile\quad\svnInfoRevision\quad\svnInfoDate%
1009 \quad\svnInfoTime\quad\svnInfoOwner}%
1010 }
1011 \fi
1012 \fi
1013 }
1014 % \end{macrocode}
1015 % \end{macro}
1016 % \begin{macro}{\@svnInfoMargin}
1017 % for the \texttt{margin} option.
1018 % \begin{macrocode}
1019 \def\@svnInfoMargin{
1020 \if@svnInfoDraft@
1021 \if@svnInfoNotPreamble@
1022 \if@svnInfoUseMargin@
1023 \expandafter\marginpar[%
1024 {\raggedleft\tiny\svnInfoFile, \svnInfoRevision, %
1025 \svnInfoDate, \svnInfoTime, \svnInfoOwner}%
1026 ]{%
1027 {\raggedright\tiny\svnInfoFile, \svnInfoRevision, %
1028 \svnInfoDate, \svnInfoTime, \svnInfoOwner}%
1029 }%
1030 \fi
1031 \fi
1032 \fi
1033 }
1034 % \end{macrocode}
1035 %
1036 % \end{macro}
1037 %
1038 % Initialize the defaults
1039 % \begin{macrocode}
1040 \@svnInfoDefaults
1041 % \end{macrocode}
1042
1043 % At the start of the document, if we use the
1044 % \texttt{fancyhdr} footline, we should set it here.
1045 % \begin{macrocode}
1046 \AtBeginDocument{%
1047 \@svnInfoNotPreamble@true
1048 \if@svnInfoDraft@
1049 \if@svnInfoUseFancy@
1050 \@svnInfoFancyFoot
1051 \fi
1052 \if@svnInfoUseFancyhdr@
1053 \@svnInfoFancyFoot
1054 \fi
1055 \if@svnInfoUseScrpage@
1056 \@svnInfoFancyFoot
1057 \fi
1058 \if@svnInfoUseEsofoot@
1059 \@svnInfoFancyFoot
1060 \fi
1061 \fi
1062 }
1063 % \end{macrocode}
1064 % At the end of the document
1065 % \begin{macrocode}
1066 \AtEndDocument{%
1067 \immediate\write\@mainaux{\string\gdef\string\svnInfoMinRevision{\svnInfoMinRevision}}%
1068 \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxRevision{\svnInfoMaxRevision}}%
1069 \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxDay{\svnInfoMaxDay}}%
1070 \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxMonth{\svnInfoMaxMonth}}%
1071 \immediate\write\@mainaux{\string\gdef\string\svnInfoMaxYear{\svnInfoMaxYear}}%
1072 }
1073 % \end{macrocode}
1074 %\subsection{The generic \texttt{\string\svnKeyword} command}
1075 % \begin{macro}{\svnKeyword}
1076 % |\svnKeyword| is the main construct. The single argument
1077 % should be of the form |$|\meta{Keyword}|$| or
1078 % |$|\meta{Keyword}:\meta{space}\meta{value}\meta{space}|$|, where
1079 % \meta{Keyword} and \meta{value} must be non-empty as well as
1080 % brace- and |\if|--|\fi|- balanced. \meta{space} is a single space
1081 % (if more are present they will be subsumed into \meta{value}). If
1082 % `|$empty$|', `|$generic$|', |$Time$| or ever become keywords, or
1083 % if keywords containing |@| ever exist then we may have problems.
1084 % \begin{macrocode}
1085 \def\svnKeyword $#1${\svn@$#1: $}
1086 % \end{macrocode}
1087 % \end{macro}
1088 %
1089 % \begin{macro}{\svnKeywordempty}
1090 % If \meta{Keyword} is unexpanded then |\svnKeywordKeyword| is
1091 % set to the macro |\svnKeywordempty|, which is initially empty.
1092 % \begin{macrocode}
1093 \let\svnKeywordempty\relax
1094 % \end{macrocode}
1095 % \end{macro}
1096 %
1097 % \begin{macro}{\svn@}
1098 % \begin{macro}{\svn@tmp}
1099 % |\svn@| does the work for |\svnKeyword|. It takes two
1100 % arguments, the first is the \meta{Keyword}'s name, the second is
1101 % empty (in which case \meta{Keyword} was unexpanded) or
1102 % \meta{value}, the expansion of \meta{keyword}.
1103 % \begin{macrocode}
1104 \def\svn@$#1: #2${%
1105 \def\svn@tmp{#2}%
1106 % \end{macrocode}
1107 % \begin{macro}{\svn@suffix}
1108 % If \param2 is empty, then the keyword was unexpanded and
1109 % |\svn@suffix| is set to |@unexp|, otherwise we had an
1110 % expanded keyword so |\svn@suffix| is set to |@exp|.
1111 % \begin{macrocode}
1112 \ifx\svn@tmp\@empty
1113 \def\svn@suffix{@unexp}%
1114 \else
1115 \def\svn@suffix{@exp}%
1116 \fi
1117 % \end{macrocode}
1118 % If |\svnKeyword@|\param1\meta{suffix} is defined then run it
1119 % with arguments `\param1\param2', else run
1120 % |\svnKeyword@generic@|\meta{suffix} (again with argument
1121 % \param1\param2---by default this defines `|\svnKeyword|\meta{\param1}' to
1122 % be \param2, or |\svnKeywordempty| in the unexpanded case).
1123 % \begin{macrocode}
1124 \@ifundefined{svnKeyword@#1\svn@suffix}%
1125 {\@nameuse{svnKeyword@generic\svn@suffix}{#1}{#2}}%
1126 {\@nameuse{svnKeyword@#1\svn@suffix}{#1}{#2}}%
1127 }
1128 % \end{macrocode}
1129 % \end{macro}
1130 % \end{macro}
1131 % \end{macro}
1132 % \subsubsection{Dealing with general \texttt{\string$Keyword\string$}s}
1133 % \begin{macro}{\svnKeyword@generic@exp}
1134 % When we see |\svnKeyword $KeyWord: <stuff> $|, and
1135 % |\svnKeyword@KeyWord@exp| is undefined, then we define the macro
1136 % |\svnKeywordKeyWord| to be |<stuff>| using
1137 % |\svnKeyword@generic@exp{KeyWord}{<stuff>}|.
1138 % \begin{macrocode}
1139 \def\svnKeyword@generic@exp#1#2{%
1140 \expandafter\svn@set\csname svnKeyword#1\endcsname$#2$%
1141 }
1142 % \end{macrocode}
1143 % \end{macro}
1144 %
1145 % \begin{macro}{\svnKeyword@generic@unexp}
1146 % When we see |\svnKeyword $KeyWord$| and
1147 % |\svnKeyword@KeyWord@unexp| is undefined, we define
1148 % |\svnKeywordKeyWord| to be |\svnKeywordempty| using
1149 % |\svnKeyword@generic@unexp{KeyWord}|.
1150 % \begin{macrocode}
1151 \def\svnKeyword@generic@unexp#1#2{%
1152 \expandafter\global\expandafter\let\csname svnKeyword#1\endcsname\svnKeywordempty
1153 }
1154 % \end{macrocode}
1155 % \end{macro}
1156 %
1157 % \begin{macro}{\svn@set}
1158 % |\svn@set#1$#2$| defines the command in \param{1} to be \param{2}
1159 % without the trailing `\verb*| : |' that the call to |\svn@| added.
1160 % \begin{macrocode}
1161 \def\svn@set#1$#2 : ${\gdef#1{#2}}
1162 % \end{macrocode}
1163 % \end{macro}
1164 %
1165 % \subsubsection{Dealing with the \texttt{\string$Date\string$} keyword}
1166 % \begin{macro}{\svnKeyword@Date@unexp}
1167 % \begin{macro}{\svnKeyword@LastChangedDate@unexp}
1168 % \begin{macrocode}
1169 \def\svnKeyword@Date@unexp#1#2{}%
1170 \let\svnKeyword@LastChangedDate@unexp\svnKeyword@Date@unexp%
1171 % \end{macrocode}
1172 % \end{macro}
1173 % \end{macro}
1174 %
1175 % \begin{macro}{\svnKeyword@Date@exp}
1176 % \begin{macro}{\svnKeyword@LastChangedDate@exp}
1177 % \begin{macrocode}
1178 \def\svnKeyword@Date@exp#1#2{%
1179 \svn@parse@date$#2$%
1180 }%
1181 \let\svnKeyword@LastChangedDate@exp\svnKeyword@Date@exp
1182 % \end{macrocode}
1183 % \end{macro}
1184 % \end{macro}
1185 % \begin{macro}{\svn@parse@date}
1186 % \begin{macrocode}
1187 \if@svnInfoSVK@
1188 \def\svn@parse@date$#1-#2-#3T#4:#5:#6.#7${%
1189 \@svnInfoDay =#3\relax%
1190 \@svnInfoMonth=#2\relax%
1191 \@svnInfoYear =#1\relax%
1192 \def\svnInfoLongDate{\@svnInfoToday}%
1193 \if@svnInfoToday@
1194 \year =\@svnInfoYear
1195 \month =\@svnInfoMonth
1196 \day =\@svnInfoDay
1197 \fi
1198 % \end{macrocode}
1199 % We could add `GMT' to |\svnKeywordTime|. Or not bother.
1200 % \begin{macrocode}
1201 \def\svnInfoTime{#4:#5:#6}%
1202 }
1203 \else
1204 \def\svn@parse@date$#1-#2-#3 #4:#5:#6 #7${%
1205
1206 \@svnInfoDay =#3\relax%
1207 \@svnInfoMonth=#2\relax%
1208 \@svnInfoYear =#1\relax%
1209 \def\svnInfoLongDate{\@svnInfoToday}%
1210 \if@svnInfoToday@
1211 \year =\@svnInfoYear
1212 \month =\@svnInfoMonth
1213 \day =\@svnInfoDay
1214 \fi
1215 \def\svnInfoTime{#4:#5:#6}%
1216 }
1217 \fi
1218 % \end{macrocode}
1219 % \end{macro}
1220
1221 % \subsubsection{Dealing with the \texttt{\string$Id\string$} keyword}
1222 % \begin{macro}{\svnKeyword@Id@unexp}
1223 % \begin{macrocode}
1224 \def\svnKeyword@Id@unexp#1#2{}%
1225 % \end{macrocode}
1226 % \end{macro}
1227 %
1228 % \begin{macro}{\svnKeyword@Id@exp}
1229 % \begin{macrocode}
1230 \def\svnKeyword@Id@exp#1#2{%
1231 \svn@parse@id$#2$
1232 }%
1233 \def\svn@parse@id$#1 : ${%
1234 \svnInfo $Id: svninfo.dtx 4705 2010-03-23 19:57:29Z brucker $ %
1235 }%
1236 % \end{macrocode}
1237 % \end{macro}
1238
1239 % \subsubsection{Dealing with the \texttt{\string$Author\string$} keyword}
1240 % \begin{macro}{\svnKeyword@Author@unexp}
1241 % \begin{macro}{\svnKeyword@LastChangedBy@exp}
1242 % \begin{macrocode}
1243 \def\svnKeyword@Author@unexp#1#2{}%
1244 \let\svnKeyword@LastChangedBy@unexp\svnKeyword@Author@unexp%
1245 % \end{macrocode}
1246 % \end{macro}
1247 % \end{macro}
1248 %
1249 % \begin{macro}{\svnKeyword@Author@exp}
1250 % \begin{macro}{\svnKeyword@LastChangedBy@exp}
1251 % \begin{macrocode}
1252 \def\svnKeyword@Author@exp#1#2{%
1253 \svn@parse@Author$#2$
1254 }%
1255 \def\svn@parse@Author$#1 : ${%
1256 \def\svnInfoOwner{#1}%
1257 }%
1258 \let\svnKeyword@LastChangedBy\svnKeyword@Author@exp%
1259 % \end{macrocode}
1260 % \end{macro}
1261 % \end{macro}
1262
1263 % \subsubsection{Dealing with the \texttt{\string$Revision\string$} keyword}
1264 % \begin{macro}{\svnKeyword@Revision@unexp}
1265 % \begin{macro}{\svnKeyword@LastChangedRevision@unexp}
1266 % \begin{macro}{\svnKeyword@Rev@unexp}
1267 % \begin{macrocode}
1268 \def\svnKeyword@Revision@unexp#1#2{}%
1269 \let\svnKeyword@LastChangedRevision@unexp\svnKeyword@Revision@unexp%
1270 \let\svnKeyword@Rev@unexp\svnKeyword@Revision@unexp%
1271 % \end{macrocode}
1272 % \end{macro}
1273 % \end{macro}
1274 % \end{macro}
1275 %
1276 % \begin{macro}{\svnKeyword@Revision@exp}
1277 % \begin{macro}{\svnKeyword@LastChangedRevision@exp}
1278 % \begin{macro}{\svnKeyword@Rev@exp}
1279 % \begin{macrocode}
1280 \def\svnKeyword@Revision@exp#1#2{%
1281 \svn@parse@Revision$#2$%
1282 }%
1283 \def\svn@parse@Revision$#1 : ${%
1284 \def\svnInfoRevision{#1}%
1285 \ifthenelse{\(\equal{\svnInfoMaxRevision}{--maxrevision--}\) %
1286 \OR \(#1 > \svnInfoMaxRevision \)}{\def\svnInfoMaxRevision{#1}}{}%
1287 \ifthenelse{\(\equal{\svnInfoMinRevision}{--minrevision--}\) %
1288 \OR \( #1 < \svnInfoMinRevision \)}{\def\svnInfoMinRevision{#1}}{}%
1289 }%
1290 \let\svnKeyword@LastChangedRevision@exp\svnKeyword@Revision@exp%
1291 \let\svnKeyword@Rev@unexp\svnKeyword@Revision@exp%
1292 % \end{macrocode}
1293 % \end{macro}
1294 % \end{macro}
1295 % \end{macro}
1296
1297 % \subsubsection{Dealing with the \texttt{\string$HeadURL\string$} keyword}
1298 % \begin{macro}{\svnKeyword@HeadURL@unexp}
1299 % \begin{macrocode}
1300 \def\svnKeyword@HeadURL@unexp#1#2{}%
1301 \let\svnKeyword@URL@unexp\svnKeyword@HeadURL@unexp%
1302 % \end{macrocode}
1303 % \end{macro}
1304 %
1305 % \begin{macro}{\svnKeyword@HeadURL@exp}
1306 % \begin{macrocode}
1307 \def\svnKeyword@HeadURL@exp#1#2{%
1308 \svn@parse@HeadURL$#2$%
1309 }%
1310 \def\svn@parse@HeadURL$#1 : ${%
1311 \def\svnInfoHeadURL{#1}%
1312 }%
1313 \let\svnKeyword@URL@exp\svnKeyword@HeadURL@exp%
1314 %</package>
1315 % \end{macrocode}
1316 % \end{macro}
1317 %
1318 %
1319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1320 % \centerline{That's the end}
1321 %
1322 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1323 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1324 %
1325 % \Finale
1326 %
1327 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1328 % \iffalse
1329 %
1330 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1331 %
1332 % The following stuff does not show up in the documentation of the package:
1333 % svninfo.ins
1334 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1336 %<*ins>
1337 \def\batchfile{svninfo.ins}
1338 \input docstrip.tex
1339
1340 \Msg{}
1341 \Msg{***********************************************************}
1342 \Msg{** Hello to the installation of the `svninfo' package.}
1343 \Msg{** Version 0.7.4, March 22, 2010}
1344 \Msg{***********************************************************}
1345 \Msg{}
1346
1347 \generate{
1348 \askforoverwritefalse
1349 % \file{svninfo.ins}{\from{svninfo.dtx}{header,ins}}
1350 \file{svninfo.sty}{\from{svninfo.dtx}{header,package}}
1351 \usepreamble\empty
1352 \usepostamble\empty
1353 \file{svninfo.perl}{\from{svninfo.dtx}{perl}}
1354 \file{svninfo.init}{\from{svninfo.dtx}{init}}
1355 \file{svninfo.cfg}{\from{svninfo.dtx}{header,config}}
1356 }
1357
1358 \Msg{}
1359 \Msg{***********************************************************}
1360 \Msg{** Edit the file svninfo.cfg and set the default fancy headings package}
1361 \Msg{** To finish the installation move the file `svninfo.sty' and}
1362 \Msg{** svninfo.cfg to a place where LaTeX will find it.}
1363 \Msg{** To Get the documentation: `latex svninfo.dtx'}
1364 \Msg{** Happy TeXing}
1365 \Msg{***********************************************************}
1366 \Msg{}
1367 %</ins>
1368 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1370 % E N D of S V N I N F O . D T X
1371 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1372 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1373 %\fi