Debian Codegraph @

texmf-dist/source/latex/svn-multi/svn-multi.dtx

raw
1 % \iffalse meta-comment
2 %<=*COPYRIGHT>
3 %% Copyright (C) 2006-2012 by Martin Scharrer <[email protected]>
4 %% -----------------------------------------------------------------------
5 %% This work may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.3
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.3 or later is part of all distributions of LaTeX
11 %% version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `maintained'.
14 %%
15 %% The Current Maintainer of this work is Martin Scharrer.
16 %%
17 %% This work consists of the files svn-multi.dtx and svn-multi.ins
18 %% and the derived filebase svn-multi.sty and svnkw.sty.
19 %%
20 %<=/COPYRIGHT>
21 % \fi
22 %
23 % \iffalse
24 %<*driver>
25 \ProvidesFile{svn-multi.dtx}[%
26 %<=*DATE>
27 2011/08/30
28 %<=/DATE>
29 %<=*VERSION>
30 v2.4d
31 %<=/VERSION>
32 svn-multi DTX file]
33 \documentclass{ydoc}[2011/03/19]
34 \GetFileInfo{svn-multi.dtx}
35 \usepackage[english]{babel}
36 \dateenglish
37
38 \usepackage{svn-multi}[2011/08/30]
39 \newcommand{\ie}{i.e.\@\xspace}
40 \newcommand{\eg}{e.g.\@\xspace}
41
42 \def\DescribeOption{\par\smallskip\noindent\optpar}
43 \let\scr\pkg
44 \def\svnmulti{\pkg{svn-multi}\xspace}
45 \let\csi\cs
46 \let\csd\cs
47
48 \usepackage{graphicx}
49
50 \EnableCrossrefs
51 %\DisableCrossrefs
52 \CodelineIndex
53 %\PageIndex
54 \RecordChanges
55 \OnlyDescription
56 \widowpenalty=500
57 \clubpenalty=500
58 \listfiles
59 \begin{document}
60 \DocInput{svn-multi.dtx}%
61 \PrintChanges
62 %\clearpage
63 \PrintIndex
64 \end{document}
65 %</driver>
66 % \fi
67 %
68 % \CheckSum{2887}
69 %
70 % {\makeatother
71 % \CharacterTable
72 % {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
73 % 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
74 % Digits \0\1\2\3\4\5\6\7\8\9
75 % Exclamation \! Double quote \" Hash (number) \#
76 % Dollar \$ Percent \% Ampersand \&
77 % Acute accent \' Left paren \( Right paren \)
78 % Asterisk \* Plus \+ Comma \,
79 % Minus \- Point \. Solidus \/
80 % Colon \: Semicolon \; Less than \<
81 % Equals \= Greater than \> Question mark \?
82 % Commercial at \@ Left bracket \[ Backslash \\
83 % Right bracket \] Circumflex \^ Underscore \_
84 % Grave accent \` Left brace \{ Vertical bar \|
85 % Right brace \} Tilde \~}
86 % }
87 % \changes{v1.0}{2006/05/27}{Initial version}
88 % \changes{v1.1}{2006/06/08}{Added macros to extract and typeset date/time
89 % information. Added macros to set and typeset main URL or filename.}
90 % \changes{v1.2}{2007/06/22}{Renamed package from \texttt{svnkw} to
91 % \texttt{svn-multi} to match CTAN directory. Wrapper file
92 % \texttt{svnkw.sty} is provided for backward compatibility.}
93 % \changes{v1.3}{2007/07/01}{Added verbatim support. Keywords can now contain
94 % special character like \texttt{\_ \^{} \$ \% \& \textbackslash}. Rewrote
95 % keyword check macros to work with verbatim code. \texttt{\textbackslash
96 % nofiles} is now obeyed.}
97 % \changes{v1.3a}{2007/07/10}{Fixed issue with unwanted spaces generated by
98 % \cs{svnid}, \cs{svnidlong} and \cs{svnkwsave}, \eg when used in a file which
99 % is included with \css{input}}
100 % \changes{v1.3b}{2008/12/03}{Changed the way catcodes are modified to be
101 % compatible with the french option of the babel package or other packages which
102 % modify the list of special characters.}
103 % \changes{v1.4}{2009/02/27}{Added support for timezones with non-zero minute
104 % part, \eg +0530.}
105 % \changes{v1.5}{2009/02/28}{Added \css{today}-style macros \cs{svntoday} and
106 % \cs{svnfiletoday}.}
107 % \changes{v2.0}{2009/03/23}{New features: keyword groups, external file
108 % support, auto-include of images, files as subgroups and table of revisions.}
109 % \changes{v2.1}{2009/03/27}{Added automatic extraction of keywords from
110 % Subversion 'entries' file: 'autokw' option}
111 % \changes{v2.2}{2009/10/19}{Added \css{ifsvnmodified} and
112 % \css{ifsvnfilemodified} macros. Some bug fixes.}
113 % \changes{v2.3}{2010/03/30}{Changed \css{svnidlong} to ignore all comments between verbatim arguments.}
114 % \changes{v2.3}{2010/07/19}{
115 % Fixed `autokw` to work with newer versions (1.6.x) of
116 % Subversion where the `format` file is not in the `.svn`
117 % directory anymore.
118 % Added debug output for `autokw` option.
119 % svn entries parser: fixed bugs with empty date and
120 % revision values.
121 % Fixed problem with `\cs{chapter}` defined as `\cs{relax}` in
122 % `\cs{tableofrevisions}`.
123 % Fixed unwanted spaces.
124 % Changed `\cs{svnidlong}` to allow comments with braces
125 % between arguments. This avoids problems with latexdiff.
126 % Changed catcodes to normal of reading `.svx` files.
127 % Updated code documentation.
128 % Updated user documentation.
129 % }
130 % \changes{v2.4}{2010/12/08}{
131 % Persistent data is now written to the '.aux' file, not to the '.svn' file to save a file handle.
132 % The 'fink' package usage got replaced by the 'currfile' and 'filehook' packages.
133 % }
134 % \changes{v2.4a}{2011/01/03}{
135 % Update for new version of the 'currfile' package.
136 % }
137 % \changes{v2.4b}{2011/03/20}{Fix for non-ASCII characters in keywords. Added group check for \cs{svnexternal}.}
138 % \changes{v2.4c}{2011/04/02}{Fix for modified marker 'M' used in \cs{svnid}.}
139 % \changes{v2.4d}{2011/08/30}{Fix for \cs{include} files in table-of-revisions.}
140 %
141 % ^^A \GetFileInfo{svn-multi.dtx}
142 %
143 % \DoNotIndex{\newcommand,\newenvironment,\AtBeginDocument,\AtEndDocument}
144 % \DoNotIndex{\def,\let,\edef,\xdef,\item,\space,\write,\jobname,\relax,\!}
145 % \DoNotIndex{\closeout,\csname,\DeclareRobustCommand,\else,\empty,\newwrite}
146 % \DoNotIndex{\endcsname,\expandafter,\fi,\Hurl,\hyper@normalise,\@ifnextchar}
147 % \DoNotIndex{\ifnum,\@ifundefined,\ifx,\immediate,\InputIfFileExists,\ }
148 % \DoNotIndex{\newcount,\noexpand,\openout,\PackageWarning,\@percentchar}
149 % \DoNotIndex{\@sanitize,\@makeother,\@iwsvn,\%,\_,\&,\^,\$,\#,\ ,\\,\if@filesw}
150 % \DoNotIndex{\gdef,\begingroup,\endgroup,\catcode}
151 % \DoNotIndex{\^,\ ,\_,\(,\),\$,\&,\#,\@ampersamchar,\AtEndOfPackage}
152 % \DoNotIndex{\@backslashchar,\begin,\bgroup,\chapter,\day}
153 % \DoNotIndex{\DeclareOption,\do,\dospecials,\@dottedtocline,\egroup}
154 % \DoNotIndex{\end,\ExecuteOptions,\svnmulti@date,\svnmulti@version,\@for}
155 % \DoNotIndex{\futurelet,\g@addto@macro,\global,\@gobbletwo,\hline}
156 % \DoNotIndex{\hspace,\if@restonecol,\if@twocolumn,\ignorespaces}
157 % \DoNotIndex{\makeatletter,\MakeUppercase,\@mkboth,\month,\@namedef}
158 % \DoNotIndex{\NeedsTeXFormat,\newif,\onecolumn}
159 % \DoNotIndex{\PackageError,\ProcessOptions}
160 % \DoNotIndex{\ProvidesPackage,\renewcommand,\RequirePackage}
161 % \DoNotIndex{\@restonecolfalse,\@restonecoltrue,\section,\strut}
162 % \DoNotIndex{\tableofcontents,\tableofrevisions,\texttt,\today}
163 % \DoNotIndex{\twocolumn,\@undefined,\url,\year}
164 % \DoNotIndex{\textwidth,\the,\string,\raggedright,\providecommand,\small,\toks@}
165 % \DoNotIndex{\medskipamount,\long,\leftskip,\clearpage,\advance,\addtolength}
166 % \DoNotIndex{\DeclareBoolOption,\DeclareStringOption,\DeclareVoidOption}
167 % \DoNotIndex{\ProcessKeyvalOptions,\SetupKeyvalOptions}
168 % \DoNotIndex{\@firstoftwo,\@secondoftwo,\@gobble}
169 %
170 % \GetFileInfo{svn-multi.dtx}
171 % \author{Martin Scharrer}
172 % \email{[email protected]}
173 % \ifdefined\repository
174 % \repository{https://bitbucket.org/martin_scharrer/svn-multi}
175 % \fi
176 % \maketitle
177 %
178 % \section{Introduction}
179 % This package allows to typeset version control (VC) information provided by
180 % Subversion\footnote{Subversion homepage: \url{http://subversion.tigris.org/}}
181 % keywords (\eg |$||Id: ... $|) in \LaTeX\ documents which can contain of
182 % multiple |.tex| files included using |\include| or |\input|.
183 % Subversion is a modern version control system designed to replace its
184 % predecessor CVS and uses integers as revision numbers.
185 %
186 % This package reads the keywords of all files and provides the VC information
187 % of of the most recent changed file of the document to the user through a set
188 % of macros. This information is written to an auxiliary |.aux| file during the
189 % first \LaTeX\ run and read back at the next which introduces the same delay
190 % known from the table of contents. The standard \LaTeX{} switch |\nofiles| can
191 % be used to suppress the file generation.
192 %
193 % In addition to this basic functionality several more features are provided:
194 % \begin{itemize}
195 % \item Macros to typeset the VC information of the current source file.
196 % \item Access of all parts of the VC date.
197 % \item Formatting of author names or revision numbers.
198 % \item Definition of groups and subgroups.
199 % \item Including of the VC information of external files.
200 % \item Table of Revisions.
201 % \end{itemize}
202 %
203 % \subsection{Scope of Keywords}
204 % This package provides the Subversion keyword data in several different scopes:
205 % document-global, file-local and, new with v2.0, by group.
206 %
207 % \subsubsection*{Document Global}
208 % The document global macros, like \cs{svnrev}, return the latest version
209 % control information (keyword data) for the whole multi-file document, \ie the
210 % information of the latest changed file of the document. To collect, sort and
211 % provide this information is the main functionality of this package.
212 %
213 % \subsubsection*{Local to Current File}
214 % There are also file-local macros, \eg \cs{svnfilerev}, which return the
215 % version control information of the current file, \ie the file they are used
216 % in. It is assumed here that every file using this macros calls first either a
217 % \cs{svnid} or \cs{svnidlong} macro or both. See section~\ref{sec:usage:id}
218 % for more details about the id macros. Please note that the file-local macros
219 % technically actually return the \emph{last registered} information from the
220 % last \cs{svnid} or \cs{svnidlong}. As long the \opt{filehooks} option (new in
221 % v2.0) is not enabled (explicit or implicit) this keyword macros will leak from
222 % one file over to the next. This will cause wrong results if they are used in
223 % a file before or without any id macros. With this option the macros will be
224 % reset at the beginning of every source file of the document.
225 %
226 % \subsubsection*{Groups}
227 % Version 2.0 introduces the concept of groups. Several files of a multi-file
228 % \LaTeX\ document can be grouped together and the latest version control
229 % information of all files of a group is provided by macros. This works in the
230 % same way as the global macros mentioned above but only with the files in the
231 % group. It can also be seen from the other side: the macros are local like the
232 % file-local macros mentioned above but for all files of the group, not only the
233 % current one.
234 %
235 % These groups could also be called \textit{file groups}, \textit{keyword
236 % groups} or, like in programming languages, \textit{namespaces}. In this manual
237 % they will be reference as simple \textit{groups} most the time. In places
238 % where they could be confused with \TeX\ groups (|{ }|, |\begingroup|
239 % |\endgroup|), \eg ``in the current group'' or ``group local'', they will be
240 % called \textit{keyword groups}.
241 %
242 % There is no limitation (besides internal \LaTeX\ resource limits) for the
243 % number of different groups. The files of one group do not have to be included
244 % in a row but can be included everywhere in the document. The version control
245 % information of the current group can be typeset with macros like \cs{svncgrev}
246 % (|cg| for \emph{current group}). Also, a general but less robust macro
247 % \cs{svng}\marg{group name}\marg{key} is provided to access others groups by
248 % name everywhere in the document. To avoid some macro robustness problems the
249 % current group can be changed locally for the output macros using
250 % \cs{svnsetcg}\marg{group name}.
251 %
252 % See section~\ref{sec:group} for further details and usage instructions on
253 % group macros.
254 %
255 % \section{Usage}
256 % The version control information are provided by Subversion keywords which
257 % first need to be read in by dedicated macros and can then be typeset using
258 % different macros.
259 %
260 % \subsection{Package Options}
261 % Since v2.0 this package provides options to enable only a needed features, \eg
262 % to avoid problems with other packages or save \TeX\ memory. For backwards
263 % compatibility to pre-2.0 package versions all old features are enabled by
264 % default and all new features are disabled to save a little of \TeX\ memory.
265 %
266 % All options except the first two are boolean key=value options (so far) and
267 % await either `|true|' or `|false|' as value. A missing value means `|true|'.
268 % So \eg |[groups=true,verbatim=false,external]|, enables the \opt{external} and
269 % \opt{groups} options but disables the \opt{verbatim} option.
270 %
271 % The available options are:\par
272 %
273 % \DescribeOption{old}
274 % Only pre-v2.0 features are active. This enables \opt{verbatim} and disables all
275 % other options below. This is the default for reasons mentioned above.
276 %
277 % \DescribeOption{all}
278 % Activates all features of the package except of the experimental ones.
279 %
280 % \DescribeOption{verbatim}
281 % Controls the verbatim mode of the keyword parser macros. Normally verbatim
282 % mode is very much wanted to support strange characters in URLs and file names,
283 % but this options gives the user a possibility to disable verbatim, \eg for
284 % trouble shooting. Please note that verbatim mode is needed in order to make
285 % \svnmulti work with some packages, like \pkg{babel} with the |french| option.
286 %
287 % \DescribeOption{external}
288 % Controls the support for keywords from external files described in
289 % section~\ref{sec:external}. This needs either the external script
290 % \scr{svn-multi.pl} or the \opt{autokw} option.
291 %
292 % If the \opt{groups} option is enabled the macro
293 % \csi{svnexternalgroup}\marg{group name} can be used to declare a own group
294 % which is used for all the external files. Otherwise they are placed in the
295 % currently active group. This macro can be used several times during the
296 % document where an empty argument means \emph{no group} and a `|*|' means
297 % \emph{current group}.
298 %
299 % \DescribeOption{groups}
300 % Controls the keyword groups feature described in section~\ref{sec:group}.
301 %
302 % \DescribeOption{subgroups}
303 % Controls the automatic declaration of all input files as subgroups so that
304 % there keyword information can be typeset inside other files. The group name is
305 % the file path without the file extension (`|subdir/filebase|').
306 % It is possible to disable and re-enable this using \cs{svnsubgroupsfalse} and
307 % \cs{svnsubgroupstrue} during the document preamble or body to exclude certain
308 % files. See section~\ref{sec:subgroups} for additional information.
309 %
310 % \DescribeOption{graphics}
311 % This option allows to automatically declare all images included using the
312 % macro |\includegraphics| from the \pkg{graphics}/\pkg{graphicx} package as
313 % external files (see section~\ref{sec:external}). The options \opt{external} and
314 % \opt{autoload} are activated by this option so that the produced |.svx| files
315 % are loaded automatically. An |autoload=false| option after \pkg{graphics}
316 % will deactivate this, but then an \cs{svnexternal} macro must be included in
317 % all \LaTeX\ files which should take the image revisions into account.\par The
318 % \pkg{graphics} package is loaded if this option is active. If this package is
319 % needed with some special options it should be loaded by the \LaTeX\ document
320 % before \svnmulti.\par Please note that this feature needs to tie itself into
321 % the \pkg{graphics} package and might fail if the internal structure of this
322 % package changes in future versions.
323 %
324 % If the \opt{groups} option is enabled the macro
325 % \csi{svngraphicsgroup}\marg{group name} can be used to declare a own group
326 % which is used for all the graphic files (also for pgf images, see below).
327 % Otherwise they are placed in the group specified by \cs{svnexternalgroup}
328 % which defaults to the currently active group. This macro can be used several
329 % times during the document where an empty argument means \emph{no group} and a
330 % `|*|' means \emph{current group}.\par Some graphics like logos can appear
331 % frequently in a document. Do not count them as part of each chapter they can
332 % be ignored using \csi{svnignoregraphic}\marg{file path}. The macro
333 % \csi{svnconsidergraphic}\marg{file path} disables this again. Such graphics
334 % can be then included manually using an explicit \cs{svnexternal} macro.
335 %
336 % \DescribeOption{pgfimages}
337 % Identical to like the \opt{graphics} option but for the \pkg{pgf} package
338 % (implemented against the version from 2008/01/15) with the |\pgfuseimage| and
339 % |\pgfimage| macros. Please also see the notes about package loading and ties
340 % mentioned above.
341 %
342 % \DescribeOption{autoload}
343 % Controls automatic loading of corresponding |.svx| files at the begin of files
344 % included using |\input| or |\import|. This avoids the need of putting an
345 % \cs{svnexternal} macro in every file just to load the |.svx| files created
346 % automatically by the \opt{graphics} option. The option \opt{external} is
347 % activated by \opt{autoload}.
348 %
349 % \DescribeOption{table}
350 % Controls the generation of a table of revisions which can be included using
351 % the \cs{tableofrevisions} macro. This table shows the revisions of all files
352 % and groups. This needs \opt{groups} to work which is activated with \opt{table}.
353 % Enable \opt{subgroups} to include a list of all files per group. See the
354 % section~\ref{sec:table} for more information.
355 %
356 % \DescribeOption{filehooks}
357 % This option loads the \pkg{filehook} package and installs at-begin-input-file and
358 % at-end-input-file hooks which are needed for many of the options above. While
359 % this option is enabled automatically if needed it can be also enabled
360 % manually to ensure that the file-local macros are reset to empty values at
361 % the begin of each input file. This prevents the keyword from leaking over
362 % from one file to the next. After every subfile the file-local keyword macros
363 % are also restored to the value of the parent file. A \cs{clearpage} should be
364 % added at the very end of \cs{include}d files to ensure the last page is flushed
365 % out by \TeX\ before the keyword macros are restored. Otherwise the last page
366 % might display the mainfile keyword values.
367 %
368 % \DescribeOption{autokw}
369 % This experimental feature allows the automatically extraction of the keyword
370 % values from the hidden Subversion working copy database. The database (a text
371 % file called `|entries|') is located in the hidden Subversion directory
372 % `|.svn|' (or `|_svn|' on some Windows installations) inside every directory
373 % which is under VC.
374 %
375 % This feature makes an external script like \scr{svn-multi.pl} or even keyword
376 % macros redundant as long the files are inside a Subversion working directory.
377 % However, this feature does not work if the files are exported (\eg with
378 % \texttt{svn~export}) or manually copied and also depends on the used version
379 % of Subversion. Only versions starting with 1.4 (with working copy format
380 % version 7) are supported. Earlier version used a different format for the
381 % |entries| file. Newer versions should be compatible as long the basic format
382 % is not changed again.
383 %
384 % The experimental status will be lifted after the feature was tested using
385 % different Subversion versions on different platforms. Please do not hesitate
386 % to send error reports to the package author. Minimal examples and information
387 % about the used Subversion version and platform are very much appreciated.
388 %
389 % This option allows the following values:
390 % \begin{description}
391 % \item[\texttt{false}] Feature is disabled (default).
392 % \item[\textnormal{\sffamily No value or \textbf{\texttt{true}} or
393 % \textbf{\texttt{all}}}] The keywords of all files are automatically
394 % extracted. No \cs{svnid} or \cs{svnidlong} macros or external scripts are
395 % necessary as long the files are inside a Subversion working directory and
396 % not exported.
397 % \item[\texttt{ext}] Only the keywords of external files are extracted. This
398 % avoids the need of the \scr{svn-multi.pl} script. The option \opt{external}
399 % must be still enabled manually.
400 % \end{description}
401 %
402 % \subsection{Including Subversion Keywords}\label{sec:usage:id}
403 % Subversion keywords are included using \cs{svnid} or \cs{svnidlong}. These
404 % macros should be written very early in each file, \ie in the preamble of the
405 % main document soon after |\documentclass| and |\usepackage{svn-multi}| and as
406 % first in \emph{every} subfile before an |\chapter| or similar macro. They do
407 % not create any output. See section~\ref{sec:kwaccess} to learn how to typeset
408 % the keyword values.
409 %
410 % \DescribeMacro{svnid}{'$Id$'}
411 % The macro is for the |Id| keyword and must be written like shown. A trailing
412 % colon with or without spaces after the `|Id|' is also valid but
413 % \textbf{everything else} except a valid Subversion string will cause a \TeX{}
414 % parse error. The subversion property |svn:keywords| must be set on all source
415 % files and include `|Id|' so that Subversion will expand it at the next commit.
416 %
417 % \begin{DescribeMacrosTab}{l}
418 % \Macro\svnidlong\\
419 % \MacroArgs{'$HeadURL$'} \\
420 % \MacroArgs{'$LastChangedDate$'} \\
421 % \MacroArgs{'$LastChangedRevision$'} \\
422 % \MacroArgs{'$LastChangedBy$'} \\
423 % \end{DescribeMacrosTab}
424 % Macro for a ``long Id''. Saves similar values like in `|Id|' but from the
425 % above four keywords. The usage of \cs{svnid} or \cs{svnidlong} is a matter of
426 % taste. The second is more readable inside the code and results in a nicer date
427 % and a full URL, not only the filename. However, both can also be used
428 % together. In this case the \cs{svnid} macro should be come last. Because its
429 % revision is not higher (but identical) than the revision of the \cs{svnidlong}
430 % macro it does not override its values. This way both the full time zone from
431 % the long and the file name from the short id macro can be accessed. Please
432 % note that all features from the 2.x version load the \pkg{currfile} package which
433 % lets you typeset the current file name anyway using
434 % |\currfilename|\footnote{The file name in \texttt{\${}Id\$} is always the
435 % original Subversion file name while the one given by the \pkg{currfile} package is
436 % the current file name. Both could differ if the file got renamed.}. Before v2.3
437 % the \pkg{fink} package was used to provide the file names.
438 %
439 % This macro must be written like seen above while the order of arguments is not
440 % meaningfull. The Subversion property |svn:keywords| must be set on all source
441 % files with an value which includes `|HeadURL| |LastChangedDate|
442 % |LastChangedRevision| |LastChangedBy|' or one of their alternative spellings
443 % (\eg `|URL|', `|Rev|', `|Date|', etc.).
444 %
445 % Please note that the arguments are read verbatim as long the \opt{verbatim}
446 % option is not disabled explicitly. Special precaution are taken to allow
447 % spaces, newlines and comments direct after the |\svnidlong| and after each of
448 % the four arguments. In fact everything not inside braces |{ }| is ignored.
449 %
450 % \DescribeMacro{svn}{'$'<keyword>'$'}
451 % \DescribeMacro{svn*}{'$'<keyword>'$'}
452 % This macro let you typeset svn keywords directly. The dollars will be stripped
453 % and the rest is typeset as normal text. The star version strips also the space
454 % before the last dollar. This macro alone was the very first version of
455 % |svnkw| and is still included for fast and simple keyword typesetting.
456 %
457 % \DescribeMacro{svnkwsave}{'$'<keyword>'$'}
458 % This macro lets you include and save any keyword you like. The keyword can be
459 % already expanded or not (no value and only ``|:|'' or nothing after the key
460 % name). This macro is also used internally and does not create any output.
461 % Please note that the argument is read verbatim and that there should be no
462 % space between the macro and the argument's left brace.
463 %
464 % \subsection{Groups}\label{sec:group}
465 % Starting with v2.0 files can be grouped together and the keyword values of the
466 % latest revision of a group can be accessed. Use the \opt{groups} option to
467 % activate these macros.
468 %
469 % \DescribeMacro{svngroup}{<\/group name>}
470 % This macro declares all following files until the next \cs{svngroup} as part
471 % of the given keyword group. It can be placed inside the main file before some
472 % |\include|/|\input| macros or inside subfiles before the id macros, \ie direct
473 % at the start of the file.
474 %
475 % The changes done by this macro are \TeX\ global, \ie there can't be caught
476 % using \TeX\ groups (|{ }|). However, in order to prevent subfiles to change
477 % the group of the rest of the parent file the group will be restored to the
478 % previous one at the end of each input file.
479 %
480 % The latest VC information of a group can be typeset with the |\svnvgXXX|
481 % macros or the \cs{svng} macro shown in section~\ref{sec:kwaccess}.
482 %
483 % \DescribeMacro{thesvngroup}
484 % Returns the name of the current keyword group.
485 %
486 % \DescribeMacro{svnsetcg}{<\/group name>}
487 % Normally the |\svncgXXX| macros mentioned below use the last keyword
488 % group defined by \cs{svngroup} but this can be changed using the \cs{svnsetcg}
489 % macro. The idea behind it is that the currently selected group can be
490 % changed locally to the current \TeX\ group for the keyword output macros
491 % |\svncgXXX| only while the group for the keyword input macros like \cs{svnid}
492 % is unaffected.
493 %
494 % To reset the used group to the last one defined by \cs{svngroup} simply use
495 % \cs{svnsetcg} with an `|*|' as argument.
496 %
497 % \paragraph*{Example 1:} |{\svnsetcg{abc}\svnFullAuthor{\svncgauthor}}|\\ would
498 % output the full author's name of group \textit{abc}.\par
499 % \paragraph*{Example 2:} To typeset the three keyword values of group
500 % \textit{abc} somewhere outside this group use:\\
501 % |{\svnsetcg{abc}Rev: \svncgrev\\||Date: \svncgdate\\|\\{}
502 % |Author: \svncgauthor\\}|
503 % \paragraph*{Example 3:} To typeset the date of group \textit{abc} outside of
504 % this group in the format of |\today| use: |{\svnsetcg{abc}\svncgtoday}|
505 % \smallskip
506 %
507 % \DescribeMacro{thesvncg}
508 % Returns the name of the current group selected by \cs{svnsetcg}.
509 %
510 % \subsubsection{Files as Subgroups}\label{sec:subgroups}
511 % The group feature could be used to access the version control information of
512 % single files anywhere in the document when these are defined as own groups for
513 % themselves. Because a file can only be in one group this would not be
514 % compatible with the normal usage of the group feature. Therefore a special
515 % feature was introduced to automatically or manually define a file as subgroup
516 % for itself which does not influence its membership in a normal group.
517 % \paragraph{Declaration:}
518 % This feature is enabled by the \opt{subgroups} option. All files of the
519 % document are then automatically declared as extra groups. This can be disabled
520 % for parts of the document using \csi{svnsubgroupsfalse} and re-enabled
521 % using \cs{svnsubgroupstrue} macros. The current file can be manually
522 % declared as extra group with the \cs{svnsubgroup} macro.\par
523 %
524 % \DescribeMacro{svnsubgroup}
525 % This macro declares the current file as subgroup. It is used automatically for
526 % every subfile if \opt{subgroups} and \csi{svnsubgroupstrue} are enabled.
527 %
528 % \paragraph{Exclude/Consider files extensions:}
529 % The above mentioned automatically group declaration uses an hook which is
530 % triggered every time another file is read by the document. This unfortunately
531 % includes other packages, some auxiliary files and font, config and other files
532 % read in by this packages. An internal filter is in place to ignore this files
533 % by their file extension. This filter can by modified by the two following
534 % macros.
535 %
536 % \DescribeMacro{svnignoreextensions}{<comma separated list of extension
537 % without leading dot>}
538 % Tells \svnmulti to ignore the following file extension and never declare files
539 % with them as extra groups.
540 %
541 % \DescribeMacro{svnconsiderextensions}{<comma separated list of extension
542 % without leading dot>}
543 % Tells \svnmulti to (re-)consider the following file extension and declare
544 % files with them as extra groups if read in.
545 %
546 % \paragraph{Typesetting:}
547 % The keyword information of the subgroups (subfile including any included
548 % external files or subsubfiles) can be typeset using the normal group typeset
549 % macros mentioned below where the group name is the file path without
550 % extension. The keyword information of the |.tex| file alone can be typeset
551 % with the full file path including extension.
552 % \paragraph{Example:} |\svnsetcg{subdir/some_file.tex}\svncgrev| would typeset
553 % the revision of the file |some_file.tex| while
554 % |\svnsetcg{subdir/some_file}\svncgrev| would typeset the latest revision of
555 % the same file or any subfile or declared external file included by it.
556 %
557 %
558 % \subsection{Typesetting the Keyword Values}\label{sec:kwaccess}
559 % The following macros can be used to typeset the keyword values anywhere in the
560 % document. Please note that not all \LaTeX{} fonts have all special
561 % characters, \eg `|_|' is not provided in the standard roman font. To proper
562 % typeset file names and URLs containing these letters you can use either
563 % teletype font (|\texttt|) or use |{\urlstyle{rm}\svnnolinkurl{...}}| which
564 % requires the \pkg{hyperref} package.
565 %
566 % Like already mentioned \svnmulti knows three scopes of keywords. The first
567 % contains of the keywords for the complete document which hold the values of
568 % the most recent committed file and the second contains of the \emph{current}
569 % or \emph{file local} keywords, \eg the keywords of the current file. Only this
570 % two are described here while the third scope is described in
571 % section~\ref{sec:group}.
572 %
573 % \DescribeMacro{svnrev}
574 % \DescribeMacro{svndate}
575 % \DescribeMacro{svnauthor}
576 % These macros hold the keyword values of the whole document, \ie of the most
577 % recent revision. They can be used everywhere in every file of the \LaTeX{}
578 % document, after |\usepackage{svn}| of course. Please see
579 % section~\ref{sec:date} how to typeset parts of the date.
580 %
581 % \DescribeMacro{svnfilerev}
582 % \DescribeMacro{svnfiledate}
583 % \DescribeMacro{svnfileauthor}
584 % These macros hold the keyword values of the current \LaTeX{} file, but only if
585 % it contains a \cs{svnid} or \cs{svnidlong} macro. Otherwise the macros hold
586 % either zero values or the values of the last file dependent on whether an
587 % option is enabled which enabled the \pkg{currfile} package. Please see
588 % section~\ref{sec:date} how to typeset parts of the date. See \cs{svnkw} below
589 % for all other keywords.
590 %
591 % \DescribeMacro{svncgrev}
592 % \DescribeMacro{svncgauthor}
593 % \DescribeMacro{svncgdate}
594 % These macros return keyword values of the currently selected keyword group.
595 % In order to hold them robust, which is important to use them in macros like
596 % \cs{svnFullAuthor}, they do not provide any arguments to select other groups
597 % than the current one. To access keyword values of other groups use the general
598 % macro \cs{svng} or change the locally selected keyword group using the macro
599 % \cs{svnsetcg}.
600 %
601 % \DescribeMacro{svng}{<\/group name>}{<key>}
602 % This macro is a general form of the |\svncgXXX| macro mentioned above.
603 % The first argument is the requested keyword group, the second one the
604 % requested keyword in the form of |rev|, |date|, |author|, |year|, etc.. Please
605 % note that this macro can not be used inside macros like \cs{svnFullAuthor}.
606 %
607 %
608 % \DescribeMacro{svnmainurl}
609 % \DescribeMacro{svnmainfilename}
610 % The macro \cs{svnmainurl} and \cs{svnmainfilename} hold the URL and the
611 % filename of the main \LaTeX{file} as long the keywords |HeadURL| or |Id| were
612 % used in it, respectively. These can be used to typeset this information
613 % anywhere in the document which might be more descriptive as the name of the
614 % current file (which can be typeset with \cs{svnkw}|{HeadURL}| or
615 % \cs{svnkw}|{Filename}| after \cs{svnid} or \cs{svnidlong}, respectively).
616 %
617 % \DescribeMacro{svnsetmainfile}
618 % This will declare the current file as the main LaTeX file by defining the
619 % above macros. It will automatically be called at the end of the preamble so
620 % the user normally doesn't have to use it by him- or herself as long it isn't
621 % needed in the preamble.\par Please note that this macro changes the
622 % definition of \cs{svnmainurl} and \cs{svnmainfilename} directly without going
623 % over the auxiliary file. Calling it in several files will make this two macros
624 % inconsistent.
625 %
626 % \DescribeMacro{svnkw}{<keyword name>}
627 % All keywords saved with \cs{svnid}, \cs{svnidlong} or \cs{svnkwsave} can be
628 % typeset by this macro which is a holdover from a very early version of this
629 % package when multiple files where not supported. It takes one argument which
630 % must be a subversion keyword name. It then returns the current value of this
631 % keyword or nothing (|\relax|) when the keyword was not set yet.
632 % Examples:\\
633 % \indent\indent |\textsl{Revision: \svnkw{Revision}}|\\
634 % \indent\indent |URL: \url{\svnkw{HeadURL}}|\\
635 % In the second example |\url| (\pkg{hyperref} package) is used to add a hyperlink
636 % and to avoid problems with underscores (|_|) inside the URL. \svnmulti is
637 % also providing a macro \cs{svnnolinkurl} which works like |\url| but doesn't
638 % adds an hyperlink. See the description of this macro for more details.
639 %
640 % If the given keyword doesn't exists a package warning is given to allow
641 % spelling errors to be tracked down. This doesn't work well when \cs{svnkw} is
642 % used inside |\url|. In this case the warning code will be typeset(!) verbatim
643 % into the document by |\url|.
644 %
645 % \DescribeMacro{svnkwdef}{<keyword name>}{<value>}
646 % This macro is used to define the keyword values. This is normally only called
647 % internally but could be used by the user to override single keywords. The
648 % values can then be typeset by \cs{svnkw}. Note that this macro has no
649 % influence on the calculation of the latest revision.
650 %
651 % Note that for \cs{svnkw} and \cs{svnkwdef} all different names for one keyword
652 % are valid and result in the access of the same variable. So \eg subversion
653 % treats |Rev|, |Revision| and |LastChangedRev| the same way and so does this
654 % macros. You can \eg say |\svnkwdef{Rev}{123}| and then typeset it with
655 % |\svnkw{Revision}| or |\svnkw{LastChangedRev}| if you like.
656 %
657 % \subsubsection*{New in version 2.2. Will change in future versions:}
658 % \DescribeMacro{ifsvnfilemodified}{<case:~modified>}{<case:~not
659 % modified>}
660 % \DescribeMacro{ifsvnmodified}{<case:~modified>}{<case:~not modified>}
661 % This two macro can be used to check if either the current or any file was
662 % modified after it was last checked into the repository. At the moment (v2.2) a
663 % file is marked `modified' if there is either a `|*|' or `|M|' after the
664 % revision number, \eg `|$||Rev: 123M $|'. Such an marker is automatically added
665 % for exported files (`|svn export|') if there where locally modified, but can
666 % also be added manually.
667 %
668 % Future versions of this package might mark files as modified by use of the
669 % \opt{autokw} option which can read this information out of the working
670 % directory Subversion entries.
671 %
672 % \subsection{Accessing Date Values}\label{sec:date}
673 % \begin{DescribeMacrosTab}{lll}
674 % \Macro{svnyear}&
675 % \Macro{svnfileyear}&
676 % \Macro{svncgyear}\\
677 % \Macro{svnmonth}&
678 % \Macro{svnfilemonth}&
679 % \Macro{svncgmonth}\\
680 % \Macro{svnday}&
681 % \Macro{svnfileday}&
682 % \Macro{svncgday}\\
683 % \Macro{svnhour}&
684 % \Macro{svnfilehour}&
685 % \Macro{svncghour}\\
686 % \Macro{svnminute}&
687 % \Macro{svnfileminute}&
688 % \Macro{svncgminute}\\
689 % \Macro{svnsecond}&
690 % \Macro{svnfilesecond}&
691 % \Macro{svncgsecond}\\
692 % \Macro{svntimezone}&
693 % \Macro{svnfiletimezone}&
694 % \Macro{svncgtimezone}\\
695 % \Macro{svntimezonehour}&
696 % \Macro{svnfiletimezonehour}&
697 % \Macro{svncgtimezonehour}\\
698 % \Macro{svntimezoneminute}&
699 % \Macro{svnfiletimezoneminute}&
700 % \Macro{svncgtimezoneminute}\\
701 % \end{DescribeMacrosTab}
702 % \\*[\medskipamount]
703 % Whenever the date information is read, \ie by
704 % \cs{svnkwsave}|{LastChangedDate}| \cs{svnkwsave}|{Date}|, \cs{svnidlong} or
705 % \cs{svnid}, the following macros are set to the appropriate date parts for the
706 % current file (the |\svnfile...| versions) and for the whole document.
707 %
708 % Please note that the hour and timezone are dependent on the keyword which
709 % defines the date information. The hour will be in UTC aka Zulu-time, \ie
710 % timezone +0000, when the date comes from the |Id| keyword.
711 % Otherwise the hour and timezone will be in local time.
712 % To avoid confusion the |Id| and |Date|/|LastChangedDate| keywords, \eg
713 % \cs{svnid} and \cs{svnidlong}, should not be intermixed and/or the timezone
714 % should always be typeset together with the time.
715 %
716 % Starting with v1.4 of \svnmulti the timezone macros return the full
717 % timezone, \ie sign, hour and minute part, \eg |+0100|, not only the sign and
718 % hour. The new macros % \cs{svntimezonehour}/\cs{svnfiletimezonehour} and
719 % \cs{svntimezoneminute}/\linebreak[3]\cs{svnfiletimezoneminute} can be used to
720 % access only the hour including sign or the minute part, respectively.
721 %
722 % Older versions of this manual assumed the minute part as always |00| and
723 % suggested to add it manually if needed: |\svnfiletimezone00| or
724 % |\svntimezone00|. In order not to ``break'' documents which followed this
725 % suggestion this two macros now remove a trailing |00| if present. However,
726 % this can be a problem when they are used inside an argument of another macro.
727 % One solution for this is to redefine them without the |00| removal part:\\
728 % \begingroup\small
729 % |\renewcommand{\svntimezone}{\svntimezonehour\svntimezoneminute}|\\
730 % |\renewcommand{\svnfiletimezone}{\svnfiletimezonehour\svnfiletimezoneminute}|
731 % \endgroup\par
732 % To revert to the old (pre-v1.4) definition use:\\
733 % \begingroup\small
734 % |\renewcommand{\svntimezone}{\svntimezonehour}|\\
735 % |\renewcommand{\svnfiletimezone}{\svnfiletimezonehour}|
736 % \endgroup
737 % \vspace{1ex}
738 %
739 % \DescribeMacro{svntime}
740 % \DescribeMacro{svnfiletime}
741 % \DescribeMacro{svncgtime}
742 % This macros return the time part of the date only and simply return the
743 % corresponding hour, minute and second macros with a colon as separator.
744 %
745 % \DescribeMacro{svnpdfdate}
746 % Returns the last changed date of the whole document in a format needed for
747 % |\pdfinfo|. Can be used like this:\\
748 % \hbox{}\hfill|\pdfinfo{ /CreationDate (D:\svnpdfdate) }|\hfill\hbox{}\\
749 % to set the PDF creation date to the last changed date if you use |pdflatex| to
750 % compile your \LaTeX{} document.
751 %
752 % \DescribeMacro{svntoday}
753 % \DescribeMacro{svnfiletoday}
754 % \DescribeMacro{svncgtoday}
755 % These macros typeset the document-global, current-file or current-group date,
756 % respectively, using the format of |\today| which depends on the used language.
757 % To adjust the language of your document use the \pkg{babel} package.
758 %
759 % \subsection{Using Full Author Names}
760 % If you like to have the full author\footnote{This means subversion authors,
761 % \eg the persons who commit changes into the svn repository.} names, not only
762 % the usernames, in your document you can use the following macros. First you
763 % have to register all authors of the document with \cs{svnRegisterAuthor} and
764 % then you can write \eg |\svnFullAuthor{\svnauthor}| or
765 % |\svnFullAuthor{\svnfileauthor}|.
766 %
767 % \DescribeMacro{svnRegisterAuthor}{<author>}{<\/full name>}
768 % This macro registers \meta{full name} as full name for \meta{author} (a
769 % subversion username) for later use with \cs{svnFullAuthor}.
770 %
771 % \DescribeMacro{svnFullAuthor}{<author name or macro>}
772 % \DescribeMacro{svnFullAuthor*}{<author name or macro>}
773 % Takes the username as argument and returns the full name if it was registered
774 % first with \cs{svnRegisterAuthor}, otherwise it returns the given username.
775 % The star version returns the username in parentheses after the full name.
776 % This is normally used in one of the following forms:\\
777 % \hspace*{3em}\cs{svnFullAuthor}|{|\cs{svnauthor}|}|\\
778 % \hspace*{3em}\cs{svnFullAuthor}|{|\cs{svnfileauthor}|}|\\
779 % \hspace*{3em}\cs{svnFullAuthor}|{|\cs{svncgauthor}|}|
780 %
781 % \subsection{Using Full Revision Names}
782 % Like the author's also revision names/tags can be registered and used later.
783 % These macros were implemented on user request and have the drawback that you
784 % have to guess the next revision number of your document in order to get
785 % correct results when you like to tag the to-be-checked-in revision. Please
786 % note that this has nothing to do with the normal subversion tagging.
787 %
788 % \DescribeMacro{svnRegisterRevision}{<revision number>}{<tag name>}
789 % This registers \meta{tag name} as tag name for \meta{revision number} for
790 % later use with \cs{svnFullRevision}.
791 %
792 % \DescribeMacro{svnFullRevision}{<revision number or macro>}
793 % \DescribeMacro{svnFullRevision*}{<revision number or macro>}
794 % Takes a revision number coming from a macro like \cs{svnrev}, \cs{svnfilerev}
795 % or a number as argument and returns the full name if it was registered first
796 % with \cs{svnRegisterRevision}, otherwise it returns ``Revision \meta{revision
797 % number}''. The star version returns also the revision number leaded by `r' in
798 % parentheses after the tag name, \eg |Name (r123)|.
799 %
800 % \subsection{Verbatim URLs with and without Hyperlinks}
801 % \vspace{-\baselineskip}
802 % \DescribeMacro{svnnolinkurl}{<macro with returns special text>}
803 % This macro allows you to write |\svnnolinkurl{\svnkw{HeadURL}}| and get the
804 % Head URL typeset verbatim. However |\url{|\cs{svnkw}|{HeadURL}}|
805 % (\pkg{hyperref} package) gives you the same result with a hyperlink. Both
806 % macros require the \pkg{hyperref} package which is not automatically loaded by
807 % \svnmulti. Please load it manually when you like to use \cs{svnnolinkurl}.
808 %
809 % Since v1.3 all keywords are read and typeset verbatim so this macro isn't this
810 % important anymore. However together with \pkg{hyperref}'s |\urlstyle| macro it
811 % can be used to have keyword values with special characters in roman font,
812 % which normally doesn't hold letters like `|_|'.
813 %
814 % Please note that you can't use \pkg{hyperref}'s |\nolinkurl| because it won't
815 % expand \cs{svnkw}.
816 %
817 % \subsection{Table of Revisions}\label{sec:table}
818 % Version 2.0 introduces this new feature which allows a overview table to be
819 % typeset which holds the version control information of all files of the
820 % document.
821 %
822 % \DescribeMacro{tableofrevisions}
823 % If the \opt{table} is enabled a table of revision is written into a file called
824 % \meta{main \LaTeX\ file}|.svt| (|t| for table) which can be included using the
825 % \cs{tableofrevisions} macro. The table contains the revision information of
826 % the complete document and of all defined groups.
827 % If the \opt{subgroups} option is set the table will also include the single
828 % files sorted by group.\par
829 %
830 % \subsubsection*{Table Format Macros}
831 % The |.svt| file is in an general format which uses a lot of macros to format
832 % the table and the different cells. This macros should not be used by the user
833 % directly but rather can be redefined to fit the personal taste.
834 % Figure~\ref{fig:tablemacros} shows this macros in their position inside the
835 % table of revisions.
836 %
837 % \par\noindent
838 % \begin{figure}
839 % \makebox[1.175\textwidth][r]{%
840 % \framebox{\scalebox{0.675}{%
841 % \begin{tabular}{ll@{\ \ \ }l@{\ \ \ }l@{\ \ \ }ll}
842 % &\multicolumn{4}{l}{\texttt{\textbackslash chapterORsection*\{\cs{svnrevisionsname}\}}}\\
843 % \\
844 % &\multicolumn{4}{l}{\cs{svnbeforetable}}\\
845 % & \cs{svntable} (like \cs{begin}\texttt{\{svntable\}})\\
846 % \\
847 % \cmidrule{2-5}
848 % &\cs{svntablehead}\\
849 % \cmidrule{2-5}
850 % \cs{svnglobalrow} & \cs{svntabglobal} &&&&\cs{endsvnglobalrow} \\
851 % \cs{svngrouprow} & \cs{svntabgroup} \marg{group} &&&&\cs{endsvngrouprow}\\
852 % \cs{svnsubgrouprow} & \cs{svntabsubgroup} \marg{level}\marg{name} &&&&\cs{endsvnsubgrouprow}\\
853 % \cs{svnfilerow} & \cs{svntabfile} \marg{level}\marg{name} &
854 % \raisebox{3.3ex}[-3.3ex]{%
855 % \cs{svntabrev}\marg{rev}
856 % }&
857 % \raisebox{3.3ex}[-3.3ex]{%
858 % \cs{svntabauthor}\marg{username}
859 % }&
860 % \raisebox{4ex}[-4ex]{\parbox{13.5em}{\raggedright
861 % \cs{svntabdate}\newline\marg{year}\marg{month}\marg{day}\newline
862 % \marg{hour}\marg{minute}\marg{second}\newline\marg{TZ~hour}\marg{TZ~minute}
863 % }}
864 % &\cs{endsvnfilerow}\\[\smallskipamount]
865 % &\cs{svntablefoot} \\
866 % \cmidrule{2-5}
867 % \\
868 % &\cs{endsvntable} (like \cs{end}\texttt{\{svntable\}})\\
869 % &\multicolumn{4}{l}{\cs{svnaftertable}}\\
870 % \end{tabular}
871 % }}}
872 % \caption{Table formatting macros and their position.}\label{fig:tablemacros}
873 % \end{figure}
874 %
875 % \DescribeMacro{svnrevisionsname}
876 % Holds the name of the table of revisions which is printed above it. The
877 % default is ``Table of Revisions'' which can be changed \eg to another
878 % language.
879 %
880 % \DescribeMacro{svnbeforetable}
881 % Can hold some content to be placed between the headline and the table.
882 %
883 % \DescribeMacro{svnaftertable}
884 % Can hold some content to be placed after the table. By default it holds a
885 % macro to force a new page.
886 %
887 % \DescribeMacro{svntable}
888 % \DescribeMacro{endsvntable}
889 % This macros build the table environment and hold a |\begin{tabular}{llll}|
890 % |\end{tabular}| group by default. They can be redefined using\\
891 % \hspace*{3em}|\renewcommand{svntable}{...}{...}|.\\ In order to support
892 % special table packages like \pkg{tabularx} or \pkg{longtable} the
893 % \emph{content} of this macro is written verbatim into the |.svt| file. All
894 % other table macros are written as string and will be expanded when the |.svt|
895 % is read back.
896 %
897 % \DescribeMacro{svntablehead}
898 % Holds the table head row ``Name |&| Rev |&| Author |&| Date |\\\hline|''.
899 %
900 % \DescribeMacro{svntablefoot}
901 % Can hold the table foot row but is empty by default.
902 %
903 % \noindent
904 % \begin{DescribeMacrosTab}{ll}
905 % \Macro{svnglobalrow} & \Macro{endsvnglobalrow} \\
906 % \Macro{svngrouprow} & \Macro{endsvngrouprow} \\
907 % \Macro{svnsubgrouprow} & \Macro{endsvnsubgrouprow} \\
908 % \Macro{svnfilerow} & \Macro{endsvnfilerow} \\
909 % \end{DescribeMacrosTab}
910 %
911 % This macros are placed at the begin and end of every corresponding row and are
912 % empty be default. They can be used to insert horizontal lines before or after
913 % certain row types.
914 %
915 % \DescribeMacro{svntabglobal}
916 % Simply typesets the name for the row holding the information of the whole
917 % document, \eg ``Document''.
918 %
919 % \DescribeMacro{svntabgroup}{<\/group name>}
920 % Formats the group name.
921 %
922 % \DescribeMacro{svntabsubgroup}{<nesting level (1,2,3,\ldots)>}{<subgroup name>}
923 % Formats a subgroup name. The name is derived from a file name and therefore
924 % could contain characters like `|_|' which should be taken into account. The
925 % macro \cs{svnnolinkurl} can be used for this. Because subgroups can be nested
926 % a number is provided to tell the nesting depth. This can be used to produce
927 % different indents for different levels: \eg:
928 % |\addtolength{\leftskip}{#1\someindentamount}|.
929 %
930 % \DescribeMacro{svntabfile}{<nesting level (1,2,3,\ldots)>}{<\/file path/name>}
931 % Same as for the subgroup above but for file names.
932 %
933 % \DescribeMacro{svntabrev}{<revision number>}
934 % Allows the formatting of the revision number. If empty the number will be
935 % typeset as normal. Conditional formatting is possible using the \pkg{ifthen}
936 % package: \eg the highest revision should be bold:
937 % \begin{verbatim}
938 % \renewcommand*{\svntabrev}[1]{\ifthenelse{#1=\svnrev}{\textbf{#1}}{#1}}
939 % \end{verbatim}
940 %
941 % \DescribeMacro{svntabauthor}{<author username>}
942 % Formats the user names in the table. The macro \cs{svnFullAuthor} is a good
943 % candidate to be used here.
944 %
945 % \DescribeMacro{svntabdate}{\ignorespaces
946 % \marg{year}\marg{month}\marg{day}\ignorespaces
947 % \marg{hour}\marg{minute}\marg{second}\ignorespaces
948 % \marg{TZ~hour}\marg{TZ~minute}}
949 % Allows the formatting of the date. All values are given as numbers. The year
950 % has four digits and the timezone hour has a |+| or |-| sign, but all other
951 % values have only two digits.
952 %
953 % \subsection{Including Keywords of External Files}\label{sec:external}
954 % Version 2.0 now supports the inclusion of keywords of external files using the
955 % following macros and the Perl script \scr{svn-multi.pl}.
956 %
957 % \DescribeMacro{svnexternal}[<\/group name>]{<\/file~1>}{<\/file~2>}!\ldots!{<\/file~$n$>}
958 % Subversion keywords of external files (\eg non-\LaTeX\ files like images or
959 % even directories) can be included using this macro which awaits a list of
960 % files, each with the full path relative to the main \LaTeX\ file and each
961 % enclosed by |{ }|. The files must be under version control by Subversion, of
962 % course. Use \cs{svnexternalpath} to specify paths to be scanned for this
963 % files if they are not located relative to the main file. The requested
964 % filenames are written into the |.aux| auxiliary file and then processed by the
965 % external script \scr{svn-multi.pl} which must be executed like described
966 % below. The appropriate keywords are then written in \meta{source file}|.svx|
967 % files (|x| like eXternal) which are read in by the same \cs{svnexternal} macro
968 % at the next \LaTeX\ run. If a group name of `|*|' for the external files is
969 % specified using the optional argument the keywords will be placed in the same
970 % keyword group as this macro. The file local macros like \cs{svnfilerev} which
971 % appear in a source file after \cs{svnexternal} are affected, \ie updated if
972 % one of the external revision is higher than the one of the source file. This
973 % makes sense if \eg the included graphics are taken as logical part of a source
974 % file.
975 %
976 % \DescribeMacro{svnexternalpath}{{<path~1>}{<path~2>}!\ldots!{<path~$n$>}}
977 % This macro can be used in the document preamble to declare a set of paths to
978 % be scanned for files specified with \cs{svnexternal}. This avoids the need to
979 % provide the path again and again for every file.
980 % The paths need to be enclosed in |{ }| and must be in Unix style, \ie with
981 % `|/|' as directory separator and should end with a `|/|'. Windows users should
982 % just replace all `|\|' with `|/|', \eg `|C:\My dir|' gets `|{C:/My dir/}|'.
983 %
984 % \subsection*{Script \protect\hypertarget{[email protected]}{\texttt{svn-multi.pl}}}
985 % The file \scr{svn-multi.pl} which comes with the \svnmulti package is an
986 % external Perl script which has to be run in the command line or by a \LaTeX\
987 % development environment/editor like other tools like |Bib|\TeX\ or
988 % |Makeindex|. A Perl interpreter and a Subversion command line client (|svn|)
989 % must be installed to execute this script. Both are available for free for all
990 % major operating systems.\par
991 % The script should be run inside the document folder in the following order:
992 % \begin{enumerate}
993 % \item Compile \LaTeX\ document, |.aux| file is generated.
994 % \item Run \scr{svn-multi.pl} script, |.svx| files are generated.
995 % \item Compile \LaTeX\ document, |.svx| files are read in.
996 % \end{enumerate}
997 %
998 % The script can be used with three different sets of arguments and with
999 % any combination of them. Please note that the word |jobname| stands for
1000 % the main \LaTeX\ file name without the |.tex| extension.
1001 %
1002 % \DescribeScript{svn-multi.pl}<\/jobname>
1003 % As already mentioned in the \cs{svnexternal} description above this script
1004 % reads the requested external filename from the \meta{\/jobname}|.aux| file. The
1005 % Subversion command line client |svn| is then used to fetch the needed keywords
1006 % which are placed in a \cs{svnidlong} macro inside a \meta{source file}|.svx|
1007 % file. Every single source file which uses \cs{svnexternal} will become its own
1008 % |.svx| file which allows to attach specific external files to one (or more)
1009 % specific source files.
1010 %
1011 % \DescribeScript{svn-multi.pl}<\/jobname>~['--group'~<\/group name>]~<\/file(s)>~!\ldots!
1012 % The second way to use \scr{svn-multi.pl} is to call it with a list of external
1013 % files. A keyword group can be specified using the |--group| \meta{\/group name}
1014 % option which can placed any number of times between the file names. The group
1015 % is used for all external files listed after the option until the next group is
1016 % specified. All keywords of these files are written in the \meta{\/jobname}|.svx|
1017 % file and read in by the main \LaTeX\ file if a, possible empty,
1018 % \cs{svnexternal} macro is included. This allows for easy including of many
1019 % external files without specifying them all inside the source file. For example
1020 % \scr{svn-multi.pl}| */*.jpg| (under Linux/Unix) will include the keywords of
1021 % all JPG files in all subdirectories.\par
1022 % It is also possible to do this with a sub-(\LaTeX)-file by calling the script
1023 % on it: \scr{svn-multi.pl}~\mbox{\meta{sub file} \meta{external files for sub
1024 % file}}, which will create/overwrite the \meta{sub file}|.svx| file. However
1025 % the files given by \cs{svnexternal} in this sub-file will not be honoured in
1026 % this case.
1027 %
1028 % \DescribeScript{svn-multi.pl}<\/jobname>~['--group'~<\/group name>]~'--fls'
1029 % Instead of providing a list of all non-\LaTeX/external files the |--fls|
1030 % option can be used to read this list from the \meta{\/jobname}|.fls| file. This
1031 % file is produced by the \LaTeX\ compiler when run with the |--recorder| option
1032 % and contains a list of all input and output files. Only input files with a
1033 % relative path are used. A corresponding keyword group can also be specified.
1034 %
1035 % \section{Compile Guide}\label{sec:compileguide}
1036 % A document which uses \svnmulti\ needs to be compiled by \LaTeX\ in the
1037 % following ways depending on the used features.
1038 % ^^A The Figure~\ref{fig:compi} below shows the complete compilation cycle.
1039 %
1040 % \subsection*{Basic Features -- Global and Group Keywords}
1041 % \begin{enumerate}
1042 % \item Compile document with \LaTeX. The |.aux| file is generated. Document
1043 % global and group keyword macros are not valid yet.
1044 % \item Compile document again with \LaTeX. The |.aux| file is read by
1045 % \svnmulti. Document global and group keyword macros are now valid.
1046 % \end{enumerate}
1047 %
1048 % \subsection*{Table of Revisions}
1049 % \begin{enumerate}
1050 % \item Compile document with \LaTeX. Document global and group keyword macros
1051 % are calculated and written to the |.svt| file.
1052 % \item Compile document again with \LaTeX. The |.svt| file is read and
1053 % typeset by the \cs{tableofrevisions} macro.
1054 % \end{enumerate}
1055 %
1056 % \subsection*{External Files}
1057 % \begin{enumerate}
1058 % \item Compile document with \LaTeX. The |.aux| file is generated with
1059 % references to the external files. Document global and group keyword macros
1060 % are not valid yet. External files are not taken into account.
1061 % \item Run \scr{svn-multi.pl} with the main base name (main file name without
1062 % extension) as argument. This generates |.svx| files for each |.tex| file
1063 % which used \cs{svnexternal}. This files contain the keywords of the
1064 % external files.
1065 % \item Compile document again with \LaTeX. The |.svx| files are read by
1066 % \svnmulti and the |.aux| file is updated to take the new keywords into
1067 % account. Document global and group keywords macros only hold
1068 % internal values.
1069 % \item Compile document again with \LaTeX. The |.aux| file is read by
1070 % \svnmulti. Document global and group keyword macros are now fully valid.
1071 % \end{enumerate}
1072 %
1073 % \iffalse
1074 % \begin{figure}
1075 % \centerline{\includegraphics[width=.8\textwidth]{images/compilation.pdf}}
1076 % \caption{Compilation cycle of documents which use \svnmulti}\label{fig:compi}
1077 % \end{figure}
1078 % \fi
1079 %
1080 % \section{Known Issues}\label{sec:issues}
1081 % This section lists some known issues of the \svnmulti package and tries to
1082 % provide some workaround. Please feel free to write \svnmulti author if you
1083 % detect any side effects or other issues causes by this package.
1084 %
1085 % \subsection{Packet \texttt{listings} uses \cs{input}}
1086 % \textbf{Update:} Newer versions of \svnmulti avoid this issue by changing the catcodes
1087 % back to normal while reading the |.svx| file.
1088 % If a file \meta{basename}.\meta{extension} is typeset verbatim using
1089 % |\lstinputlisting|, which uses |\input| to read the file, an existing
1090 % \meta{basename}|.svx| file is also included as part of the listing. This can
1091 % be avoided by code like this:
1092 % \begin{verbatim}
1093 % {\makeatletter\let\input\@input
1094 % \lstinputlisting[options]{filename}
1095 % }
1096 % \end{verbatim}
1097 %
1098 % \section{Package Dependencies and Acknowledgements}\label{sec:depack}
1099 % This package uses some features from other packages and/or patches some macros
1100 % of them to provide additional related features. This section is used to list
1101 % this packages, their internal macro which got used and acknowledge the
1102 % authors/maintainers of them. Please send error reports to the author of
1103 % \svnmulti and not to the people listed below.\par
1104 % All packages (including \svnmulti) stand under the \LaTeX\ Project Public
1105 % Licence (LPPL) which can be found at
1106 % \hbox{\url{http://www.latex-project.org/lppl/}} and can be freely downloaded
1107 % from the Comprehensive TeX Archive Network (CTAN) at
1108 % \hbox{\url{http://www.ctan.org/}}.
1109 %
1110 % \newenvironment*{DepPackage}[1]{\ignorespaces
1111 % \subsection*{\pkg{#1}}%
1112 % \def\thedeppackage{#1}%
1113 % \def\infoline##1{\par\smallskip\textbf{##1}\hspace{1em}}%
1114 % }
1115 % {\infoline{Location:} CTAN: \url%
1116 % {http://tug.ctan.org/pkg/\thedeppackage}}
1117 %
1118 % Since v2.3 the authors packages \pkg{currfile} and \pkg{filehook} replacing the
1119 % previous used (and patched) package \pkg{fink}.
1120 %
1121 % \begin{DepPackage}{hyperref}
1122 % The macro \cs{svnnolinkurl} is resembling the \pkg{hyperref} macro
1123 % |\nolinkurl| and uses some its internal macros from the |\url| macro
1124 % definition.
1125 % \infoline{Used internal macros:} |\hyper@normalise|, |\Hurl|
1126 % \infoline{Version used:} 2008/11/18 v6.78m
1127 % \infoline{Licence:} LPPL, any version
1128 % \infoline{Authors/Maintainers:} Sebastian Rahtz, Heiko Oberdiek
1129 % \end{DepPackage}
1130 %
1131 % \begin{DepPackage}{graphics}
1132 % If the \opt{graphics} option is enabled the following macro is patched to
1133 % record the file name and path of the included graphic.
1134 % \infoline{Patched internal macros:} |\Gin@setfile|
1135 % \infoline{Version used:} 2006/02/20 v1.0o
1136 % \infoline{Licence:} LPPL, any version
1137 % \infoline{Author/Maintainer:} David Carlisle, \LaTeX3 Project
1138 % \end{DepPackage}
1139 %
1140 % \begin{DepPackage}{pgf}
1141 % Like the \pkg{graphics} package above a macro of this package is pathed to
1142 % record the file names and paths of included images when the option
1143 % \opt{pgfimages} is enabled. Because this images pre-declares images for later
1144 % use the internal declared `image macros' are patched as well.
1145 % \infoline{Patched internal macros:} |\pgf@declareimage|,
1146 % \hbox{|\pgf@image@|\meta{image name}|!|}
1147 % \infoline{Used internal macros:} |\pgf@filename|, |\pgf@image|
1148 % \infoline{Version used:} 2008/01/15 v2.00
1149 % \infoline{Licence:} LPPL v1.3c and GPL v2
1150 % \infoline{Author\&Maintainer:} Till Tantau
1151 % \end{DepPackage}
1152 %
1153 % \begin{DepPackage}{latex}
1154 % Parts of the macro definitions of the |\tableofcontents| macros from the
1155 % |article| and |book| class of standard \LaTeX\ were used to define a similar
1156 % \csi{tableofrevisions} macro for both this classes and other similar classes.
1157 % \infoline{Version used:} 2005/09/16 v1.4f
1158 % \infoline{Licence:} LPPL v1.3c
1159 % \infoline{Authors/Maintainers:} \LaTeX3 Project
1160 % \end{DepPackage}
1161 %
1162 % \begin{DepPackage}{currfile}
1163 % The file name and path information are taken from the macros of this package.
1164 % It is from the same author and with the same license as \svnmulti\ itself.
1165 % \infoline{Version used:} 2011/01/03 v0.3
1166 % \end{DepPackage}
1167 %
1168 % \begin{DepPackage}{filehook}
1169 % This package is used to install file hooks to update subversion macros for subfiles etc.
1170 % It is from the same author and with the same license as \svnmulti\ itself.
1171 % \infoline{Version used:} 2011/01/03 v0.4
1172 % \end{DepPackage}
1173 %
1174 % \section{Further Reading}
1175 % The \textsf{svn-multi} package (in version 1.3) and its usage got discussed in
1176 % the following articles:
1177 %
1178 % \begin{itemize}
1179 % \item[{[1]}] Martin Scharrer, ``Version Control of LaTeX Documents with
1180 % svn-multi'', The Prac\TeX\ Journal, (3), 2007.
1181 % URL: \url{http://www.tug.org/pracjourn/2007-3/scharrer/}
1182 % \item[{[2]}] Mark Eli Kalderon, ``LaTeX and Subversion'',
1183 % The Prac\TeX\ Journal, (3), 2007.
1184 % URL: \url{http://www.tug.org/pracjourn/2007-3/kalderon-svnmulti/}
1185 % \item[{[3]}] Uwe Ziegenhagen , ``LaTeX Document Management with Subversion'',
1186 % The Prac\TeX\ Journal, (3), 2007.
1187 % URL: \url{http://www.tug.org/pracjourn/2007-3/ziegenhagen/}
1188 % \end{itemize}
1189 %
1190 % \StopEventually{}
1191 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1192 % \section{Implementation}
1193 % \iffalse
1194 %<*svn-multi.sty>
1195 % \fi
1196 % \subsection{Package Header}
1197 % \subsubsection*{Package Identification}
1198 % \begin{macrocode}
1199 %<!COPYRIGHT>
1200 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
1201 \ProvidesPackage{svn-multi}[%
1202 %<!DATE>
1203 %<!VERSION>
1204 %<*DRIVER>
1205 2099/01/01 develop
1206 %</DRIVER>
1207 SVN Keywords for multi-file LaTeX documents]
1208 % \end{macrocode}
1209 %
1210 %
1211 % \end{macrocode}
1212 %
1213 % \subsubsection*{Options}
1214 % Declaration of options and internal switches.
1215 % \begin{macrocode}
1216 \RequirePackage{kvoptions}
1217
1218 \SetupKeyvalOptions{%
1219 family = svn-multi,
1220 prefix = @svnmulti@
1221 }
1222 \newif\if@svnmulti@anygraphic
1223 \newif\if@svnmulti@autoload
1224 \newif\if@svnmulti@autokw
1225 \newif\if@svnmulti@autokwall
1226
1227 \DeclareVoidOption{old}{%
1228 \@svnmulti@verbatimtrue
1229 \@svnmulti@groupsfalse
1230 \@svnmulti@externalfalse
1231 \@svnmulti@graphicsfalse
1232 \@svnmulti@pgfimagesfalse
1233 \@svnmulti@autoloadfalse
1234 \@svnmulti@tablefalse
1235 \@svnmulti@filehooksfalse
1236 \@svnmulti@subgroupsfalse
1237 }
1238 \DeclareVoidOption{all}{%
1239 \@svnmulti@verbatimtrue
1240 \@svnmulti@groupstrue
1241 \@svnmulti@externaltrue
1242 \@svnmulti@graphicstrue
1243 \@svnmulti@pgfimagestrue
1244 \@svnmulti@autoloadtrue
1245 \@svnmulti@tabletrue
1246 \@svnmulti@filehookstrue
1247 \@svnmulti@subgroupstrue
1248 }
1249 \DeclareBoolOption[true]{verbatim}
1250 \DeclareBoolOption[false]{groups}
1251 \DeclareBoolOption[false]{external}
1252 \DeclareBoolOption[false]{subgroups}
1253 \DeclareBoolOption[false]{graphics}
1254 \DeclareBoolOption[false]{pgfimages}
1255 \DeclareStringOption{autoload}[true]
1256 \DeclareBoolOption[false]{table}
1257 \DeclareBoolOption[false]{filehooks}
1258 \DeclareStringOption[false]{autokw}[all]
1259
1260 \ExecuteOptions{old}
1261 \ProcessKeyvalOptions{svn-multi}
1262 % \end{macrocode}
1263 %
1264 % Enable dependent options:
1265 % \begin{macrocode}
1266 \def\svn@depoption#1{%
1267 \csname if@svnmulti@#1\endcsname\else
1268 \message{svn-multi: Required option '#1' enabled.}%
1269 \csname @svnmulti@#1true\endcsname
1270 \fi
1271 }
1272
1273 \if@svnmulti@groups
1274 \svn@depoption{filehooks}
1275 \fi
1276 \if@svnmulti@external
1277 \svn@depoption{filehooks}
1278 \fi
1279 \if@svnmulti@subgroups
1280 \svn@depoption{groups}
1281 \svn@depoption{filehooks}
1282 \fi
1283 \if@svnmulti@graphics
1284 \svn@depoption{external}
1285 \svn@depoption{autoload}
1286 \svn@depoption{filehooks}
1287 \fi
1288 \if@svnmulti@pgfimages
1289 \svn@depoption{external}
1290 \svn@depoption{autoload}
1291 \svn@depoption{filehooks}
1292 \fi
1293 \if@svnmulti@autoload
1294 \svn@depoption{external}
1295 \svn@depoption{filehooks}
1296 \fi
1297 \if@svnmulti@table
1298 \svn@depoption{groups}
1299 \svn@depoption{filehooks}
1300 \fi
1301 % \end{macrocode}
1302 %
1303 % Check if \opt{autoload} was set explicitly and obey the value.
1304 % \begin{macrocode}
1305 \ifx\@svnmulti@autoload\@undefined
1306 \else
1307 \ifx\@svnmulti@autoload\empty
1308 \else
1309 \def\svn@temp{true}
1310 \ifx\@svnmulti@autoload\svn@temp
1311 \@svnmulti@autoloadtrue
1312 \svn@depoption{external}
1313 \svn@depoption{filehooks}
1314 \else
1315 \def\svn@temp{false}
1316 \ifx\@svnmulti@autoload\svn@temp
1317 \if@svnmulti@autoload
1318 \PackageWarning{svn-multi}{Option 'autoload' disabled.}
1319 \fi
1320 \@svnmulti@autoloadfalse
1321 \else
1322 \PackageError{svn-multi}%
1323 {Invalid value for 'autoload' option: '\@svnmulti@autoload'^^J%
1324 ! Only 'true','false' or empty (='true') are allowed!}{}%
1325 \fi\fi\fi\fi
1326 % \end{macrocode}
1327
1328 % Set \opt{autokw} modes:
1329 % \begin{macrocode}
1330 \def\svn@temp{true}
1331 \ifx\@svnmulti@autokw\svn@temp
1332 \@svnmulti@autokwtrue
1333 \@svnmulti@autokwalltrue
1334 \svn@depoption{filehooks}
1335 \fi
1336 \def\svn@temp{all}
1337 \ifx\@svnmulti@autokw\svn@temp
1338 \@svnmulti@autokwtrue
1339 \@svnmulti@autokwalltrue
1340 \svn@depoption{filehooks}
1341 \fi
1342 \def\svn@temp{ext}
1343 \ifx\@svnmulti@autokw\svn@temp
1344 \@svnmulti@autokwtrue
1345 \@svnmulti@autokwallfalse
1346 \fi
1347 \def\svn@temp{false}
1348 \ifx\@svnmulti@autokw\svn@temp
1349 \@svnmulti@autokwfalse
1350 \@svnmulti@autokwallfalse
1351 \fi
1352 % \end{macrocode}
1353
1354 % General switch if any graphic option is enabled:
1355 % \begin{macrocode}
1356 \if@svnmulti@graphics
1357 \@svnmulti@anygraphictrue
1358 \fi
1359 \if@svnmulti@pgfimages
1360 \@svnmulti@anygraphictrue
1361 \fi
1362 % \end{macrocode}
1363 %
1364
1365 % \subsection{General Internal Macros}
1366 % Some internal used macro which don't fit in any other section.
1367 %
1368 % \begin{macro}{\svn@ifempty}[1]{string}
1369 % Tests if the given argument is empty. If so the first of the next two token
1370 % will be expanded, the second one otherwise.
1371 % \begin{macrocode}
1372 \def\svn@ifempty#1{%
1373 \begingroup
1374 \edef\svn@temp{#1}%
1375 \ifx\svn@temp\empty
1376 \endgroup
1377 \expandafter
1378 \@firstoftwo
1379 \else
1380 \endgroup
1381 \expandafter
1382 \@secondoftwo
1383 \fi
1384 }
1385 % \end{macrocode}
1386 % \end{macro}
1387
1388 % \begin{macro}{\svn@ifequal}[2]{string a}{string b}
1389 % Tests if the given arguments are identical, \eg same strings. If so the first
1390 % of the next two token will be expanded, the second one otherwise.
1391 % \begin{macrocode}
1392 \def\svn@ifequal#1#2{%
1393 \begingroup
1394 \edef\svn@stringa{#1}%
1395 \edef\svn@stringb{#2}%
1396 \@onelevel@sanitize\svn@stringa
1397 \@onelevel@sanitize\svn@stringb
1398 \ifx\svn@stringa\svn@stringb
1399 \endgroup
1400 \expandafter
1401 \@firstoftwo
1402 \else
1403 \endgroup
1404 \expandafter
1405 \@secondoftwo
1406 \fi
1407 }
1408 % \end{macrocode}
1409 % \end{macro}
1410
1411 % \begin{macro}{\svn@ifvalidrev}[1]{macro name}
1412 % Checks if the given macro (by name) is a valid revision, \ie defined and
1413 % not equal to the init value.
1414 % \begin{macrocode}
1415 \def\svn@ifvalidrev#1{%
1416 \begingroup
1417 \@ifundefined{#1}%
1418 {\let\svn@temp\svn@revinit}%
1419 {\expandafter\edef
1420 \expandafter\svn@temp\expandafter{\csname #1\endcsname}}%
1421 \ifnum\svn@temp=\svn@revinit\relax
1422 \endgroup
1423 \expandafter
1424 \@secondoftwo
1425 \else
1426 \endgroup
1427 \expandafter
1428 \@firstoftwo
1429 \fi
1430 }
1431 % \end{macrocode}
1432 % \end{macro}
1433
1434 % \begin{macro}{\svn@ifeof}[1]{input file handle}
1435 % Checks if the input file is at the end-of-file (or not open).
1436 % \begin{macrocode}
1437 \def\svn@ifeof#1{%
1438 \ifeof#1%
1439 \expandafter\@firstoftwo
1440 \else
1441 \expandafter\@secondoftwo
1442 \fi
1443 }
1444 % \end{macrocode}
1445 % \end{macro}
1446
1447 % \begin{macro}{\svn@ifonlyone}[1]{group name}
1448 % Checks if there is only one element in the given group file list.
1449 % It looks whether there is a comma in the list.
1450 % \begin{macrocode}
1451 \def\svn@ifonlyone#1{%
1452 \expandafter\expandafter\expandafter
1453 \svn@@ifonlyone\csname @svng@#1@files\endcsname,\relax
1454 }
1455
1456 \def\svn@@ifonlyone#1,#2\relax{%
1457 \svn@ifempty{#2}
1458 }
1459 % \end{macrocode}
1460 % \end{macro}
1461
1462 % \begin{macro}{\svn@input}[1]{file name/path}
1463 % Macro to load |.svx| and |.svt| files. The current keyword group is saved
1464 % away and restored after the |.svx| file is loaded. The macros |\IfFileExists|
1465 % with |\@@input| are used because |\InputIfFileExists| got redefined by the
1466 % \pkg{filehook} package and there is no need to use \pkg{filehook} for this files.
1467 % \begin{macrocode}
1468 \def\svn@input#1{%
1469 \begingroup
1470 \let\svn@rg\svn@g
1471 \IfFileExists{#1}{\@@input #1\relax}{}%
1472 \global\let\svn@g\svn@rg
1473 \endgroup
1474 }
1475 % \end{macrocode}
1476 % \end{macro}
1477
1478 % \begin{macro}{\svn@inputsvx}[1]{file name/path without extension}
1479 % Used to save and restore file keywords when reading |.svx| files.
1480 % The normal catcodes are restored to avoid issues in special situations
1481 % regarding input of verbatim files
1482 % (e.g.\ \cs{lstinputlisting} from the \pkg{listings} package) or other
1483 % cases where catcodes might have changes (e.g.\ `|%|' in |.dtx| files).
1484 % \begin{macrocode}
1485 \def\svn@inputsvx#1{%
1486 \svn@pushfilestack
1487 \begingroup
1488 \svn@normalcatcodes
1489 \svn@input{#1.svx}%
1490 \endgroup
1491 \svn@popfilestack
1492 }
1493 % \end{macrocode}
1494 % \end{macro}
1495
1496 % \begin{macro}{\svn@normalcatcodes}
1497 % Sets the default catcodes.
1498 % \begin{macrocode}
1499 \def\svn@normalcatcodes{%
1500 \catcode`\\=0\relax
1501 \catcode`\{=1\relax
1502 \catcode`\}=2\relax
1503 \catcode`\$=3\relax
1504 \catcode`\&=4\relax
1505 \catcode`\^^M=5\relax
1506 \catcode`\#=6\relax
1507 \catcode`\^=7\relax
1508 \catcode`\_=8\relax
1509 \catcode`\ =10\relax
1510 \catcode`\@=12\relax
1511 \catcode`\~=13\relax
1512 \catcode`\%=14\relax
1513 }
1514 % \end{macrocode}
1515 % \end{macro}
1516
1517 % \subsection{Definition of init values}
1518 % Initialisation of at least the revision to a numeric value is necessary to not
1519 % break the |\ifnum| tests later in this package. The revision is initialised to
1520 % -2, but will be set to 0 if an unexpanded |$||Rev:$| keyword is read. This way
1521 % it can be tested if a file had any keyword macros or not.\par
1522 % Note that there a two different macros for the document global keywords:\par
1523 % The user level |\svn|\meta{kw} macros hold the global value and are only valid
1524 % after a \LaTeX\ run. They are initialised here and defined in the |.aux|
1525 % file which is read at the end of the package if it exists and written at the
1526 % end of the document.\par
1527 % The internal macros |\@svn@|\meta{kw} store the oldest (i.e. highest revision)
1528 % keywords read so far from the \cs{svnid} and \cs{svnidlong} macros. They
1529 % change during the document and are used to produce the values of the
1530 % |\svn|\meta{kw} macros when the |.aux| file is written.\par
1531 % Group wide macros are initialised when the group is first defined and have
1532 % three different macros: \Macro\svng@<\/group>'@'<kw>\relax (defined in |.aux|),
1533 % \Macro\@svng@<\/group>'@'<kw>\relax (accumulator) and also an access
1534 % macro \Macro\svncg<\/group> which uses
1535 % \Macro\svn@g<current group>'@'<kw>.
1536 % \begin{macrocode}
1537 % Init values
1538 \def\svn@revinit{-2}
1539 \let\svnrev\svn@revinit \let\@svn@rev\svn@revinit
1540 \let\ifsvnmodified\@secondoftwo
1541 \def\@svn@modified{@secondoftwo}%
1542 \def\svndate{} \def\@svn@date{}
1543 \def\svnauthor{} \def\@svn@author{}
1544 \def\svnyear{0000} \def\@svn@year{0000}
1545 \def\svnmonth{00} \def\@svn@month{00}
1546 \def\svnday{00} \def\@svn@day{00}
1547 \def\svnhour{00} \def\@svn@hour{00}
1548 \def\svnminute{00} \def\@svn@minute{00}
1549 \def\svnsecond{00} \def\@svn@second{00}
1550 \def\svntimezonehour{+00} \def\@svn@timezonehour{+00}
1551 \def\svntimezoneminute{00} \def\@svn@timezoneminute{00}
1552 \def\svnmainurl{NOT SET} \def\svnmainfilename{NOT SET}
1553 \def\svnurl{} \def\svnfname{}
1554 \def\svn@temp{}
1555
1556 \def\svn@pg{} \def\svn@g{} \def\svn@cg{\svn@g} \def\svn@rg{\svn@pg}
1557 \let\@svng@@files\empty
1558
1559 \def\svn@initfile{%
1560 \global\let\svnfilerev\svn@revinit
1561 \global\let\ifsvnfilemodified\@secondoftwo
1562 \gdef\svnfiledate{}%
1563 \gdef\svnfileauthor{}%
1564 \gdef\svnfileyear{0000}%
1565 \gdef\svnfilemonth{00}%
1566 \gdef\svnfileday{00}%
1567 \gdef\svnfilehour{00}%
1568 \gdef\svnfileminute{00}%
1569 \gdef\svnfilesecond{00}%
1570 \gdef\svnfiletimezonehour{+00}%
1571 \gdef\svnfiletimezoneminute{00}%
1572 \gdef\svnfileurl{}%
1573 \gdef\svnfilefname{}%
1574 \gdef\svnfiledir{}%
1575 }
1576 \svn@initfile
1577
1578 \newif\ifsvn@modified
1579 % \end{macrocode}
1580
1581 % \subsection{Auto-Keywords}
1582
1583 % Special care must be taken for the line feed character, otherwise it causes an
1584 % error if \opt{autokw} is disabled.
1585 % \begin{macrocode}
1586 \begingroup
1587 \@makeother\^^L
1588 \if@svnmulti@autokw
1589 \gdef\svne@ff{^^L}
1590 \fi
1591 \endgroup
1592 % \end{macrocode}
1593
1594 % \begin{macrocode}
1595 \if@svnmulti@autokw
1596 % \end{macrocode}
1597 %
1598 % \begin{macrocode}
1599 \newread\svne@read
1600 % \end{macrocode}
1601
1602 % \begin{macro}{\svne@catcodes}
1603 % Sets the catcodes for verbatim input reading. Also removes the end-of-line
1604 % character.
1605 % \begin{macrocode}
1606 \newcommand*{\svne@catcodes}{%
1607 \let\do\@makeother
1608 \endlinechar=-1%
1609 \dospecials
1610 \do0\do1\do2\do3\do4%
1611 \do5\do6\do7\do8\do9%
1612 \do\:\do\^^L%
1613 \do\<\do\>\do\*\do\.\do\-%
1614 \do\/\do\[\do\]\do\`\do\'\do\"%
1615 \def\do##1{\catcode`##1=11\relax}%
1616 \do\A\do\B\do\C\do\D\do\E\do\F
1617 \do\G\do\H\do\I\do\J\do\K\do\L
1618 \do\M\do\N\do\O\do\P\do\Q\do\R
1619 \do\S\do\T\do\U\do\V\do\X\do\Y\do\Z
1620 \do\a\do\b\do\c\do\d\do\e\do\f
1621 \do\g\do\h\do\i\do\j\do\k\do\l
1622 \do\m\do\n\do\o\do\p\do\q\do\r
1623 \do\s\do\t\do\u\do\v\do\x\do\y\do\z
1624 }
1625 % \end{macrocode}
1626 % \end{macro}
1627
1628 % \begin{macro}{\svne@readline}[1]{macro}
1629 % Reads the next line to the provided macro and handles the end-of-file case
1630 % correctly.
1631 % \begin{macrocode}
1632 \def\svne@readline#1{%
1633 \ifeof\svne@read
1634 \def#1{}%
1635 \else
1636 \read\svne@read to #1\relax
1637 \fi
1638 }
1639 % \end{macrocode}
1640 % \end{macro}
1641
1642 % \begin{macro}{\svne@gobblerest}
1643 % Gobbles the rest of the current entry.
1644 % \begin{macrocode}
1645 \def\svne@gobblerest{%
1646 \ifeof\svne@read
1647 \let\next\relax
1648 \else
1649 \read\svne@read to \svn@temp
1650 \ifx\svn@temp\svne@ff
1651 \let\next\relax
1652 \else
1653 \let\next\svne@gobblerest
1654 \fi
1655 \fi
1656 \next
1657 }
1658 % \end{macrocode}
1659 % \end{macro}
1660
1661 % \begin{macro}{\svne@endread}
1662 % Stops the reading process of the entries file.
1663 % \begin{macrocode}
1664 \def\svne@endread{%
1665 \closein\svne@read
1666 }
1667 % \end{macrocode}
1668 % \end{macro}
1669
1670 % \begin{macro}{\svne@parseentriesfile}[1]{file path}
1671 % \begin{macrocode}
1672 \newcommand*{\svne@parseentriesfile}[1]{%
1673 \begingroup
1674 \let\next\relax
1675 % \end{macrocode}
1676 % Open the format file to read the version number. If this file does not exists
1677 % (true for recent svn versions) a valid default value is used and the true
1678 % version number is read from the |entries| file.
1679 % \begin{macrocode}
1680 \def\svne@version{8}%
1681 \openin\svne@read=#1format\relax
1682 \ifeof\svne@read\else
1683 \svne@readline\svne@version
1684 \closein\svne@read
1685 \fi
1686 % \end{macrocode}
1687 % Check the format version:
1688 % \begin{macrocode}
1689 \ifnum\svne@version>7\relax
1690 % \end{macrocode}
1691 % Now open the entries file and read the version number from there again.
1692 % \begin{macrocode}
1693 \openin\svne@read=#1entries\relax
1694 \ifeof\svne@read\else
1695 \svne@readline\svne@version
1696 % \end{macrocode}
1697 % Check the version and call the parse macros if OK:
1698 % \begin{macrocode}
1699 \ifnum\svne@version>7\relax
1700 \def\next{\svne@parsedirentry
1701 \svne@parseentries}%
1702 \else
1703 \closein\svne@read
1704 \fi
1705 \fi
1706 \fi
1707 \next
1708 \endgroup
1709 }
1710 % \end{macrocode}
1711 % \end{macro}
1712
1713 % \begin{macro}{\svne@parsedirentry}
1714 % Reads the first entry which is the directory entry and sets its URL as base
1715 % URL for all other entries.
1716 % \begin{macrocode}
1717 \newcommand*{\svne@parsedirentry}{%
1718 \svne@readline\svne@name
1719 \svne@readline\svne@kind
1720 \svn@ifempty{\svne@name}%
1721 {\svn@ifequal{\svne@kind}{dir}%
1722 {%
1723 {\svne@readline\svn@temp}%
1724 \svne@readline\svne@baseurl
1725 \svne@gobblerest
1726 }{}%
1727 }{}%
1728 }
1729 % \end{macrocode}
1730 % \end{macro}
1731
1732 % \begin{macro}{\svne@scandate}
1733 % \begin{macro}{\svne@scandate@}
1734 % Parses the date from the svn entries file. Special care is taken to handle the
1735 % case when the TeX parsing would fail. The catcode of the characters '|-|',
1736 % '|:|', '|.|' used inside the date is set explicitly to ensure the correct
1737 % value.
1738 %
1739 % \begin{macrocode}
1740 \begingroup
1741
1742 \@makeother\-
1743 \@makeother\:
1744 \@makeother\.
1745
1746 \gdef\svne@scandate#1{%
1747 \expandafter\svne@scandate@#1\empty
1748 0000-00-00T00:00:00.00000Z\empty\empty
1749 }
1750
1751 \gdef\svne@scandate@#1-#2-#3T#4:#5:#6.#7\empty#8\empty{%
1752 \xdef\svnfileyear{#1}%
1753 \gdef\svnfilemonth{#2}%
1754 \gdef\svnfileday{#3}%
1755 \gdef\svnfilehour{#4}%
1756 \gdef\svnfileminute{#5}%
1757 \gdef\svnfilesecond{#6}%
1758 \gdef\svnfiletimezonehour{+00}%
1759 \gdef\svnfiletimezoneminute{00}%
1760 \gdef\svnfiledate{#1-#2-#3 #4:#5:#6Z}%
1761 \def\svne@date{#1-#2-#3 #4:#5:#6Z}%
1762 }
1763
1764 \endgroup
1765 % \end{macrocode}
1766 % \end{macro}
1767 % \end{macro}
1768
1769 % \begin{macro}{\svne@parseentries}
1770 % \begin{macrocode}
1771 \newcommand*{\svne@parseentries}{%
1772 \svn@ifeof{\svne@read}%
1773 {}%
1774 {%
1775 \svne@readline\svne@name
1776 \@onelevel@sanitize\svne@name
1777 \svn@ifeof{\svne@read}%
1778 {}%
1779 {%
1780 \svne@readline\svne@kind
1781 \svn@ifequal{\svne@kind}{file}%
1782 {%
1783 \svne@readline\svn@temp
1784 \svne@readline\svn@temp
1785 \svne@readline\svn@temp
1786 \svne@readline\svn@temp
1787 \svne@readline\svn@temp
1788 \svne@readline\svn@temp
1789 \svne@readline\svne@date
1790 \svne@readline\svne@rev
1791 \svne@readline\svne@author
1792 %\@onelevel@sanitize\svne@date
1793 \svne@scandate{\svne@date}%
1794 \edef\svne@url{\svne@baseurl/\svne@name}%
1795 \svne@handleentry
1796 }{}%
1797 \svne@gobblerest
1798 \svne@parseentries
1799 }%
1800 }%
1801 }
1802 % \end{macrocode}
1803 % \end{macro}
1804
1805 % \begin{macro}{\svne@handleentry}
1806 % This macro is called for every entry except the first one which stands for the
1807 % directory. The VC data is located in the following macros: \csi{svne@name},
1808 % \csi{svne@date}, \csi{svne@rev}, \csi{svne@author}, \csi{svne@url}.
1809 %
1810 % This implementation sets the correct keywords and calls the update macro to
1811 % emulate the behaviour of \cs{svnidlong}. Then the \cs{svne@endread} macro is
1812 % used to stop the file reading.
1813 % \begin{macrocode}
1814 \def\svne@handleentry{%
1815 \ifx\svne@rev\empty
1816 \let\svne@rev\svn@revinit
1817 \fi
1818 \svn@ifequal{\svne@name}{\svnfilefname}%
1819 {%
1820 \message{^^J%
1821 Read from '.svn/entries' file:^^J%
1822 Filename: \svne@name^^J%
1823 Date: \svne@date^^J%
1824 Revision: \svne@rev^^J%
1825 Author: \svne@author^^J%
1826 HeadURL: \svne@url^^J%
1827 ^^J%
1828 }%
1829 \svnkwdef{Filename}{\svne@name}%
1830 \svnkwdef{Date}{\svne@date}%
1831 \svnkwdef{Revision}{\svne@rev}%
1832 \svnkwdef{Author}{\svne@author}%
1833 \svnkwdef{HeadURL}{\svne@url}%
1834 \@svn@updateid{\svne@rev}{\svne@date}{\svne@author}{\svne@url}%
1835 \svne@endread
1836 }{}%
1837 }%
1838 % \end{macrocode}
1839 % \end{macro}
1840
1841 % \begin{macro}{\svnegetfile}[1]{file path}
1842 % \begin{macrocode}
1843 \def\svnegetfile#1{%
1844 \begingroup
1845 \svn@getfilename{#1}%
1846 \edef\svnfilefname{\svnfilefname}%
1847 \@onelevel@sanitize\svnfilefname
1848 \svne@catcodes
1849 \svne@parseentriesfile{\svnfiledir .svn/}%
1850 \svne@parseentriesfile{\svnfiledir _svn/}%
1851 \endgroup
1852 }
1853 % \end{macrocode}
1854 % \end{macro}
1855
1856 % Load keywords of main document at begin of the document body if option is set
1857 % to 'all'.
1858 % \begin{macrocode}
1859 \if@svnmulti@autokwall
1860 \AtBeginDocument{%
1861 \svnegetfile{\jobname.\currfile@mainext}%
1862 }
1863 \fi
1864 % \end{macrocode}
1865
1866 % \begin{macrocode}
1867 \fi
1868 % \end{macrocode}
1869
1870
1871 % \subsection{Timezone macros}
1872 % \begin{macro}{\svntimezone}
1873 % \begin{macro}{\svnfiletimezone}
1874 % \begin{macro}{\svncgtimezone}
1875 % These macros return the global, file-local and current group time zones,
1876 % respectively. Since v1.4 the minute part is returned as well and the macro
1877 % removes manually added |00| after it to support older documents.
1878 % \changes{v1.4}{2009/02/27}{Return now full timezone (hour + minute part).
1879 % Manually added 00 minutes are removed.}
1880 % \begin{macrocode}
1881 \def\svntimezone{\svntimezonehour\svntimezoneminute\svn@gobblezeros}
1882 \def\svnfiletimezone{\svnfiletimezonehour\svnfiletimezoneminute\svn@gobblezeros}
1883 \def\svncgtimezone{\svncgtimezonehour\svncgtimezoneminute}
1884 % \end{macrocode}
1885 % \end{macro}
1886 % \end{macro}
1887 % \end{macro}
1888
1889 % \begin{macro}{\svn@gobblezeros}
1890 % \begin{macro}{\svn@gobblezeros@}
1891 % This two cascaded macros remove a trailing |00| and are used by
1892 % \cs{svnfiletimezone} and \cs{svntimezone}.
1893 % \begin{macrocode}
1894 \def\svn@gobblezeros{%
1895 \futurelet\svn@nextchar\svn@gobblezeros@
1896 }
1897 \def\svn@gobblezeros@{%
1898 \let\@tempa=\relax
1899 \def\@tempb{0}%
1900 \ifx0\svn@nextchar
1901 \let\@tempa=\@gobbletwo
1902 \fi
1903 \@tempa
1904 }
1905 % \end{macrocode}
1906 % \end{macro}
1907 % \end{macro}
1908
1909 % \begin{macro}{\svntime}
1910 % \begin{macro}{\svnfiletime}
1911 % \begin{macro}{\svncgtime}
1912 % This macros simple use the hour, minute and second macros.
1913 % \begin{macrocode}
1914 \def\svntime{\svnhour:\svnminute:\svnsecond}
1915 \def\svnfiletime{\svnfilehour:\svnfileminute:\svnfilesecond}
1916 \def\svncgtime{\svncghour:\svncgminute:\svncgsecond}
1917 % \end{macrocode}
1918 % \end{macro}
1919 % \end{macro}
1920 % \end{macro}
1921
1922 % \subsection{\textit{Today} macros}
1923 % These macros use the |\today| macro to typeset the current date using the
1924 % local language settings. Thanks and credit goes to Manuel P\'egouri\'e-Gonnard
1925 % for suggesting this feature and for providing the code.
1926 % \begin{macro}{\svntoday}
1927 % \begin{macrocode}
1928 \newcommand*{\svntoday}{%
1929 \begingroup
1930 \year\svnyear \month\svnmonth \day\svnday
1931 \relax \today
1932 \endgroup
1933 }
1934 % \end{macrocode}
1935 % \end{macro}
1936 %
1937 % \begin{macro}{\svnfiletoday}
1938 % \begin{macrocode}
1939 \newcommand*{\svnfiletoday}{%
1940 \begingroup
1941 \year\svnfileyear \month\svnfilemonth \day\svnfileday
1942 \relax \today
1943 \endgroup
1944 }
1945 % \end{macrocode}
1946 % \end{macro}
1947 %
1948 % \begin{macro}{\svncgtoday}
1949 % \begin{macrocode}
1950 \newcommand*{\svncgtoday}{%
1951 \@ifundefined{svng@\svn@cg @year}{??}{%
1952 \begingroup
1953 \year\svncgyear \month\svncgmonth \day\svncgday
1954 \relax \today
1955 \endgroup
1956 }%
1957 }%
1958 % \end{macrocode}
1959 % \end{macro}
1960
1961 % \subsection{Id macros}
1962 % \subsubsection{Normal Id}
1963 % \begin{macro}{\svnid}
1964 % Calls \cs{svnkwsave} with |\@svnidswtrue| so that the Id keyword will be
1965 % parsed at the end of \cs{svnkwsave}.
1966 % \begin{macrocode}
1967 \newcommand*{\svnid}{%
1968 \@svnidswtrue
1969 \svnkwsave
1970 }
1971 \newif\if@svnidsw
1972 \@svnidswfalse
1973 % \end{macrocode}
1974 % \end{macro}
1975 %
1976
1977 % \begin{macro}{\svn@scanId}[2]{file name}{rest of id line}
1978 % Ensures proper behaviour also for copied but not yet committed files which have
1979 % no date, time and author name. The revision is set to -1. So \meta{rest} is simply
1980 % compared to `|-1|' and a fall-back text is supplied if needed.
1981 % \begin{macrocode}
1982 \def\svn@scanId#1 #2\relax{%
1983 \begingroup
1984 \def\@tempa{#2}%
1985 \def\@tempb{-1}%
1986 \ifx\@tempa\@tempb
1987 \endgroup
1988 \svn@scanId@#1 -1 0000-00-00 00:00:00Z (uncommited)\relax
1989 \else
1990 \endgroup
1991 \svn@scanId@#1 #2\relax
1992 \fi
1993 }
1994 % \end{macrocode}
1995 % \end{macro}
1996 %
1997
1998 % \begin{macro}{\svn@scanId@}[5]{file name}{revision}{date (YYYY-MM-DD)}{time
1999 % (HH:MM:SSZ)}{author (username)}
2000 % Scans svn Id (after it got parsed by \cs{svnkwsave}). Awaits only Id value
2001 % without leading `|Id:|' and a trailing |\relax| as end marker. It calls
2002 % \cs{@svn@scandate} to extract the date information and \cs{@svn@updateid} to
2003 % update global Id values and also sets the appropriate keywords.
2004 % \begin{macrocode}
2005 \def\svn@scanId@#1 #2 #3 #4 #5\relax{%
2006 \@svn@scandate{#3 #4}%
2007 \svnkwdef{Filename}{#1}%
2008 \svnkwdef{Date}{#3 #4}%
2009 \svnkwdef{Revision}{#2}%
2010 \svnkwdef{Author}{#5}%
2011 \@svn@updateid{\svnkw{Revision}}{\svnkw{Date}}{\svnkw{Author}}{\svnkw{URL}}%
2012 }
2013 % \end{macrocode}
2014 % \end{macro}
2015 %
2016
2017 % \begin{macro}{\@svn@updateid}[4]{rev}{date}{author (username)}{url}
2018 % We first define the expanded arguments to variables for the user. The
2019 % expansion is needed because the arguments content is mostly generic like
2020 % |\svn@value| which can change very soon after this macro.
2021 % \begin{macrocode}
2022 \def\@svn@updateid#1#2#3#4{%
2023 \begingroup
2024 \let\protect\@unexpandable@protect
2025 \xdef\svnfilerev{#1}%
2026 \ifsvn@modified
2027 \global\let\ifsvnfilemodified\@firstoftwo
2028 \else
2029 \global\let\ifsvnfilemodified\@secondoftwo
2030 \fi
2031 \xdef\svnfiledate{#2}%
2032 \xdef\svnfileauthor{#3}%
2033 \xdef\svnfileurl{#4}%
2034 \svn@getfilename\svnfileurl%
2035 % \end{macrocode}
2036 % Then we check if the revision is non-empty (not yet expanded by subversion?)
2037 % and larger then the current maximum value |\@svn@rev|. If yes we save all
2038 % value to save them in the |.aux|-file later.
2039 % \begin{macrocode}
2040 \ifx\svnfilerev\empty\else
2041 \ifnum\@svn@rev<\svnfilerev
2042 \xdef\@svn@rev{\svnfilerev}%
2043 \xdef\@svn@modified{\ifsvnfilemodified{@firstoftwo}{@secondoftwo}}%
2044 \xdef\@svn@date{\svnfiledate}%
2045 \xdef\@svn@author{\svnfileauthor}%
2046 \xdef\@svn@year{\svnfileyear}%
2047 \xdef\@svn@month{\svnfilemonth}%
2048 \xdef\@svn@day{\svnfileday}%
2049 \xdef\@svn@hour{\svnfilehour}%
2050 \xdef\@svn@minute{\svnfileminute}%
2051 \xdef\@svn@second{\svnfilesecond}%
2052 \xdef\@svn@timezonehour{\svnfiletimezonehour}%
2053 \xdef\@svn@timezoneminute{\svnfiletimezoneminute}%
2054 \xdef\@svn@url{\svnfileurl}%
2055 \xdef\@svn@fname{\svnfilefname}%
2056 \fi
2057
2058 \if@svnmulti@groups
2059 \ifx\svn@g\empty\else
2060 \svn@updategroup{\svn@g}%
2061 \fi
2062 \if@svnmulti@subgroups
2063 \ifsvnsubgroups
2064 \svn@updategroup{\currfiledir\currfilebase}%
2065 \fi
2066 \fi
2067 \fi
2068 \fi
2069 \endgroup
2070 }
2071
2072 \def\@svncg@save#1#2{%
2073 \expandafter\xdef\csname @svng@\svn@g @#1\endcsname{#2}%
2074 }
2075
2076 % \end{macrocode}
2077 % \end{macro}
2078 %
2079
2080 % \subsubsection{Long Id}
2081 % \begin{macro}{\svnidlong}
2082 % We clear the keyword value first to reduce the risk though bad user input.
2083 % \begin{macrocode}
2084 \newcommand{\svnidlong}{%
2085 \svnkwdef{URL}{}%
2086 \svnkwdef{Date}{}%
2087 \svnkwdef{Revision}{0}%
2088 \svnkwdef{Author}{}%
2089 % \end{macrocode}
2090 % Read arguments verbatim or non-verbatim.
2091 % \begin{macrocode}
2092 \if@svnmulti@verbatim
2093 \expandafter\svnidlong@readverb
2094 \else
2095 \expandafter\svnidlong@readargs
2096 \fi
2097 }
2098 % \end{macrocode}
2099 % \end{macro}
2100 %
2101 % \begin{macro}{\svnidlong@readverb}
2102 % The following macros read the four arguments of |\svnidlong| one-by-one with
2103 % verbatim mode deactivated between them to ignore all comments. The macro
2104 % |\@ifnextchar| is used to get rid of all spaces (and therefore comments) between
2105 % the arguments. An error message is printed if a wrong syntax is discovered.
2106 % \begin{macrocode}
2107 \def\svnidlong@readverb{%
2108 \@ifnextchar\bgroup
2109 {\svnidlong@readverb@\svnidlong@readverb@a}%
2110 {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
2111 }
2112 % \end{macrocode}
2113 % Sets up verbatim mode and calls the macro given as an argument.
2114 % \begin{macrocode}
2115 \def\svnidlong@readverb@#1{%
2116 \begingroup
2117 \svn@catcodes
2118 \catcode`\{=1\relax
2119 \catcode`\}=2\relax
2120 #1%
2121 }
2122 % \end{macrocode}
2123 % Reads first argument, ignores spaces and comments and calls next macro.
2124 % \begin{macrocode}
2125 \def\svnidlong@readverb@a#1{%
2126 \endgroup
2127 \svnkwsave@read #1\relax
2128 \@ifnextchar\bgroup
2129 {\svnidlong@readverb@\svnidlong@readverb@b}%
2130 {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
2131 }
2132 % \end{macrocode}
2133 % Reads second argument, ignores spaces and comments and calls next macro.
2134 % \begin{macrocode}
2135 \def\svnidlong@readverb@b#1{%
2136 \endgroup
2137 \svnkwsave@read #1\relax
2138 \@ifnextchar\bgroup
2139 {\svnidlong@readverb@\svnidlong@readverb@c}%
2140 {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
2141 }
2142 % \end{macrocode}
2143 % Reads third argument, ignores spaces and comments and calls next macro.
2144 % \begin{macrocode}
2145 \def\svnidlong@readverb@c#1{%
2146 \endgroup
2147 \svnkwsave@read #1\relax
2148 \@ifnextchar\bgroup
2149 {\svnidlong@readverb@\svnidlong@readverb@d}%
2150 {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
2151 }
2152 % \end{macrocode}
2153 % Reads last argument, scans date if not empty and calls the Id update macro.
2154 % \begin{macrocode}
2155 \def\svnidlong@readverb@d#1{%
2156 \endgroup
2157 \svnkwsave@read #1\relax
2158 \ifx\svnkwDate\empty\else
2159 \@svn@scanlongdate{\svnkwDate}%
2160 \fi
2161 \@svn@updateid{\svnkw{Revision}}{\svnkw{Date}}%
2162 {\svnkw{Author}}{\svnkw{URL}}%
2163 \ignorespaces
2164 }
2165 % \end{macrocode}
2166 % \end{macro}
2167
2168 % \begin{macro}{\svn@catcodes}
2169 % Changes all \TeX-special character to category ``other''. The newline aka
2170 % return is changed to category ``ignore'' so line breaks are not taken as part
2171 % of the verbatim arguments.
2172 % \begin{macrocode}
2173 \if@svnmulti@verbatim
2174 \def\svn@catcodes{%
2175 \let\do\@makeother
2176 \dospecials
2177 \catcode`\^^M9
2178 \catcode`\ 10
2179 \catcode`\{1
2180 \catcode`\}2
2181 }
2182 \else
2183 \def\svn@catcodes{}
2184 \fi
2185 % \end{macrocode}
2186 % \end{macro}
2187 %
2188 % \begin{macro}{\svnidlong@readargs}[4]{Keyword 1}{Keyword 2}{Keyword 3}
2189 % {Keyword 4}
2190 % Calls sub macro for all four arguments and ends the catcode changes made
2191 % by \cs{svnidlong}.
2192 % \begin{macrocode}
2193 \def\svnidlong@readargs#1#2#3#4{%
2194 \svnkwsave@read #1\relax
2195 \svnkwsave@read #2\relax
2196 \svnkwsave@read #3\relax
2197 \svnkwsave@read #4\relax
2198 \endgroup
2199 % \end{macrocode}
2200 % Now the update macros for date and id are called.
2201 % \begin{macrocode}
2202 \ifx\svnkwDate\empty\else
2203 \@svn@scanlongdate{\svnkwDate}%
2204 \fi
2205 \@svn@updateid{\svnkw{Revision}}{\svnkw{Date}}%
2206 {\svnkw{Author}}{\svnkw{URL}}%
2207 \ignorespaces
2208 }%
2209 % \end{macrocode}
2210 % \end{macro}
2211
2212 % \subsection{KeyWord Macros}
2213 % \begin{macro}{\svnkwsave}
2214 % Enabled verbatim mode and uses a sub macro to read the arguments afterwards.
2215 % \begin{macrocode}
2216 \def\svnkwsave{%
2217 \begingroup
2218 \svn@catcodes
2219 \svnkwsave@readargs
2220 }
2221 % \end{macrocode}
2222 % \end{macro}
2223
2224 % \begin{macro}{\svnkwsave@readargs}[1]{\$kw: value\$}
2225 % Reads full argument, calls parse submacro and ends catcode changes.
2226 % If \cs{svnkwsave} was called by \cs{svnid} scans the id keyword by calling the
2227 % scan macro.
2228 % \begin{macrocode}
2229 \gdef\svnkwsave@readargs#1{%
2230 \svnkwsave@read#1\relax
2231 \endgroup
2232 \if@svnidsw
2233 \ifx\svnkwId\empty\else
2234 \expandafter
2235 \svn@scanId\svnkwId\relax
2236 \@svnidswfalse
2237 \fi
2238 \fi
2239 \ignorespaces
2240 }
2241 % \end{macrocode}
2242 % \end{macro}
2243
2244 % \begin{macro}{\svnkwsave@read}[1]{keyword line without surrounding \$ \$}
2245 % Reads the full keyword and strips the dollars.
2246 % \begin{macrocode}
2247 \begingroup
2248 \if@svnmulti@verbatim
2249 \catcode`\$=12
2250 \fi
2251 \gdef\svnkwsave@read $#1$\relax{%
2252 \svn@checkcolon#1:\relax
2253 }
2254 \endgroup
2255 % \end{macrocode}
2256 % \end{macro}
2257
2258 % \begin{macro}{\svnkwsave@parse}[2]{key}{value}
2259 % Parse the keyword and save it away.
2260 % \begin{macrocode}
2261 \begingroup
2262 \catcode`\$=11
2263 \gdef\svnkwsave@parse$#1:#2${%
2264 \expandafter\xdef\csname svnkw#1\endcsname{#2}%
2265 }%
2266 \endgroup
2267 % \end{macrocode}
2268 % \end{macro}
2269
2270 % \begin{macro}{\svnkwdef}[2]{key}{value}
2271 % First we check if there is a `setter'-macro for the keyword called
2272 % \cs{svnkwdef@}\meta{keyword}.
2273 % \begin{macrocode}
2274 \newcommand{\svnkwdef}[2]{%
2275 \@ifundefined{svnkwdef@#1}%
2276 % \end{macrocode}
2277 % If not we call the general macro \cs{svnkwdef@}.
2278 % \begin{macrocode}
2279 {\svnkwdef@{#1}{#2}}%
2280 % \end{macrocode}
2281 % If yes we just call it with the value as argument.
2282 % \begin{macrocode}
2283 {\csname svnkwdef@#1\endcsname{#2}}%
2284 }
2285 % \end{macrocode}
2286 % \end{macro}
2287
2288 % \begin{macro}{\svnkwdef@}[2]{key}{value}
2289 % This macro defines the second argument under \cs{svnkw}\meta{1st argument}.
2290 % The |\xdef| is used to expand the content first (needed for internal use) and
2291 % make the definition globally.
2292 % \begin{macrocode}
2293 \newcommand{\svnkwdef@}[2]{%
2294 \begingroup
2295 \let\protect\@unexpandable@protect
2296 \expandafter\xdef\csname svnkw#1\endcsname{#2}%
2297 \endgroup
2298 }
2299 % \end{macrocode}
2300 % Example: |\svnkwdef{Revision}{23}| will define |\svnkwRevision| as 23.
2301 % \end{macro}
2302
2303 % \begin{macro}{\svnkwdef@Rev}
2304 % \begin{macro}{\svnkwdef@Author}
2305 % \begin{macro}{\svnkwdef@Date}
2306 % \begin{macro}{\svnkwdef@URL}[1]{value}
2307 % `Setter'-macros for single keywords, used by \cs{svnkwdef}.\\ These are needed
2308 % to have have a common value for all alternative keyword names ala |Rev|,
2309 % |Revision|, |LastChangedRevision|.
2310 %
2311 % The keywords |Author| and |Date| are just calling \cs{svnkwdef@} with a fixed
2312 % first argument. For the revision the value is checked if empty and then a 0
2313 % is substituted. Also a temp counter is used to strip any trailing characters
2314 % like `M' which indicate an exported and modified file.
2315 % \begin{macrocode}
2316 \def\svnkwdef@Rev#1{%
2317 \svn@ifempty{#1}%
2318 {\svnkwdef@{Rev}{0}}%
2319 {%
2320 \afterassignment\svnkwdef@Rev@
2321 \@tempcnta=#1\relax
2322 }%
2323 }
2324 \def\svnkwdef@Rev@#1\relax{%
2325 \svnkwdef@{Rev}{\the\@tempcnta}%
2326 \def\svn@temp{#1}%
2327 \if M\svn@temp\relax
2328 \global\svn@modifiedtrue
2329 \else
2330 \if *\svn@temp\relax
2331 \global\svn@modifiedtrue
2332 \else
2333 \global\svn@modifiedfalse
2334 \fi
2335 \fi
2336 }
2337 \def\svnkwdef@Author#1{\svnkwdef@{Author}{#1}}
2338 \def\svnkwdef@Date#1{\svnkwdef@{Date}{#1}}
2339 \def\svnkwdef@URL#1{\svnkwdef@{HeadURL}{#1}}
2340 % \end{macrocode}
2341 % The long keywords are defined then as aliases of the short,\\
2342 % first for writing
2343 % \begin{macrocode}
2344 \let\svnkwdef@Revision=\svnkwdef@Rev
2345 \let\svnkwdef@LastChangedRevision=\svnkwdef@Rev
2346 \let\svnkwdef@LastChangedBy=\svnkwdef@Author
2347 \let\svnkwdef@LastChangedDate=\svnkwdef@Date
2348 % \end{macrocode}
2349 % and then for reading.
2350 % \begin{macrocode}
2351 \def\svnkwRevision{\svnkwRev}
2352 \def\svnkwLastChangedRevision{\svnkwRev}
2353 \def\svnkwLastChangedBy{\svnkwAuthor}
2354 \def\svnkwLastChangedDate{\svnkwDate}
2355 \def\svnkwURL{\svnkwHeadURL}
2356 % \end{macrocode}
2357 % So \eg |\svnkw{LastChangedRevision}| is always be the
2358 % same as |\svnkw{Rev}|.
2359 % \end{macro}
2360 % \end{macro}
2361 % \end{macro}
2362 % \end{macro}
2363
2364 % We define default values for normal keywords. Keyword |Filename| is the name
2365 % given by |Id| and not a real keyword.
2366 % \begin{macrocode}
2367 \svnkwdef{Rev}{0}
2368 \svnkwdef{Date}{}
2369 \svnkwdef{Author}{}
2370 \svnkwdef{Filename}{}
2371 \svnkwdef{HeadURL}{}
2372 % \end{macrocode}
2373
2374 % \begin{macro}{\svnkw}[1]{keyword name}
2375 % Macro to get keyword value. Just calls \cs{svnkw}\meta{ARGUMENT} where
2376 % the argument interpreted as text. So \eg |\svnkw{Date}| is the same as
2377 % |svnkwDate| but this could be changed later so always use this interface
2378 % to get the keyword values.
2379 %
2380 % \changes{v1.2}{2007/06/22}{Added warning when a wrong, maybe
2381 % misspelled, keyword is given.}
2382 % \begin{macrocode}
2383 \newcommand{\svnkw}[1]{%
2384 \@ifundefined{svnkw#1}%
2385 {\PackageWarning{svn-multi}{SVN keyword '#1' not defined (typo?)}}%
2386 {\csname svnkw#1\endcsname}%
2387 }%
2388 % \end{macrocode}
2389 % \end{macro}
2390 %
2391
2392 % \subsection{Keyword check and strip macros}
2393 % The following macros are used to test whether the given keywords are fully
2394 % expanded or not.
2395 % Subversion supports unexpanded keywords as input with or without colon and
2396 % with or without trailing space(s), \ie a:~|$KW$|, b:~|$KW:$| or c:~|$KW: $|.
2397 % To avoid \LaTeX{} syntax errors in this pre-commit state the keyword is
2398 % checked by the following macros. Unexpanded keywords result in an empty value.
2399 % Also leading and trailing spaces are removed.
2400 %
2401 % \begin{macro}{\svn@checkcolon}[2]{key}{potential value, might be empty}
2402 % Checks if the keyword contains a colon. It is called by \cs{svnkwsave@read}
2403 % with a trailing |:\relax| so that \#2 will be empty if there is no earlier
2404 % colon or will hold the value with this trailing colon otherwise.
2405 % The first case means that the keyword is unexpanded without colon (case a)
2406 % which leads to an empty value. In the second case \cs{svn@stripcolon} is
2407 % called to strip the colon and surrounding spaces. The final value is
2408 % returned by |\svn@value|.
2409 % \begin{macrocode}
2410 \def\svn@checkcolon#1:#2\relax{%
2411 \svn@ifempty{#2}%
2412 {\svnkwdef{#1}{}}%
2413 {\svn@stripcolon#2\relax\svnkwdef{#1}{\svn@value}}%
2414 }
2415 % \end{macrocode}
2416 % \end{macro}
2417
2418 % \begin{macro}{\svn@stripcolon}[1]{potential value}
2419 % Strips the previous added colon (for \cs{svn@checkcolon}).
2420 % The remaining argument is checked if it's empty (case b) or only a space
2421 % (case c). Otherwise the keyword is expanded and \cs{svn@stripspace} is
2422 % called to strip the spaces.
2423 % \begin{macrocode}
2424 \def\svn@stripcolon#1:\relax{%
2425 \svn@ifempty{#1}%
2426 {\gdef\svn@value{}}%
2427 {\svn@ifequal{#1}{ }%
2428 {\gdef\svn@value{}}%
2429 {\svn@stripspace#1\relax\relax}%
2430 }%
2431 }
2432 % \end{macrocode}
2433 % \end{macro}
2434
2435 % \begin{macro}{\svn@stripspace}[2]{first character}{rest of string}
2436 % Strips leading space if present and calls \cs{svn@striptrailingspace} to
2437 % strip the trailing space.
2438 % \begin{macrocode}
2439 \def\svn@stripspace#1#2\relax{%
2440 \svn@ifequal{#1}{ }%
2441 {\gdef\svn@value{#2}}%
2442 {\svn@striptrailingspace#1#2\relax}%
2443 }
2444 % \end{macrocode}
2445 % \end{macro}
2446
2447 % \begin{macro}{\svn@striptrailingspace}[1]{string}
2448 % Strips trailing space using the macros parameter text. Must be called with
2449 % |\relax| as end marker.
2450 % \begin{macrocode}
2451 \def\svn@striptrailingspace#1 \relax{%
2452 \gdef\svn@value{#1}%
2453 }
2454 % \end{macrocode}
2455 % \end{macro}
2456
2457 % \begin{macro}{\svn@gdefverb}[1]{macro}
2458 % \begin{macrocode}
2459 \def\svn@gdefverb#1{%
2460 \begingroup
2461 \def\svn@temp{#1}%
2462 \begingroup
2463 \if@svnmulti@verbatim
2464 \svn@catcodes
2465 \fi
2466 \svn@gdefverb@
2467 }
2468 % \end{macrocode}
2469 % \end{macro}
2470
2471 % \begin{macro}{\svn@defverb@}[1]{verbatim stuff}
2472 % \begin{macrocode}
2473 \def\svn@gdefverb@#1{%
2474 \endgroup
2475 \expandafter\gdef\svn@temp{#1}%
2476 \endgroup
2477 }
2478 % \end{macrocode}
2479 % \end{macro}
2480
2481 % \begin{macro}{\svn@namegdefverb}[1]{macro name}
2482 % \begin{macrocode}
2483 \def\svn@namegdefverb#1{%
2484 \begingroup
2485 \expandafter\def
2486 \expandafter\svn@temp
2487 \expandafter{\csname #1\endcsname}%
2488 \begingroup
2489 \if@svnmulti@verbatim
2490 \svn@catcodes
2491 \fi
2492 \svn@gdefverb@
2493 }
2494 % \end{macrocode}
2495 % \end{macro}
2496
2497
2498 % \subsection{Date Macros}
2499 % \begin{macro}{\@svn@scandate}[1]{date}
2500 % Scans data information in Id keyword and saves them in macros.
2501 % \begin{macrocode}
2502 \def\@svn@scandate#1{\@svn@scandate@#1\relax}
2503
2504 \def\@svn@scandate@#1-#2-#3 #4:#5:#6#7#8\relax{%
2505 \gdef\svnfileyear{#1}%
2506 \gdef\svnfilemonth{#2}%
2507 \gdef\svnfileday{#3}%
2508 \gdef\svnfilehour{#4}%
2509 \gdef\svnfileminute{#5}%
2510 \gdef\svnfilesecond{#6#7}%
2511 \gdef\svnfiletimezonehour{+00}%
2512 \gdef\svnfiletimezoneminute{00}% #8 always 'Z' for Zulu-time (UTC)
2513 }
2514 % \end{macrocode}
2515 % \end{macro}
2516
2517 % \begin{macro}{\@svn@scanlongdate}[8]{Year}{Month}{Day}{Hour}{Minute}{Second}
2518 % {Timezone}{Date description string (ignored)}
2519 % Scans date information in Date keyword and saves them in macros.
2520 % \begin{macrocode}
2521 \def\@svn@scanlongdate#1{\expandafter\@svn@scanlongdate@#1\relax}
2522 %
2523 \def\@svn@scanlongdate@#1-#2-#3 #4:#5:#6 #7 #8\relax{%
2524 \gdef\svnfileyear{#1}%
2525 \gdef\svnfilemonth{#2}%
2526 \gdef\svnfileday{#3}%
2527 \gdef\svnfilehour{#4}%
2528 \gdef\svnfileminute{#5}%
2529 \gdef\svnfilesecond{#6}%
2530 \@svn@parsetimezone#7\relax%
2531 }
2532 % \end{macrocode}
2533 % \end{macro}
2534
2535 % \begin{macro}{\@svn@parsetimezone}[5]{sign (+/-)}{hour first digit}{hour
2536 % second digit}{minute first digit}{minute second digit}
2537 % Scans timezone and splits hour and minute part.
2538 % \begin{macrocode}
2539 \def\@svn@parsetimezone#1#2#3#4#5\relax{%
2540 \gdef\svnfiletimezonehour{#1#2#3}%
2541 \gdef\svnfiletimezoneminute{#4#5}%
2542 }
2543 % \end{macrocode}
2544 % \end{macro}
2545
2546 % \begin{macro}{\svnpdfdate}
2547 % Returns date in a format needed for |\pdfinfo|.
2548 % \begin{macrocode}
2549 \def\svnpdfdate{%
2550 \svnyear\svnmonth\svnday
2551 \svnhour\svnminute\svnsecond\svntimezonehour'\svntimezoneminute'%
2552 }
2553 % \end{macrocode}
2554 % \end{macro}
2555
2556 % \subsection{Mainfile Makros}
2557 % \begin{macro}{\svnsetmainfile}
2558 % Saves the current |HeadURL| and |Filename| keywords to macros.
2559 % Will be called automatically in the preamble.
2560 % \changes{v1.2}{2007/06/22}{New macro}
2561 % \begin{macrocode}
2562 \newcommand{\svnsetmainfile}{%
2563 \xdef\svnmainurl{\svnfileurl}%
2564 \xdef\svnmainfilename{\svnfilefname}%
2565 }
2566 \AtBeginDocument{\svnsetmainfile}
2567 % \end{macrocode}
2568 % \end{macro}
2569
2570 % \subsection{Register and FullName Macros}
2571 % \begin{macro}{\svnRegisterAuthor}[2]{author username}{Full Name}
2572 % Saves the author's name by defining |svn@author@|\meta{username} to it.
2573 % \begin{macrocode}
2574 \newcommand{\svnRegisterAuthor}[2]{%
2575 \expandafter\def\csname svn@author@#1\endcsname{#2}%
2576 }
2577 % \end{macrocode}
2578 % \end{macro}
2579
2580 % \begin{macro}{\svnFullAuthor}
2581 % \begin{macro}{\svnFullAuthor*}
2582 % We test if the starred or the normal version is used and call the
2583 % appropriate submacro |svnFullAuthor@star| or |svnFullAuthor@normal|.
2584 % \changes{v1.2}{2007/06/22}{Macro now returns the username if the full name
2585 % was not registered.}
2586 % \begin{macrocode}
2587 \newcommand{\svnFullAuthor}{%
2588 \@ifnextchar{*}%
2589 {\svnFullAuthor@star}%
2590 {\svnFullAuthor@normal}%
2591 }%
2592 % \end{macrocode}
2593 % \end{macro}
2594 % \end{macro}
2595 % \begin{macro}{\svnFullAuthor@star}[1]{username}
2596 % Both submacros are calling |svnFullAuthor@| but with different arguments.
2597 % The star macro also removes the star of course.
2598 % \begin{macrocode}
2599 \def\svnFullAuthor@star*#1{%
2600 \edef\svn@temp{#1}%
2601 \svnFullAuthor@{\svn@temp}{~(\svn@temp)}%
2602 }%
2603 % \end{macrocode}
2604 % \end{macro}
2605 % \begin{macro}{\svnFullAuthor@normal}[1]{username}
2606 % \begin{macrocode}
2607 \def\svnFullAuthor@normal#1{%
2608 \edef\svn@temp{#1}%
2609 \svnFullAuthor@{\svn@temp}{}%
2610 }%
2611 % \end{macrocode}
2612 % \end{macro}
2613 % \begin{macro}{\svnFullAuthor@}[2]{username}{previous defined trailing string}
2614 % |svnFullAuthor@| now sets the author's full name. Note that |#2| is empty
2615 % when the normal version is called.
2616 % \begin{macrocode}
2617 \def\svnFullAuthor@#1#2{%
2618 \@ifundefined{svn@author@#1}%
2619 {#1}%
2620 {\csname svn@author@#1\endcsname #2}%
2621 }
2622 % \end{macrocode}
2623 % \end{macro}
2624
2625 % \begin{macro}{\svnRegisterRevision}[2]{revision number}{tag name}
2626 % Saves the revision's name or tag by defining
2627 % |svn@revision@|\meta{revisionnumber} to it.
2628 % \changes{v1.2}{2007/06/22}{New macro}
2629 % \begin{macrocode}
2630 \newcommand{\svnRegisterRevision}[2]{%
2631 \expandafter\def\csname svn@revision@#1\endcsname{#2}%
2632 }
2633 % \end{macrocode}
2634 % \end{macro}
2635
2636 % \begin{macro}{\svnFullRevision}
2637 % \begin{macro}{\svnFullRevision*}
2638 % We test if the starred or the normal version is used and call the
2639 % appropriate submacro |svnFullRevision@star| or |svnFullRevision@normal|.
2640 % \changes{v1.2}{2007/06/22}{New macro}
2641 % \begin{macrocode}
2642 \newcommand{\svnFullRevision}{%
2643 \@ifnextchar{*}%
2644 {\svnFullRevision@star}%
2645 {\svnFullRevision@normal}%
2646 }
2647 % \end{macrocode}
2648 % \end{macro}
2649 % \end{macro}
2650 %
2651 % \begin{macro}{\svnFullRevision@star}[1]{revision number}
2652 % Both submacros are calling |svnFullRevision@| but with different arguments.
2653 % The star macro also removes the star of course.
2654 % \begin{macrocode}
2655 \def\svnFullRevision@star*#1{%
2656 \edef\svn@temp{#1}%
2657 \svnFullRevision@{\svn@temp}{~(r\svn@temp)}%
2658 }
2659 % \end{macrocode}
2660 % \end{macro}
2661 % \begin{macro}{\svnFullRevision@normal}[1]{revision number}
2662 % \begin{macrocode}
2663 \def\svnFullRevision@normal#1{%
2664 \edef\svn@temp{#1}%
2665 \svnFullRevision@{\svn@temp}{}%
2666 }
2667 % \end{macrocode}
2668 % \end{macro}
2669 % \begin{macro}{\svnFullRevision@}[2]{revision number}{previous defined trailing
2670 % string}
2671 % |svnFullRevision@| now sets the revision name. Note that |#2| is empty
2672 % when the normal version is called.
2673 % \begin{macrocode}
2674 \def\svnFullRevision@#1#2{%
2675 \@ifundefined{svn@revision@#1}%
2676 {Revision #1}%
2677 {\csname svn@revision@#1\endcsname #2}%
2678 }
2679 % \end{macrocode}
2680 % \end{macro}
2681
2682 % \subsection{Input File Name}
2683 % The \pkg{currfile} package is used to get the input file names. AtBegin/AtEnd
2684 % hooks are installed which will be used later.
2685 % \begin{macrocode}
2686 \if@svnmulti@filehooks
2687 % \end{macrocode}
2688
2689 % Load \pkg{filehook} and \pkg{currfile} packages.
2690 % \begin{macrocode}
2691 \RequirePackage{filehook}[2011/01/03]
2692 \RequirePackage{currfile}[2011/01/03]
2693 % \end{macrocode}
2694
2695 % The following code installs the necessary hooks for subfiles.
2696 % It installs an own file stack \pkg{currfile} does.
2697 % The macro \cs{svn@pg} for the parent group needs to be set before
2698 % \cs{currfilepath} etc. is updated, so the internal \pkg{filehook}
2699 % macros are used to install the code before the \pkg{currfile} code.
2700 % This means that the file name macros below still hold the values of the
2701 % parent file.
2702 %
2703 % \begin{macrocode}
2704 \filehook@prefixwarg\filehook@every@atbegin{%
2705 \svn@pushfilestack
2706 \if@svnmulti@groups
2707 \svn@ifequal{\currfilepath}{\jobname.\currfile@mainext}%
2708 {\xdef\svn@pg{\svn@g}}%
2709 {\xdef\svn@pg{\currfiledir\currfilebase}}%
2710 \fi
2711 }
2712 % \end{macrocode}
2713 %
2714 % The file stack is popped at the end of the file hook to keep the macros valid
2715 % for normal hook code.
2716 % \begin{macrocode}
2717 \filehook@appendwarg\filehook@every@atend{%
2718 \svn@popfilestack
2719 }
2720 % \end{macrocode}
2721 %
2722 % \begin{macrocode}
2723 \def\svn@filestack{{}}
2724
2725 \def\svn@pushfilestack{%
2726 \xdef\svn@filestack{{%
2727 {\svnfilerev}%
2728 {\svnfiledate}%
2729 {\svnfileauthor}%
2730 {\svnfileyear}%
2731 {\svnfilemonth}%
2732 {\svnfileday}%
2733 {\svnfilehour}%
2734 {\svnfileminute}%
2735 {\svnfilesecond}%
2736 {\svnfiletimezonehour}%
2737 {\svnfiletimezoneminute}%
2738 {\svnfileurl}%
2739 {\svnfilefname}%
2740 {\svn@g}%
2741 {\svn@pg}%
2742 {\ifsvnfilemodified{@firstoftwo}{@secondoftwo}}%
2743 }\svn@filestack}%
2744 }
2745
2746 \def\svn@restorefilekws#1#2\relax{%
2747 \svn@restorefilekws@#1\empty
2748 \empty \empty \empty \empty
2749 \empty \empty \empty \empty
2750 \empty \empty \empty \empty \empty
2751 \svn@ifempty{#2}%
2752 {\gdef\svn@filestack{{}}}%
2753 {\gdef\svn@filestack{#2}}%
2754 }
2755 \def\svn@restorefilekws@#1#2#3#4#5#6#7#8#9{%
2756 \gdef\svnfilerev{#1}%
2757 \gdef\svnfiledate{#2}%
2758 \gdef\svnfileauthor{#3}%
2759 \gdef\svnfileyear{#4}%
2760 \gdef\svnfilemonth{#5}%
2761 \gdef\svnfileday{#6}%
2762 \gdef\svnfilehour{#7}%
2763 \gdef\svnfileminute{#8}%
2764 \gdef\svnfilesecond{#9}%
2765 \svn@restorefilekws@@
2766 }
2767
2768 \def\svn@restorefilekws@@#1#2#3#4#5#6#7{%
2769 \gdef\svnfiletimezonehour{#1}%
2770 \gdef\svnfiletimezoneminute{#2}%
2771 \gdef\svnfileurl{#3}%
2772 \gdef\svnfilefname{#4}%
2773 \gdef\svn@g{#5}%
2774 \gdef\svn@pg{#6}%
2775 \expandafter\global\expandafter\let
2776 \expandafter\ifsvnfilemodified\csname#7\endcsname%
2777 }
2778
2779 \def\svn@popfilestack{%
2780 \ifx\svn@filestack\empty
2781 \PackageWarning{svn-multi}{Underflow of file keyword stack!}%
2782 \else
2783 \svn@ifequal{\svn@filestack}{{}}%
2784 {\PackageWarning{svn-multi}{Underflow of file keyword stack!}}%
2785 {\expandafter\svn@restorefilekws\svn@filestack\relax}%
2786 \fi
2787 }
2788
2789 %
2790 % \end{macrocode}
2791
2792 % \begin{macrocode}
2793 \fi
2794 % \end{macrocode}
2795
2796 % \subsection{Keyword Group Macros}
2797 % These macros implement the user interface for the keyword group functionality
2798 % introduced with v2.0.
2799 %
2800 % The list of keyword groups |\svn@glist| is initial set empty and will be
2801 % filled by \cs{svngroup}.
2802 % \begin{macrocode}
2803 \if@svnmulti@groups
2804 \let\svn@glist=\empty
2805 % \end{macrocode}
2806
2807 % \begin{macro}{\svngroup}[1]{group name}
2808 % Saves the group to |\svn@g| and initiates \Macro\svn@g@<group name>'@rev'
2809 % and \Macro\@svn@g@<group name>'@rev' if this is the first time the group
2810 % got used.\par
2811 % The current group symbol "*" is invalid here because there is no way to
2812 % change to a current group.
2813 % \begin{macrocode}
2814 \def\svngroup#1{%
2815 \svn@ifequal{#1}{*}%
2816 {\PackageError{svn-multi}%
2817 {The group name '*' is invalid for '\string\svngroup'}{}%
2818 }{}%
2819 \xdef\svn@g{#1}%
2820 \let\svn@pg\svn@g
2821 \svn@checkgroup{#1}%
2822 }
2823 \def\svn@checkgroup#1{%
2824 \begingroup
2825 \edef\svn@g{#1}%
2826 % \end{macrocode}
2827 % Only initialise the group at first usage:
2828 % \begin{macrocode}
2829 \ifx\svn@g\empty\else%
2830 \expandafter
2831 \ifx\csname @svng@\svn@g @rev\endcsname\relax%
2832 \svn@initgroup{\svn@g}%
2833 % \end{macrocode}
2834 % Now save new group to list. The list is checked if its empty to avoid an
2835 % unwanted leading comma.
2836 % \begin{macrocode}
2837 \ifx\svn@glist\empty
2838 \xdef\svn@glist{#1}%
2839 \else
2840 \xdef\svn@glist{\svn@glist,#1}%
2841 \fi
2842 \fi
2843 \fi
2844 \endgroup
2845 }
2846 % \end{macrocode}
2847 % \end{macro}
2848
2849 % \begin{macro}{\thesvngroup}
2850 % Returns the current group name to the user.
2851 % \begin{macrocode}
2852 \def\thesvngroup{\svn@g}
2853 % \end{macrocode}
2854 % \end{macro}
2855
2856 % \begin{macro}{\svnsetcg}[1]{group name}
2857 % Defines |\svn@cg| to the given argument or to |\svn@g| if the argument was
2858 % `|*|'.
2859 % \begin{macrocode}
2860 \def\svnsetcg#1{%
2861 \svn@ifequal{#1}{*}%
2862 {\def\svn@cg{\svn@g}}%
2863 {\def\svn@cg{#1}}%
2864 }
2865 % \end{macrocode}
2866 % \end{macro}
2867
2868 % \begin{macro}{\svncg@def}[1]{key name, \eg `rev', `date'}
2869 % Defines a |\svncgXXX| macro, \eg |svncgrev|, which returns the
2870 % requested keyword values of the current keyword group.
2871 % \begin{macrocode}
2872 \def\svncg@def#1{%
2873 \expandafter
2874 \def\csname svncg#1\endcsname{%
2875 \@ifundefined{svng@\svn@cg @#1}{??}{%
2876 \csname svng@\svn@cg @#1\endcsname}%
2877 }%
2878 }
2879 % \end{macrocode}
2880 % \end{macro}
2881
2882 % \begin{macro}{\svncgrev}
2883 % \begin{macro}{\svncgdate}
2884 % \begin{macro}{\svncgauthor}
2885 % \begin{macro}{\svncgyear}
2886 % \begin{macro}{\svncgmonth}
2887 % \begin{macro}{\svncgday}
2888 % \begin{macro}{\svncghour}
2889 % \begin{macro}{\svncgminute}
2890 % \begin{macro}{\svncgsecond}
2891 % \begin{macro}{\svncgtimezonehour}
2892 % \begin{macro}{\svncgtimezoneminute}
2893 % \begin{macro}{\svncgurl}
2894 % \begin{macro}{\svncgfname}
2895 % Define all |\svncgXXX| macros by calling \cs{svncg@def} in a for loop.
2896 % \begin{macrocode}
2897 \@for\@tempa:=%
2898 rev,author,date,year,month,day,hour,minute,second,%
2899 timezonehour,timezoneminute,url,fname%
2900 \do{%
2901 \expandafter\svncg@def\expandafter{\@tempa}%
2902 }
2903 % \end{macrocode}
2904 % \end{macro}
2905 % \end{macro}
2906 % \end{macro}
2907 % \end{macro}
2908 % \end{macro}
2909 % \end{macro}
2910 % \end{macro}
2911 % \end{macro}
2912 % \end{macro}
2913 % \end{macro}
2914 % \end{macro}
2915 % \end{macro}
2916 % \end{macro}
2917
2918 % \begin{macro}{\thesvncg}
2919 % Simply return the internal macro.
2920 % \begin{macrocode}
2921 \def\thesvncg{\svn@cg}
2922 % \end{macrocode}
2923 % \end{macro}
2924
2925 % \begin{macro}{\svng}[2]{group name}{keyword name}
2926 % Simply returns |svng@#1@#2| if defined, '??' otherwise.
2927 % \begin{macrocode}
2928 \def\svng#1#2{%
2929 \@ifundefined{svng@\svn@temp @#2}%
2930 {??}%
2931 {\csname svng@\svn@temp @#2\endcsname}%
2932 }
2933 % \end{macrocode}
2934 % \end{macro}
2935
2936 % \begin{macro}{\svn@addfiletogroup}[2]{file name}{group name}
2937 % Adds the given file to the given group. If the group list doesn't exist yet
2938 % it is initialised. A extra macro for each file is used to remember that the
2939 % file is already in the group. This could be avoided using a list search.\par
2940 % This is an internal macro so no `|*|' substitution for the group name.
2941 % \begin{macrocode}
2942 \def\svn@addfiletogroup#1#2{%
2943 \svn@ifequal{#1}{#2}{}{%
2944 \expandafter
2945 \ifx\csname @svng@#2@files@#1\endcsname\relax%
2946 \expandafter\gdef\csname @svng@#2@files@#1\endcsname{1}%
2947 %
2948 \expandafter\ifx\csname @svng@#2@files\endcsname\empty%
2949 \expandafter\xdef\csname @svng@#2@files\endcsname{#1}%
2950 \else
2951 \@ifundefined{@svng@#2@files}%
2952 {\expandafter\xdef\csname @svng@#2@files\endcsname{#1}}%
2953 {\expandafter\xdef\csname @svng@#2@files\endcsname{%
2954 \csname @svng@#2@files\endcsname,#1%
2955 }%
2956 }%
2957 \fi
2958 \fi
2959 }%
2960 }
2961 % \end{macrocode}
2962 % \end{macro}
2963
2964 % The input files are added to the list of the current group at their begin to
2965 % have them before the included graphics and other external files.
2966 % Special care is taken to not re-initialise the main file which could happen in
2967 % some special cases (\eg |\lstinputlisting{\jobname .tex}|).
2968 % \begin{macrocode}
2969 \AtBeginOfFiles{%
2970 \svn@ifequal{\currfilepath}{\jobname.\currfile@mainext}%
2971 {}%
2972 {\svn@initfile}%
2973 \svn@ifequal{\currfileext}{\currfile@mainext}%
2974 {\svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}}{}%
2975 \svn@ifequal{\currfileext}{sty}%
2976 {\svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}}{}%
2977 \svn@ifequal{\currfileext}{cls}%
2978 {\svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}}{}%
2979 \svn@addfiletogroup{\currfilepath}{\currfiledir\currfilebase}%
2980 }
2981 % \end{macrocode}
2982
2983 % \begin{macro}{\svn@writegroup}[1]{group name}
2984 % Writes group to |\svn@write| file.
2985 % \begin{macrocode}
2986 \def\svn@writegroup#1{%
2987 \def\svn@writekw##1{%
2988 \immediate\write\svn@write{%
2989 \string\global\string\@namedef{svng@#1@##1}{\csname @svng@#1@##1\endcsname}%
2990 }%
2991 }%
2992 \svn@writekw{rev}%
2993 \svn@writekw{date}%
2994 \svn@writekw{author}%
2995 \svn@writekw{year}%
2996 \svn@writekw{month}%
2997 \svn@writekw{day}%
2998 \svn@writekw{hour}%
2999 \svn@writekw{minute}%
3000 \svn@writekw{second}%
3001 \svn@writekw{timezonehour}%
3002 \svn@writekw{timezoneminute}%
3003 \@ifundefined{@svng@#1@files}{}{%
3004 \immediate\write\svn@write{%
3005 \noexpand
3006 \svn@namegdefverb{svng@#1@files}{\csname @svng@#1@files\endcsname}%
3007 }%
3008 }%
3009 \immediate\write\svn@write{%
3010 \noexpand
3011 \svn@namegdefverb{svng@#1@url}{\csname @svng@#1@url\endcsname}^^J%
3012 \noexpand
3013 \svn@namegdefverb{svng@#1@fname}{\csname @svng@#1@fname\endcsname}^^J%
3014 }%
3015 }
3016 % \end{macrocode}
3017 % \end{macro}
3018 %
3019 % \begin{macro}{\svn@writeallgroups}[1]{macro holding a list of groups}
3020 % \begin{macrocode}
3021 \def\svn@writeallgroups#1{%
3022 \begingroup
3023 \ifx\relax#1\relax\else
3024 \@for\svn@temp:=#1\do{%
3025 \svn@ifvalidrev{@svng@\svn@temp @rev}%
3026 {%
3027 \expandafter
3028 \svn@cleanfilelist\csname @svng@\svn@temp @files\endcsname
3029 \svn@writegroup{\svn@temp}%
3030 \@ifundefined{@svng@\svn@temp @files}{}%
3031 {\expandafter\svn@writeallgroups
3032 \csname @svng@\svn@temp @files\endcsname
3033 }%
3034 }{}%
3035 }%
3036 \fi
3037 \endgroup
3038 }
3039 % \end{macrocode}
3040 % \end{macro}
3041
3042 % \begin{macro}{\svn@updategroup}[1]{group name}
3043 % Updates group with |\svnfile...| macro values.
3044 % \begin{macrocode}
3045 \def\svn@updategroup#1{%
3046 \@ifundefined{@svng@#1@rev}%
3047 {\svn@initgroup{#1}}%
3048 {}%
3049 \expandafter
3050 \ifnum\csname @svng@#1@rev\endcsname<\svnfilerev
3051 \svn@gkwset{#1}{rev}{\svnfilerev}%
3052 \svn@gkwset{#1}{date}{\svnfiledate}%
3053 \svn@gkwset{#1}{author}{\svnfileauthor}%
3054 \svn@gkwset{#1}{year}{\svnfileyear}%
3055 \svn@gkwset{#1}{month}{\svnfilemonth}%
3056 \svn@gkwset{#1}{day}{\svnfileday}%
3057 \svn@gkwset{#1}{hour}{\svnfilehour}%
3058 \svn@gkwset{#1}{minute}{\svnfileminute}%
3059 \svn@gkwset{#1}{second}{\svnfilesecond}%
3060 \svn@gkwset{#1}{timezonehour}{\svnfiletimezonehour}%
3061 \svn@gkwset{#1}{timezoneminute}{\svnfiletimezoneminute}%
3062 \svn@gkwset{#1}{url}{\svnfileurl}%
3063 \svn@gkwset{#1}{fname}{\svnfilefname}%
3064 \fi
3065 }
3066 % \end{macrocode}
3067 % \end{macro}
3068
3069 % \begin{macro}{\svn@definegroup}[1]{group name}
3070 % Defines group value so that they are available for the user, e.g. instead of
3071 % the internal |@svng@...| macros it sets the |svng@...| macros.
3072 % This is done by calling \cs{svn@updategroup} with a modified version of
3073 % \cs{svn@gkwset}.
3074 % \begin{macrocode}
3075 \def\svn@definegroup#1{%
3076 \svn@gkwdef{#1}{rev}%
3077 \svn@gkwdef{#1}{date}%
3078 \svn@gkwdef{#1}{author}%
3079 \svn@gkwdef{#1}{year}%
3080 \svn@gkwdef{#1}{month}%
3081 \svn@gkwdef{#1}{day}%
3082 \svn@gkwdef{#1}{hour}%
3083 \svn@gkwdef{#1}{minute}%
3084 \svn@gkwdef{#1}{second}%
3085 \svn@gkwdef{#1}{timezonehour}%
3086 \svn@gkwdef{#1}{timezoneminute}%
3087 \svn@gkwdef{#1}{url}%
3088 \svn@gkwdef{#1}{fname}%
3089 }
3090 % \end{macrocode}
3091 % \end{macro}
3092
3093 % \begin{macro}{\svn@initgroup}[1]{group name}
3094 % Initialises group.
3095 % \begin{macrocode}
3096 \def\svn@initgroup#1{%
3097 \svn@gkwset{#1}{rev}{\svn@revinit}%
3098 \svn@gkwset{#1}{date}{}%
3099 \svn@gkwset{#1}{author}{}%
3100 \svn@gkwset{#1}{year}{0000}%
3101 \svn@gkwset{#1}{month}{00}%
3102 \svn@gkwset{#1}{day}{00}%
3103 \svn@gkwset{#1}{hour}{00}%
3104 \svn@gkwset{#1}{minute}{00}%
3105 \svn@gkwset{#1}{second}{00}%
3106 \svn@gkwset{#1}{timezonehour}{+00}%
3107 \svn@gkwset{#1}{timezoneminute}{00}%
3108 \svn@gkwset{#1}{url}{}%
3109 \svn@gkwset{#1}{fname}{}%
3110 }
3111 % \end{macrocode}
3112 % \end{macro}
3113
3114
3115 % \begin{macro}{\svn@gkwset}[3]{group name}{keyword name}{value}
3116 % Sets \meta{value} for \meta{keyword} in \meta{\/group}.
3117 % \begin{macrocode}
3118 \def\svn@gkwset#1#2#3{%
3119 \expandafter
3120 \xdef\csname @svng@#1@#2\endcsname{#3}%
3121 }
3122 % \end{macrocode}
3123 % \end{macro}
3124
3125 % \begin{macro}{\svn@gkwdef}[2]{group name}{keyword name}
3126 % Defines |svng@...| macros used by the user macros to the value of the
3127 % internal |@svng@...| macros.
3128 % \begin{macrocode}
3129 \def\svn@gkwdef#1#2{%
3130 \expandafter
3131 \xdef\csname svng@#1@#2\endcsname{\csname @svng@#1@#2\endcsname}%
3132 }
3133 % \end{macrocode}
3134 % \end{macro}
3135
3136 % \begin{macro}{\svn@cleanfilelist}[1]{macro holing a file list}
3137 % Takes a macro which holds a file list and removes all files from the list
3138 % which don't have a valid revision number.
3139 % \begin{macrocode}
3140 \def\svn@cleanfilelist#1{
3141 \begingroup
3142 \def\svn@tmplist{}%
3143 \ifx\relax#1\relax\else
3144 \@for\svn@temp:=#1\do{%
3145 \expandafter\svn@ifvalidrev
3146 \expandafter{@svng@\svn@temp @rev}%
3147 {\edef\svn@tmplist{\svn@tmplist,\svn@temp}}%
3148 {}%
3149 }%
3150 \xdef#1{\expandafter\@gobble\svn@tmplist\empty}%
3151 \fi
3152 \endgroup
3153 }
3154 % \end{macrocode}
3155 % \end{macro}
3156
3157 % \begin{macrocode}
3158 \fi
3159 % \end{macrocode}
3160
3161 % \subsection{Files as extra groups}
3162 % Macros which allow single files to be declared as extra groups so that their
3163 % keywords can be accessed in the whole document like with normal groups.
3164 % This special groups are not added to the list of groups.
3165
3166 % A user-level switch is declared to enable or disable the automatic declaration
3167 % of every file as own group. This causes \cs{svnsubgroup} to be called for
3168 % all input files.
3169 % The if macro is defined outside the |\if@svnmulti@subgroups| because
3170 % |\newif| inside |\if| is not a good idea.
3171 % \begin{macrocode}
3172 \newif\ifsvnsubgroups
3173 \svnsubgroupsfalse
3174 % \end{macrocode}
3175
3176 % \begin{macrocode}
3177 \if@svnmulti@subgroups
3178 \svnsubgroupstrue
3179 % \end{macrocode}
3180
3181 % \begin{macro}{\svnsubgroup}
3182 % User level and internal macro to declare the current file as extra group.
3183 % It produces the current file path and calls \cs{svn@subgroup}.
3184 % Creates two groups one with and one without the file extension. The one
3185 % without holds the latest revision of all files included in this file.
3186 % \begin{macrocode}
3187 \def\svnsubgroup{%
3188 \begingroup
3189 \svn@subgroup{\currfiledir\currfilebase}%
3190 \svn@subgroup{\currfilepath}%
3191 \endgroup
3192 }
3193 % \end{macrocode}
3194 % \end{macro}
3195
3196 % \begin{macro}{\svn@subgroup}[1]{file name}
3197 % Macro to write a file as group to |.aux| file. After checking if the filename
3198 % was not already written, the |.aux| file is checked if it is open and then the
3199 % file keyword information is written.
3200 % \begin{macrocode}
3201 \def\svn@subgroup#1{%
3202 \ifnum\svnfilerev=\svn@revinit\else
3203 \expandafter\ifx\csname svn@g@#1\endcsname\relax%
3204 \expandafter\gdef\csname svn@g@#1\endcsname{1}%
3205 \svn@updategroup{#1}%
3206 \fi
3207 \fi
3208 }
3209 % \end{macrocode}
3210 % \end{macro}
3211
3212 % \begin{macro}{\svnignoreextensions}[1]{A comma separated list of file name
3213 % extensions (without leading dot) to ignore for automatic \csd{svnsubgroup}.}
3214 % A special macro is defined for all extensions. The existents of this macro is
3215 % then tested later to check if this extension should be ignored.
3216 % \begin{macrocode}
3217 \def\svnignoreextensions#1{%
3218 \@for\svn@temp:=#1\do{%
3219 \expandafter\def\csname svn@ignore@ext@\svn@temp\endcsname{}%
3220 }%
3221 }
3222 % \end{macrocode}
3223 % \end{macro}
3224
3225 % \begin{macro}{\svnconsiderextensions}[1]{A comma separated list of file name
3226 % extensions (without leading dot) to consider for automatic
3227 % \csd{svnsubgroup}.}
3228 % The special macro defined by \csi{svnignoreextentions} is deleted, i.e. |\let|
3229 % to |\relax|.
3230 % \begin{macrocode}
3231 \def\svnconsiderextensions#1{%
3232 \@for\svn@temp:=#1\do{%
3233 \expandafter\let\csname svn@ignore@ext@\svn@temp\endcsname\relax%
3234 }%
3235 }
3236 % \end{macrocode}
3237 % \end{macro}
3238
3239 % The following extensions are ignored by default.
3240 % \begin{macrocode}
3241 \svnignoreextensions{aux,bbl,fd,enc,fls,glo,idx,ilg,ind,ist,%
3242 lof,log,lot,out,svn,svt,svx,toc}
3243 % \end{macrocode}
3244
3245 % Check at the end of every input file if files should be extra groups and
3246 % declare this file as group if its extension is not configured to be ignored.
3247 % \begin{macrocode}
3248 \AtEndOfFiles{%
3249 \if@svnmulti@subgroups
3250 \ifsvnsubgroups
3251 \expandafter\ifx\csname svn@ignore@ext@\currfileext\endcsname\relax
3252 \svnsubgroup
3253 \fi
3254 \fi
3255 \fi
3256 }
3257 % \end{macrocode}
3258
3259 % The main file is added to the main base name (|\jobname|) subgroup here. This
3260 % subgroup is added as first element to the active group at begin of the
3261 % document body.
3262 % \begin{macrocode}
3263 \if@svnmulti@subgroups
3264 \ifsvnsubgroups
3265 \svn@addfiletogroup{\jobname .\currfile@mainext}{\jobname}%
3266 \svnsubgroup
3267 \fi
3268 \fi
3269 \AtBeginDocument{%
3270 \if@svnmulti@subgroups
3271 \ifsvnsubgroups
3272 \@ifundefined{@svng@\svn@g @files@\jobname}%
3273 {%
3274 \@namedef{@svng@\svn@g @files@\jobname}{1}%
3275 \@ifundefined{@svng@\svn@g @files}%
3276 {%
3277 \expandafter
3278 \xdef\csname @svng@\svn@g @files\endcsname{\jobname}%
3279 }%
3280 {%
3281 \expandafter
3282 \xdef\csname @svng@\svn@g @files\endcsname
3283 {\jobname,\csname @svng@\svn@g @files\endcsname}%
3284 }%
3285 }{}%
3286 \svnsubgroup
3287 \fi
3288 \fi
3289 }
3290 % \end{macrocode}
3291
3292 % \begin{macrocode}
3293 \fi
3294 % \end{macrocode}
3295
3296 % \subsection{External Files}
3297 % Macros to declare external files and load the keywords from |.svx| files
3298 % generated by \scr{svn-multi.pl}.
3299 % \begin{macrocode}
3300 \if@svnmulti@external
3301 % \end{macrocode}
3302
3303 % \begin{macro}{\svnexternalgroup}[1]{group name}
3304 % Defines the default group of external files. The default is to always use the
3305 % current group. An empty argument puts the external files in no group. A `|*|'
3306 % switches back to always use the current group.
3307 % \begin{macrocode}
3308 \if@svnmulti@groups
3309 \def\svnexternalgroup#1{%
3310 \svn@ifequal{#1}{*}%
3311 {\def\svn@externalgroup{\svn@pg}}%
3312 {\def\svn@externalgroup{#1}}%
3313 }
3314 \def\svn@externalgroup{\svn@pg}
3315 \else
3316 \def\svn@externalgroup{}
3317 \fi
3318 % \end{macrocode}
3319 % \end{macro}
3320
3321 % \begin{macro}{\svnexternal}[2]{group name}{list of filenames in \texttt{\{
3322 % \}}}
3323 % \begin{macrocode}
3324 \if@svnmulti@autokw
3325 % \end{macrocode}
3326 %
3327 % \begin{macrocode}
3328 \newcommand*\svnexternal[2][]{%
3329 \svn@pushfilestack
3330 \svn@ifequal{#1}{*}%
3331 {\edef\svn@eg{\svn@pg}}%
3332 {\svn@ifempty{#1}%
3333 {\edef\svn@eg{\svn@externalgroup}}%
3334 {\edef\svn@eg{#1}}%
3335 }%
3336 \svn@checkgroup{\svn@eg}%
3337 \svne@@external#2\relax
3338 \svn@popfilestack
3339 }
3340
3341 \def\svne@@external#1{%
3342 \ifx\relax#1\empty\else
3343 \svnegetfile{#1}%
3344 \begingroup\svn@externalfile{\svn@eg}{#1}%
3345 \expandafter\svne@@external
3346 \fi
3347 }
3348 % \end{macrocode}
3349 %
3350 % \begin{macrocode}
3351 \else
3352 % \end{macrocode}
3353 % Writes the current input file path and its argument as arguments of
3354 % \cs{@svnexternal} into the |.aux| file.
3355 % \begin{macrocode}
3356 \newcommand*\svnexternal[2][]{%
3357 \if@filesw
3358 \begingroup
3359 \svn@ifequal{#1}{*}%
3360 {\def\svn@temp{\svn@pg}}%
3361 {\svn@ifempty{#1}%
3362 {\def\svn@temp{\svn@externalgroup}}%
3363 {\def\svn@temp{#1}}%
3364 }%
3365 \let\protect\@unexpandable@protect
3366 \immediate\write\svn@write{%
3367 \noexpand\@svnexternal[\svn@temp]{\currfilepath}{#2}%
3368 }%
3369 \endgroup
3370 \fi
3371 \svn@inputsvx{\currfiledir\currfilebase}%
3372 }
3373 % \end{macrocode}
3374 % \begin{macrocode}
3375 \fi
3376 % \end{macrocode}
3377 % \end{macro}
3378
3379 % \begin{macro}{\svnexternalpath}[1]{list of paths in \texttt{\{ \}}}
3380 % Writes its argument as argument of \cs{@svnexternalpath} into the |.aux| file.
3381 % \begin{macrocode}
3382 \def\svnexternalpath#1{%
3383 \if@filesw
3384 \begingroup
3385 \let\protect\@unexpandable@protect
3386 \immediate\write\svn@write{%
3387 \noexpand\@svnexternalpath{#1}%
3388 }%
3389 \endgroup
3390 \fi
3391 }
3392 % \end{macrocode}
3393 % \end{macro}
3394
3395 % \begin{macro}{\@svnexternal}
3396 % \begin{macro}{\@svnexternalpath}
3397 % Discards the argument(s). These macros and their arguments are only used by
3398 % the external \scr{svn-multi.pl} script.
3399 % \begin{macrocode}
3400 \newcommand*\@svnexternal[3][]{}
3401 \def\@svnexternalpath#1{}
3402 % \end{macrocode}
3403 % \end{macro}
3404 % \end{macro}
3405
3406
3407 % \begin{macro}{\svnexternalfile}
3408 % This macro is generated by \scr{svn-multi.pl} and should not be used by the
3409 % user. If files-as-group is enabled some special characters are disabled and
3410 % the \cs{svn@externalfile} is called to read the file name. Otherwise the
3411 % argument is simply removed.
3412 % \begin{macrocode}
3413 \newcommand*\svnexternalfile[1][\currfiledir\currfilebase]{%
3414 \begingroup % TODO: maybe use \svn@catcodes
3415 \catcode`\_=12
3416 \catcode`\&=12
3417 \catcode`\^=12
3418 \catcode`\$=12
3419 \catcode`\#=12
3420 \svn@externalfile{#1}%
3421 }
3422 % \end{macrocode}
3423 % \end{macro}
3424
3425 % \begin{macro}{\svn@externalfile}[2]{group name}{file name}
3426 % Ends group which began in \cs{svnexternalfile} and calls the appropriate
3427 % macros.
3428 % \begin{macrocode}
3429 \def\svn@externalfile#1#2{%
3430 \endgroup
3431 \if@svnmulti@subgroups
3432 \ifsvnsubgroups
3433 \svn@ifequal{#1}{\svn@rg}%
3434 {\svn@addfiletogroup{#2}{\currfiledir\currfilebase}}%
3435 {\svn@addfiletogroup{#2}{#1}}%
3436 \svn@subgroup{#2}%
3437 \fi
3438 \fi
3439 }
3440 % \end{macrocode}
3441 % \end{macro}
3442
3443 % If \opt{external} option is not enabled a placeholder macro is defined which
3444 % simply ignores its argument.
3445 % \begin{macrocode}
3446 \else
3447 \def\svnexternalfile#1{}%
3448 \fi
3449 % \end{macrocode}
3450
3451
3452 % \subsection{Auto loading of \texttt{.svx} files}
3453 % Auto loading of |.svx| files at the begin of |\input| or |\include| files
3454 % using the \cs{AtBeginOfFiles} hook.
3455 % The macros \cs{svn@addfiletogroup} and \cs{svnsubgroup} are used to do the
3456 % actual work.
3457 % \begin{macrocode}
3458 \if@svnmulti@autoload
3459
3460 \AtBeginOfFiles{%
3461 \svn@ifequal{\currfileext}{tex}%
3462 {\svn@inputsvx{\currfiledir\currfilebase}}%
3463 {}%
3464 }
3465 % \end{macrocode}
3466
3467 % The main |.svx| is loaded at the end of the package.
3468 % \begin{macrocode}
3469 %%\AtEndOfPackage{%
3470 \AtBeginDocument{%
3471 \svn@inputsvx{\jobname}%
3472 }
3473 % \end{macrocode}
3474
3475 % \begin{macrocode}
3476 \fi
3477 % \end{macrocode}
3478
3479
3480 % \subsection{Support for Graphic Packages}
3481
3482 % \subsubsection{Common Code}
3483 % \begin{macrocode}
3484 \if@svnmulti@anygraphic
3485 % \end{macrocode}
3486
3487 % \begin{macro}{\svngraphicsgroup}[1]{graphic group name}
3488 % Defines the default group of graphics files. The default is empty which means
3489 % the current group.
3490 % \begin{macrocode}
3491 \def\svngraphicsgroup#1{%
3492 \svn@ifequal{#1}{*}%
3493 {\def\svn@graphicsgroup{\svn@pg}}%
3494 {\def\svn@graphicsgroup{#1}}%
3495 }
3496 \def\svn@graphicsgroup{\svn@externalgroup}
3497 % \end{macrocode}
3498 % \end{macro}
3499
3500 % \begin{macro}{\svnignoregraphic}[1]{file name/path}
3501 % Ignores the given graphic file by defining a special macro.
3502 % \begin{macrocode}
3503 \def\svnignoregraphic#1{%
3504 \expandafter\def\csname svn@ignoregraphic@#1\endcsname{}%
3505 }
3506 % \end{macrocode}
3507 % \end{macro}
3508
3509 % \begin{macro}{\svnconsidergraphic}[1]{file name/path}
3510 % Deletes the special ignore macro to consider the graphic again.
3511 % \begin{macrocode}
3512 \def\svnconsidergraphic#1{%
3513 \expandafter\let\csname svn@ignoregraphic@#1\endcsname\relax%
3514 }
3515 % \end{macrocode}
3516 % \end{macro}
3517
3518 % \begin{macrocode}
3519 \fi
3520 % \end{macrocode}
3521
3522 % \subsubsection{Package \texttt{graphics}}
3523 % Automatic declaration of all images included by |\includegraphics| from the
3524 % \pkg{graphics} package as external files. We use the |\Gin@setfile| macro from
3525 % that package which receives the image file name as third argument.
3526 % \begin{macrocode}
3527 \if@svnmulti@graphics
3528 \RequirePackage{graphics}[2006/02/20]
3529 % \end{macrocode}
3530
3531 % \begin{macro}{\Gin@setfile}[3]{??, not used}{??, not used}{graphic file
3532 % name/path}
3533 % \begin{macrocode}
3534 \message{Package svn-multi: patching macro '\string\Gin@setfile' from the
3535 'graphics' package!}%
3536 \let\svnmulti@Gin@setfile\Gin@setfile
3537 \renewcommand*{\Gin@setfile}[3]{%
3538 \expandafter\ifx\csname svn@ignoregraphic@#3\endcsname\relax%
3539 \svnexternal[\svn@graphicsgroup]{{#3}}%
3540 \fi
3541 \svnmulti@Gin@setfile{#1}{#2}{#3}%
3542 }
3543 % \end{macrocode}
3544 % \end{macro}
3545
3546 % \begin{macrocode}
3547 \fi
3548 % \end{macrocode}
3549
3550 % \subsubsection{Package \texttt{pgf}}
3551 % The \pkg{pgf} macro |\pgf@declareimage| which is called by the user macro
3552 % |\pgfdeclareimage| is used.
3553 % \begin{macrocode}
3554 \if@svnmulti@pgfimages
3555 \RequirePackage{pgf}[2008/01/15]
3556 % \end{macrocode}
3557
3558 % \begin{macro}{\pgf@declareimage}[3]{??, not used}{image label}{??, not used}
3559 % \begin{macrocode}
3560 \message{Package svn-multi: patching macro '\string\pgf@declareimage' and will
3561 patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}%
3562 \let\svnmulti@pgf@declareimage\pgf@declareimage
3563 \renewcommand*{\pgf@declareimage}[3][]{%
3564 \svnmulti@pgf@declareimage[#1]{#2}{#3}%
3565 % \end{macrocode}
3566 % At this point the used image filename is defined by |\pgf@filename| and the
3567 % image itself is defined by |\pgf@image@#2!| which is a |\let| copy of
3568 % temporary |\pgf@image|. An own copy of this is created and the old name
3569 % |\pgf@image@#2!| is used to execute \cs{svnexternal} every time the image is
3570 % included using |\pgfuseimage|.
3571 % \begin{macrocode}
3572 \ifx\pgf@filename\empty\else
3573 \expandafter\ifx\csname svn@ignoregraphic@\pgf@filename\endcsname\relax%
3574 \expandafter\global\expandafter%
3575 \let\csname svnmulti@pgf@image@#2!\endcsname=\pgf@image%
3576 \expandafter\xdef\csname pgf@image@#2!\endcsname{%
3577 \noexpand\svnexternal[\noexpand\svn@graphicsgroup]{{\pgf@filename}}%
3578 \csname svnmulti@pgf@image@#2!\endcsname
3579 }%
3580 \fi
3581 \fi
3582 }
3583 % \end{macrocode}
3584 % \end{macro}
3585 % \begin{macrocode}
3586 \fi
3587 % \end{macrocode}
3588 %
3589 % \subsection{Table of Revisions}
3590 %
3591 % \begin{macrocode}
3592 \if@svnmulti@table
3593 \ifx\tableofcontents\relax\else
3594 % \end{macrocode}
3595 %
3596 % \begin{macro}{\svnrevisionsname}
3597 % Simple definition for now. Language support over `babel's |\languagename|
3598 % possible.
3599 % \begin{macrocode}
3600 \def\svnrevisionsname{Table of Revisions}%
3601 % \end{macrocode}
3602 % \end{macro}
3603 %
3604 % \begin{macro}{\svn@svt}
3605 % File ending for table of revision auxiliary file. A macro is used to allow
3606 % redefinition by the user if another package is uses the same ending.
3607 % \begin{macrocode}
3608 \def\svn@svt{svt}
3609 % \end{macrocode}
3610 % \end{macro}
3611 %
3612
3613 % \begin{macro}{\tableofrevisions}
3614 % The |\tableofcontents| macro from standard \LaTeX\ is adapted for this macro.
3615 % Classes which provide chapters will get a different table then one which not.
3616 %
3617 % The external (\ie non-svn-multi) if-switches are masked using |\ifx| and
3618 % |\csname| to avoid \TeX{} if-parsing errors when they are not defined.
3619 % \begin{macrocode}
3620 \AtBeginDocument{%
3621 \ifx\chapter\relax
3622 \let\chapter\@undefined
3623 \fi
3624 \ifx\chapter\@undefined
3625
3626 %% Adapted from the \tableofcontents macro, LaTeX `article' class [2005/09/16]
3627 \newcommand\tableofrevisions{%
3628 \section*{\svnrevisionsname
3629 \@mkboth{\MakeUppercase\svnrevisionsname}{\MakeUppercase\svnrevisionsname}}%
3630 \svn@input{\jobname .\svn@svt}%
3631 }
3632
3633 \else
3634
3635 %% Adapted from the \tableofcontents macro, LaTeX `book' class [2005/09/16]
3636 \newcommand\tableofrevisions{%
3637 \expandafter\ifx
3638 \csname if@twocolumn\expandafter\endcsname
3639 \csname iftrue\endcsname
3640 \@restonecoltrue\onecolumn
3641 \else
3642 \@restonecolfalse
3643 \fi
3644 \chapter*{\svnrevisionsname
3645 \@mkboth{\MakeUppercase\svnrevisionsname}{\MakeUppercase\svnrevisionsname}}%
3646 \svn@input{\jobname .\svn@svt}%
3647 \expandafter\ifx
3648 \csname if@restonecol\expandafter\endcsname
3649 \csname iftrue\endcsname
3650 \twocolumn
3651 \fi
3652 }
3653
3654 \fi
3655 }
3656 % \end{macrocode}
3657 % \end{macro}
3658 %
3659 % \begin{macrocode}
3660 \fi % defined \tableofcontents
3661 % \end{macrocode}
3662
3663 % \begin{macro}{\svn@writerow}[3]{row type ('group', 'file', 'global', \ldots)}
3664 % {row type specific argument}{row type specific argument}
3665 % Writes a table row by using |\svn@tabcell| and |\svn@tabcellarg| defined by
3666 % the |\svn@writeXXXrow| macro below.
3667 % \begin{macrocode}
3668 \def\svn@writerow#1#2#3{%
3669 \immediate\write\svn@svtwrite{%
3670 \expandafter\noexpand\csname svn#1row\endcsname
3671 \expandafter\noexpand\csname svntab#1\endcsname{#2}{#3}\space
3672 \@ampersamchar\space
3673 \svn@tabcell{rev}\space\@ampersamchar\space
3674 \svn@tabcell{author}\space\@ampersamchar\space
3675 \noexpand\svntabdate%
3676 \svn@tabcellarg{year}%
3677 \svn@tabcellarg{month}%
3678 \svn@tabcellarg{day}%
3679 \svn@tabcellarg{hour}%
3680 \svn@tabcellarg{minute}%
3681 \svn@tabcellarg{second}%
3682 \svn@tabcellarg{timezonehour}%
3683 \svn@tabcellarg{timezoneminute}%
3684 \space\@backslashchar\@backslashchar
3685 \expandafter\noexpand\csname endsvn#1row\endcsname
3686 }%
3687 }
3688 % \end{macrocode}
3689 % \end{macro}
3690
3691 % \begin{macro}{\svn@writegrouprow}[1]{current group}
3692 % \begin{macrocode}
3693 \def\svn@writegrouprow#1{%
3694 \begingroup
3695 \def\svn@tabcellarg##1{{\csname @svng@#1@##1\endcsname}}%
3696 \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
3697 \svn@tabcellarg{##1}%
3698 }%
3699 \svn@writerow{group}{#1}{}%
3700 \endgroup
3701 }
3702 % \end{macrocode}
3703 % \end{macro}
3704
3705 % \begin{macro}{\svn@writesubgrouprow}[2]{grouping level}{subgroup name}
3706 % \begin{macrocode}
3707 \def\svn@writesubgrouprow#1#2{%
3708 \begingroup
3709 \def\svn@tabcellarg##1{{\csname @svng@#2@##1\endcsname}}%
3710 \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
3711 \svn@tabcellarg{##1}%
3712 }%
3713 \svn@writerow{subgroup}{#1}{#2}%
3714 \endgroup
3715 }
3716 % \end{macrocode}
3717 % \end{macro}
3718
3719 % \begin{macro}{\svn@writefilerow}[2]{grouping level}{file name}
3720 % \begin{macrocode}
3721 \def\svn@writefilerow#1#2{%
3722 \begingroup
3723 \def\svn@tabcellarg##1{{\csname @svng@#2@##1\endcsname}}%
3724 \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
3725 \svn@tabcellarg{##1}%
3726 }%
3727 \svn@writerow{file}{#1}{#2}%
3728 \endgroup
3729 }
3730 % \end{macrocode}
3731 % \end{macro}
3732
3733 % \begin{macro}{\svn@writeglobalrow}
3734 % \begin{macrocode}
3735 \def\svn@writeglobalrow{%
3736 \begingroup
3737 \def\svn@tabcellarg##1{{\csname @svn@##1\endcsname}}%
3738 \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
3739 \svn@tabcellarg{##1}%
3740 }%
3741 \svn@writerow{global}{}{}%
3742 \endgroup
3743 }
3744 % \end{macrocode}
3745 % \end{macro}
3746
3747 % \subsubsection{Table Format Macros}\label{sec:impl:table}
3748 % Generic format macro used in the |.svt| file. Can be redefined by the user to
3749 % change table format. % TODO: More documentation needed!
3750 %
3751 % \begin{macro}{\svntable}
3752 % \begin{macrocode}
3753 \def\svntable{%
3754 \begin{tabular}{p{0.425\textwidth}rll}%
3755 \hline
3756 }
3757 % \end{macrocode}
3758 % \end{macro}
3759 % \begin{macro}{\endsvntable}
3760 % \begin{macrocode}
3761 \def\endsvntable{\hline\end{tabular}}
3762 % \end{macrocode}
3763 % \end{macro}
3764
3765 % \begin{macro}{\svntablehead}
3766 % \begin{macrocode}
3767 \def\svntablehead{%
3768 Name & Rev & Last Author & Last Changed At \\\hline
3769 }
3770 % \end{macrocode}
3771 % \end{macro}
3772 % \begin{macro}{\svntablefoot}
3773 % \begin{macrocode}
3774 \def\svntablefoot{}
3775 % \end{macrocode}
3776 % \end{macro}
3777
3778 % \begin{macro}{\svnbeforetable}
3779 % \begin{macrocode}
3780 \def\svnbeforetable{}
3781 % \end{macrocode}
3782 % \end{macro}
3783 % \begin{macro}{\svnaftertable}
3784 % \begin{macrocode}
3785 \def\svnaftertable{\clearpage}
3786 % \end{macrocode}
3787 % \end{macro}
3788
3789 % \begin{macro}{\svnglobalrow}
3790 % \begin{macrocode}
3791 \def\svnglobalrow{}
3792 % \end{macrocode}
3793 % \end{macro}
3794 % \begin{macro}{\endsvnglobalrow}
3795 % \begin{macrocode}
3796 \def\endsvnglobalrow{}
3797 % \end{macrocode}
3798 % \end{macro}
3799 % \begin{macro}{\svngrouprow}
3800 % \begin{macrocode}
3801 \def\svngrouprow{}
3802 % \end{macrocode}
3803 % \end{macro}
3804 % \begin{macro}{\endsvngrouprow}
3805 % \begin{macrocode}
3806 \def\endsvngrouprow{}
3807 % \end{macrocode}
3808 % \end{macro}
3809 % \begin{macro}{\svnsubgrouprow}
3810 % \begin{macrocode}
3811 \def\svnsubgrouprow{}
3812 % \end{macrocode}
3813 % \end{macro}
3814 % \begin{macro}{\endsvnsubgrouprow}
3815 % \begin{macrocode}
3816 \def\endsvnsubgrouprow{}
3817 % \end{macrocode}
3818 % \end{macro}
3819 % \begin{macro}{\svnsubgrouprow}
3820 % \begin{macrocode}
3821 \def\svnfilerow{}
3822 % \end{macrocode}
3823 % \end{macro}
3824 % \begin{macro}{\endsvnfilerow}
3825 % \begin{macrocode}
3826 \def\endsvnfilerow{}
3827 % \end{macrocode}
3828 % \end{macro}
3829
3830 % \begin{macro}{\svntabglobal}
3831 % \begin{macrocode}
3832 \def\svntabglobal{Document}
3833 % \end{macrocode}
3834 % \end{macro}
3835 % \begin{macro}{\svntabgroup}
3836 % \begin{macrocode}
3837 \def\svntabgroup#1{Group `#1'}
3838 % \end{macrocode}
3839 % \end{macro}
3840
3841 % \begin{macro}{\svntabfile}
3842 % \begin{macrocode}
3843 \def\svntabsubgroup#1{%
3844 \raggedright
3845 \addtolength{\leftskip}{#1\medskipamount}%
3846 \begingroup
3847 \catcode`\_=12
3848 \catcode`\&=12
3849 \catcode`\^=12
3850 \catcode`\$=12
3851 \catcode`\#=12
3852 \svn@tabsubgroup
3853 }
3854 \def\svn@tabsubgroup#1{\endgroup Subgroup `\texttt{\small #1}'}
3855 % \end{macrocode}
3856 % \end{macro}
3857
3858 % \begin{macro}{\svntabfile}
3859 % \begin{macrocode}
3860 \def\svntabfile#1{%
3861 \raggedright
3862 \addtolength{\leftskip}{#1\medskipamount}%
3863 \begingroup
3864 \catcode`\_=12
3865 \catcode`\&=12
3866 \catcode`\^=12
3867 \catcode`\$=12
3868 \catcode`\#=12
3869 \svn@tabfile
3870 }
3871 \def\svn@tabfile#1{\endgroup File `\texttt{\small #1}'}
3872 % \end{macrocode}
3873 % \end{macro}
3874
3875 % \begin{macro}{\svntabrev}
3876 % \begin{macrocode}
3877 \def\svntabrev{}
3878 % \end{macrocode}
3879 % \end{macro}
3880 % \begin{macro}{\svntabauthor}
3881 % \begin{macrocode}
3882 \def\svntabauthor#1{\svnFullAuthor{#1}}
3883 % \end{macrocode}
3884 % \end{macro}
3885 % \begin{macro}{\svntabdate}
3886 % \begin{macrocode}
3887 \def\svntabdate#1#2#3#4#5#6#7#8{%
3888 #1-#2-#3 #4:#5:#6% #7#8%
3889 }
3890 % \end{macrocode}
3891 % \end{macro}
3892
3893 % \begin{macrocode}
3894 \fi
3895 % \end{macrocode}
3896 %
3897
3898 % \subsection{Other macros}
3899 % This section contains macros which don't fit in any other section.
3900 %
3901 % \begin{macro}{\svn}
3902 % \begin{macro}{\svn*}
3903 % After *-testing, the intermediate macros |\svn@s| and |\svn@n| are called to
3904 % strip the |{ }| from |\svn|[|*|]|{$...$}| and to remove the |*|. Then the
3905 % actual macros are called to strip the dollars with or without the space
3906 % before the last dollar.
3907 % \changes{v1.2}{2007/06/22}{Added star version. Normal version was not
3908 % changed to not break existing documents with user defined keywords without
3909 % leading space.}
3910 % \begin{macrocode}
3911 \newcommand{\svn}{\@ifnextchar{*}{\svn@s}{\svn@n}}
3912 \def\svn@n#1{\@svn@n#1}
3913 \def\svn@s*#1{\@svn@s#1}
3914 \def\@svn@n$#1${#1}
3915 \def\@svn@s$#1 ${#1}
3916 % \end{macrocode}
3917 % \end{macro}
3918 % \end{macro}
3919
3920 % \begin{macro}{\svnnolinkurl}[1]{URL}
3921 % This code is taken from the \pkg{hyperref} package and is the definition of
3922 % |\url| just without the part which creates the actual hyperlink. This needs
3923 % of course the \pkg{hyperref} package. A warning is given if it isn't loaded.
3924 % \changes{v1.2}{2007/06/22}{New macro}
3925 % \begin{macrocode}
3926 %% Adapted from the \url macro of the `hyperref` package.
3927 \DeclareRobustCommand*{\svnnolinkurl}{%
3928 \@ifundefined{hyper@normalise}%
3929 {\PackageWarning{svn-multi}{Package hyperref is needed for \noexpand
3930 \svnnolinkurl.}}%
3931 {\hyper@normalise\svnnolinkurl@}%
3932 }%
3933 \def\svnnolinkurl@#1{\Hurl{#1}}%
3934 % \end{macrocode}
3935 % \end{macro}
3936
3937 % \begin{macro}{\svn@getfilename}[1]{URL}
3938 % This macro expands the content using the temporary macro and sets it in front
3939 % of the \csi{svn@getfilename} sub-macro together with |/{}| to make sure the
3940 % macro does not break at values without directories. A |\relax| is used as
3941 % end marker.
3942 % \begin{macrocode}
3943 \def\svn@getfilename#1{%
3944 \begingroup
3945 \gdef\svnfiledir{}%
3946 \edef\svn@temp{#1}%
3947 \expandafter\@svn@getfilename\svn@temp/{}\relax
3948 }%
3949 % \end{macrocode}
3950 % \end{macro}
3951
3952 % \begin{macro}{\@svn@getfilename}[2]{URL part before first slash}{URL part after
3953 % first slash}
3954 % Splits the content at the first slash (|/|) and checks if the remainder is
3955 % empty. If so the end marker got reached and the part before the slash is the
3956 % filename which is returned. Otherwise the macro recursively calls itself to
3957 % split the remainder.
3958 % \begin{macrocode}
3959 \def\@svn@getfilename#1/#2\relax{%
3960 \svn@ifempty{#2}%
3961 {%
3962 \endgroup
3963 \gdef\svnfilefname{#1}%
3964 }%
3965 {%
3966 \xdef\svnfiledir{\svnfiledir#1/}%
3967 \@svn@getfilename#2\relax
3968 }%
3969 }%
3970 % \end{macrocode}
3971 % \end{macro}
3972
3973 % \subsection{Write to Auxiliary File}
3974
3975 % \begin{macro}{\svn@write}
3976 % Simply an alias for the main aux file write handle.
3977 % \begin{macrocode}
3978 \let\svn@write\@mainaux
3979 % \end{macrocode}
3980 % \end{macro}
3981 %
3982 % \begin{macro}{\svn@writesvn}
3983 % This macro writes the |.aux| auxiliary file and is called from a
3984 % |\AtEndDocument| macro later on.
3985 % \begin{macrocode}
3986 {\catcode`\&=12
3987 \gdef\@ampersamchar{&}
3988 }
3989 \def\svn@writesvn{%
3990 % \end{macrocode}
3991 % Remove all files which do not have a revision number from list:
3992 % \begin{macrocode}
3993 \if@svnmulti@groups
3994 \fi
3995 % \end{macrocode}
3996 % Write document global values:
3997 % \begin{macrocode}
3998 \immediate\write\svn@write{^^J%
3999 \@percentchar\space Global values:^^J%
4000 \noexpand\gdef\noexpand\svnrev{\@svn@rev}^^J%
4001 \noexpand\global\noexpand\let\noexpand\ifsvnmodified\@backslashchar\@svn@modified^^J%
4002 \noexpand\gdef\noexpand\svndate{\@svn@date}^^J%
4003 \noexpand\gdef\noexpand\svnauthor{\@svn@author}^^J%
4004 \noexpand\gdef\noexpand\svnyear{\@svn@year}^^J%
4005 \noexpand\gdef\noexpand\svnmonth{\@svn@month}^^J%
4006 \noexpand\gdef\noexpand\svnday{\@svn@day}^^J%
4007 \noexpand\gdef\noexpand\svnhour{\@svn@hour}^^J%
4008 \noexpand\gdef\noexpand\svnminute{\@svn@minute}^^J%
4009 \noexpand\gdef\noexpand\svnsecond{\@svn@second}^^J%
4010 \noexpand\gdef\noexpand\svntimezonehour{\@svn@timezonehour}^^J%
4011 \noexpand\gdef\noexpand\svntimezoneminute{\@svn@timezoneminute}^^J%
4012 \noexpand\svn@gdefverb\noexpand\svnurl{\@svn@url}^^J%
4013 \noexpand\svn@gdefverb\noexpand\svnfname{\@svn@fname}^^J%
4014 }%
4015 % \end{macrocode}
4016 % Write group keyword macro definitions.
4017 % Remove all files which do not have a revision number from list:
4018 % \begin{macrocode}
4019 \if@svnmulti@groups
4020 \svn@cleanfilelist\@svng@@files
4021 \immediate\write\svn@write{%
4022 \noexpand\gdef\noexpand\svng@@files{\@svng@@files}^^J%
4023 }%
4024 \svn@writeallgroups\@svng@@files
4025 % \end{macrocode}
4026 % Write keyword group values if groups were specified:
4027 % \begin{macrocode}
4028 \ifx\svn@glist\empty\else
4029 \begingroup
4030 \immediate\write\svn@write{^^J%
4031 \@percentchar\space SVN File Groups: \svn@glist
4032 }%
4033 \svn@writeallgroups\svn@glist
4034 \endgroup
4035 \fi
4036 \else
4037 \immediate\write\svn@write{^^J}%
4038 \fi
4039 }
4040 % \end{macrocode}
4041 % \end{macro}
4042
4043
4044 % \begin{macro}{\svn@writegroupfiles}[1]{group name}
4045 % Writes all files of a group to the |.svt| file. If the file is actually a
4046 % subgroup it calls itself recursively.
4047 % \begin{macrocode}
4048 \def\svn@writegroupfiles#1{%
4049 \begingroup
4050 \advance\svn@grouplevel by 1\relax
4051 \expandafter\let
4052 \expandafter\svn@files\csname @svng@#1@files\endcsname
4053 % \end{macrocode}
4054 % Stop if no files in list.
4055 % \begin{macrocode}
4056 \ifx\svn@files\relax\else
4057 \svn@cleanfilelist\svn@files
4058 \@for\svn@file:=\svn@files\do{%
4059 % \end{macrocode}
4060 % Check if VC data is set and then if it is a (sub)group or not by looking at
4061 % the file list.
4062 % \begin{macrocode}
4063 \svn@ifvalidrev{@svng@\svn@file @rev}%
4064 {%
4065 \@ifundefined{@svng@\svn@file @files}%
4066 {\svn@writefilerow{\the\svn@grouplevel}{\svn@file}}%
4067 % \end{macrocode}
4068 % If subgroup only contains out of a TeX file with the same name print it as
4069 % file and only as subgroup otherwise. If the subgroup file list is empty the
4070 % subgroup was generated in error and is not printed at all.
4071 % \begin{macrocode}
4072 {\svn@ifonlyone{\svn@file}%
4073 {\svn@writefilerow{\the\svn@grouplevel}%
4074 {\csname @svng@\svn@file @files\endcsname}}%
4075 {\svn@ifempty{\csname @svng@\svn@file @files\endcsname}%
4076 {}%
4077 {%
4078 \svn@writesubgrouprow{\the\svn@grouplevel}{\svn@file}%
4079 \svn@writegroupfiles{\svn@file}%
4080 }%
4081 }%
4082 }%
4083 }{}%
4084 }%
4085 \fi
4086 \endgroup
4087 }%
4088 % \end{macrocode}
4089 % \end{macro}
4090
4091 % \begin{macro}{\svn@writesvt}
4092 % This macro writes the |.svt| auxiliary file and is called from a
4093 % |\AtEndDocument| macro later on.
4094 % \begin{macrocode}
4095 \def\svn@writesvt{%
4096 % \end{macrocode}
4097 % Write table of revisions if enabled.
4098 % \begin{macrocode}
4099 \if@svnmulti@table
4100 % \end{macrocode}
4101 % Open |.svt| file and write table header:
4102 % \begin{macrocode}
4103 \newwrite\svn@svtwrite
4104 \immediate\openout\svn@svtwrite=\jobname.\svn@svt\relax
4105 \@onelevel@sanitize\svntable%
4106 \immediate\write\svn@svtwrite{%
4107 \noexpand\svnbeforetable^^J%
4108 \svntable
4109 \noexpand\svntablehead^^J%
4110 }%
4111 % \end{macrocode}
4112 % Group rows:
4113 % \begin{macrocode}
4114 \let\svn@grouplevel\@tempcnta
4115 \svn@grouplevel=0\relax
4116 \svn@writeglobalrow{}%
4117 \svn@writegroupfiles{}%
4118 %
4119 \@for\svn@g:=\svn@glist\do{%
4120 \@ifundefined{@svng@\svn@g @rev}{}%
4121 {%
4122 \expandafter
4123 \ifnum\csname @svng@\svn@g @rev\endcsname>0\relax
4124 \svn@writegrouprow{\svn@g}%
4125 \svn@writegroupfiles{\svn@g}%
4126 \fi
4127 }%
4128 }%
4129
4130 % \end{macrocode}
4131 % Write table footer and close file:
4132 % \begin{macrocode}
4133 \@onelevel@sanitize\endsvntable%
4134 \immediate\write\svn@svtwrite{%
4135 \noexpand\svntablefoot^^J%
4136 \endsvntable^^J%
4137 \noexpand\svnaftertable
4138 }%
4139 \immediate\closeout\svn@svtwrite%
4140 \fi
4141 }
4142 % \end{macrocode}
4143 % \end{macro}
4144
4145 % Load the keywords of every subfile if the \opt{autokw} option is enabled and
4146 % the extension is not on the ignore list.
4147 %
4148 % This code is placed here because it has to come after the at-begin-input-file
4149 % code.
4150 % \begin{macrocode}
4151 \if@svnmulti@autokwall
4152
4153 \AtBeginOfFiles{%
4154 \expandafter
4155 \ifx\csname svn@ignore@ext@\currfileext\endcsname\relax
4156 \svnegetfile{\currfilepath}%
4157 \fi
4158 }
4159
4160 \fi
4161 % \end{macrocode}
4162
4163 % At the end of document the values are written to the auxiliary file.
4164 % \begin{macrocode}
4165 \AtEndDocument{%
4166 \if@filesw
4167 \ifx\@svn@rev\empty\else
4168 \ifnum\@svn@rev<1\else
4169 \begingroup
4170 \let\protect\@unexpandable@protect
4171 \svn@writesvn
4172 \svn@writesvt
4173 \endgroup
4174 \fi
4175 \fi
4176 \fi
4177 }
4178 % \end{macrocode}
4179 %
4180 % \iffalse
4181 %</svn-multi.sty>
4182 % \fi
4183 %
4184 % \iffalse
4185 %<*svnkw.sty>
4186 % \fi
4187 % \subsection{Backward compatibility wrapper \texttt{svnkw.sty}}
4188 % For backward compatibility a wrapper file with the old package name |svnkw| is
4189 % provided. Newer documents should use the name \svnmulti.
4190 % \begin{macrocode}
4191 %<!COPYRIGHT>
4192 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
4193 \ProvidesPackage{svnkw}
4194 [2009/03/27 v2.1 Backward compatibility wrapper for svn-multi]
4195 \PackageWarning{svnkw}{The package 'svnkw' got renamed to 'svn-multi' and is now
4196 only a backward compatibility wrapper which loads 'svn-multi'. Please adjust
4197 your document preamble to use the new name.}
4198 \RequirePackage{svn-multi}
4199 % \end{macrocode}
4200 % \iffalse
4201 %</svnkw.sty>
4202 % \fi
4203 %
4204 % \Finale
4205 \endinput