This package is used to extract the revision and file information provided by the subversion revision control system. https://www.brucker.ch/projects/svninfo/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1375 lines
47KB

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