| 1 |
% \iffalse meta-comment |
| 2 |
% Copyright (C) 2009 by Martin Scharrer <[email protected]> |
| 3 |
% http://www.scharrer-online.de/latex/ |
| 4 |
% ----------------------------------------------------------------- |
| 5 |
% |
| 6 |
% This work may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 8 |
% of this license or (at your option) any later version. |
| 9 |
% The latest version of this license is in |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 12 |
% version 2005/12/01 or later. |
| 13 |
% |
| 14 |
% This work has the LPPL maintenance status `maintained'. |
| 15 |
% |
| 16 |
% The Current Maintainer of this work is Martin Scharrer. |
| 17 |
% |
| 18 |
% This work consists of the file rcs-multi.dtx and the derived file |
| 19 |
% rcs-multi.sty. |
| 20 |
% $Id: rcs-multi.dtx 2436 2011-04-02 19:11:17Z martin $ |
| 21 |
% \fi |
| 22 |
% \iffalse |
| 23 |
%<*package|driver|wrapper> |
| 24 |
\def\filedate$#1: #2 #3 #4-#5-#6 #7 ${% |
| 25 |
\def\filedate{#4/#5/#6}% |
| 26 |
\def\filerev{#3}% |
| 27 |
} |
| 28 |
\filedate$Id: rcs-multi.dtx 2436 2011-04-02 19:11:17Z martin $ |
| 29 |
\def\fileversion{v0.1a} |
| 30 |
%</package|driver|wrapper> |
| 31 |
%<*driver> |
| 32 |
\ProvidesFile{rcs-multi.dtx} |
| 33 |
[\filedate\space\fileversion\space RCS Keywords for multi-file LaTeX documents] |
| 34 |
|
| 35 |
\documentclass{ydoc} |
| 36 |
\usepackage{rcs-multi} |
| 37 |
\usepackage{xspace} |
| 38 |
\newcommand{\ie}{i.e.\@\xspace} |
| 39 |
\newcommand{\eg}{e.g.\@\xspace} |
| 40 |
|
| 41 |
\def\karg#1{\texttt{\$#1\$}} |
| 42 |
\def\kmarg#1{\texttt{\$}\meta{#1}\texttt{\$}} |
| 43 |
\def\rcsmulti{\pkg{rcsmulti}\xspace} |
| 44 |
|
| 45 |
\let\csi\cs |
| 46 |
\def\cs#1{\Macro{#1}\relax} |
| 47 |
|
| 48 |
\usepackage{graphicx} |
| 49 |
|
| 50 |
\EnableCrossrefs |
| 51 |
%\DisableCrossrefs |
| 52 |
\CodelineIndex |
| 53 |
%\PageIndex |
| 54 |
\RecordChanges |
| 55 |
%\OnlyDescription |
| 56 |
\begin{document} |
| 57 |
\DocInput{rcs-multi.dtx}% |
| 58 |
\PrintChanges |
| 59 |
%\clearpage |
| 60 |
\PrintIndex |
| 61 |
\end{document} |
| 62 |
%</driver> |
| 63 |
%<*package> |
| 64 |
% \fi |
| 65 |
% |
| 66 |
% \CheckSum{616} |
| 67 |
% |
| 68 |
% {\makeatother |
| 69 |
% \CharacterTable |
| 70 |
% {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 |
| 71 |
% 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 |
| 72 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 73 |
% Exclamation \! Double quote \" Hash (number) \# |
| 74 |
% Dollar \$ Percent \% Ampersand \& |
| 75 |
% Acute accent \' Left paren \( Right paren \) |
| 76 |
% Asterisk \* Plus \+ Comma \, |
| 77 |
% Minus \- Point \. Solidus \/ |
| 78 |
% Colon \: Semicolon \; Less than \< |
| 79 |
% Equals \= Greater than \> Question mark \? |
| 80 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 81 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 82 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 83 |
% Right brace \} Tilde \~} |
| 84 |
% } |
| 85 |
% \changes{v0.1}{2009/03/23}{Initial version forked from rcs-multi v2.0} |
| 86 |
% |
| 87 |
% ^^A \GetFileInfo{rcs-multi.dtx} |
| 88 |
% |
| 89 |
% \DoNotIndex{\newcommand,\newenvironment,\AtBeginDocument,\AtEndDocument} |
| 90 |
% \DoNotIndex{\def,\let,\edef,\xdef,\item,\space,\write,\jobname,\relax,\!} |
| 91 |
% \DoNotIndex{\closeout,\csname,\DeclareRobustCommand,\else,\empty,\newwrite} |
| 92 |
% \DoNotIndex{\endcsname,\expandafter,\fi,\Hurl,\hyper@normalise,\@ifnextchar} |
| 93 |
% \DoNotIndex{\ifnum,\@ifundefined,\ifx,\immediate,\InputIfFileExists,\ } |
| 94 |
% \DoNotIndex{\newcount,\noexpand,\openout,\PackageWarning,\@percentchar} |
| 95 |
% \DoNotIndex{\@sanitize,\@makeother,\@iwrcs,\%,\_,\&,\^,\$,\#,\ ,\\,\if@filesw} |
| 96 |
% \DoNotIndex{\gdef,\begingroup,\endgroup,\catcode} |
| 97 |
% \DoNotIndex{\^,\ ,\_,\(,\),\$,\&,\#,\@ampersamchar,\AtEndOfPackage} |
| 98 |
% \DoNotIndex{\@backslashchar,\begin,\bgroup,\chapter,\day} |
| 99 |
% \DoNotIndex{\DeclareOption,\do,\dospecials,\@dottedtocline,\egroup} |
| 100 |
% \DoNotIndex{\end,\ExecuteOptions,\filedate,\fileversion,\@for} |
| 101 |
% \DoNotIndex{\futurelet,\g@addto@macro,\global,\@gobbletwo,\hline} |
| 102 |
% \DoNotIndex{\hspace,\if@restonecol,\if@twocolumn,\ignorespaces} |
| 103 |
% \DoNotIndex{\makeatletter,\MakeUppercase,\@mkboth,\month,\@namedef} |
| 104 |
% \DoNotIndex{\NeedsTeXFormat,\newif,\onecolumn,\orig@fink@prepare} |
| 105 |
% \DoNotIndex{\orig@fink@restore,\PackageError,\ProcessOptions} |
| 106 |
% \DoNotIndex{\ProvidesPackage,\renewcommand,\RequirePackage} |
| 107 |
% \DoNotIndex{\@restonecolfalse,\@restonecoltrue,\section,\strut} |
| 108 |
% \DoNotIndex{\tableofcontents,\tableofrevisions,\texttt,\today} |
| 109 |
% \DoNotIndex{\twocolumn,\@undefined,\url,\year} |
| 110 |
% \DoNotIndex{\textwidth,\the,\string,\raggedright,\providecommand,\small,\toks@} |
| 111 |
% \DoNotIndex{\medskipamount,\long,\leftskip,\clearpage,\advance,\addtolength} |
| 112 |
% \DoNotIndex{\DeclareBoolOption,\DeclareStringOption,\DeclareVoidOption} |
| 113 |
% \DoNotIndex{\ProcessKeyvalOptions,\SetupKeyvalOptions} |
| 114 |
% \DoNotIndex{\@firstoftwo,\@secondoftwo,\@gobble} |
| 115 |
% |
| 116 |
% \author{Martin Scharrer} |
| 117 |
% \email{[email protected]} |
| 118 |
% \maketitle |
| 119 |
% |
| 120 |
% \section{Introduction} |
| 121 |
% This package allows to typeset version control (VC) information provided by |
| 122 |
% RCS\footnote{RCS homepage: \url{http://www.gnu.org/software/rcs/}} keywords |
| 123 |
% (\eg |$||Id: ... $|) in \LaTeX\ documents which can contain of multiple |.tex| |
| 124 |
% files included using |\include| or |\input|. It is based on the |
| 125 |
% \pkg{svn-multi} which macros have been renamed and modified to support RCS. |
| 126 |
% |
| 127 |
% This package reads the keywords of all files and provides the VC information |
| 128 |
% of of the most recent changed file of the document to the user through a set |
| 129 |
% of macros. This information is written to the auxiliary |.aux| file during the |
| 130 |
% first \LaTeX\ run and read back at the next which introduces the same delay |
| 131 |
% known from the table of contents. The standard \LaTeX{} switch |\nofiles| can |
| 132 |
% be used to suppress the file generation. |
| 133 |
% |
| 134 |
% \subsection{Scope of Keywords} |
| 135 |
% This package provides the RCS keyword data in two different scopes: |
| 136 |
% document-global and file-local. |
| 137 |
% |
| 138 |
% \subsubsection*{Document Global} |
| 139 |
% The document global macros, like \cs{rcsrev}, return the latest version |
| 140 |
% control information (keyword data) for the whole multi-file document, \ie the |
| 141 |
% information of the latest changed file of the document. To collect, sort and |
| 142 |
% provide this information is the main functionality of this package. |
| 143 |
% |
| 144 |
% \subsubsection*{Local to Current File} |
| 145 |
% There are also file-local macros, \eg \cs{rcsfilerev}, which return the |
| 146 |
% version control information of the current file, \ie the file they are used |
| 147 |
% in. It is assumed here that every file using this macros calls first the macro |
| 148 |
% \cs{rcsid}. See section~\ref{sec:usage:id} for more details about this macro. |
| 149 |
% Please note that the file-local macros technically actually return the |
| 150 |
% \emph{last registered} information from the last \cs{rcsid}. |
| 151 |
% |
| 152 |
% |
| 153 |
% \section{Usage} |
| 154 |
% The version control information are provided by RCS keywords which |
| 155 |
% first need to be read in by dedicated macros and can then be typeset using |
| 156 |
% different macros. |
| 157 |
% |
| 158 |
% \subsection{Including RCS Keywords}\label{sec:usage:id} |
| 159 |
% RCS keywords are included using \cs{rcsid}. This macro should be written very |
| 160 |
% early in each file, \ie in the preamble of the main document soon after |
| 161 |
% |\documentclass| and |\usepackage{rcs-multi}| and as first in \emph{every} |
| 162 |
% subfile before an |\chapter| or similar macro. It does not create any output. |
| 163 |
% See section~\ref{sec:kwaccess} to learn how to typeset the keyword values. |
| 164 |
% |
| 165 |
% \DescribeMacro{rcsid}{\karg{Id}} |
| 166 |
% \DescribeMacro{rcsid}{\karg{Header}} |
| 167 |
% The macro is for the |Id| keyword and must be written like shown. A trailing |
| 168 |
% colon with or without spaces after the keyword name (`|Id|') is also valid but |
| 169 |
% \textbf{everything else} except a valid RCS string will cause a \TeX{} parse |
| 170 |
% error. The difference between |Id| and |Header| is that the latter includes |
| 171 |
% the full URL/path and not only the filename. |
| 172 |
% |
| 173 |
% \DescribeMacro{rcs}{\kmarg{keyword}} |
| 174 |
% This macro let you typeset rcs keywords directly. The dollars will be stripped |
| 175 |
% and the rest is typeset as normal text. |
| 176 |
% |
| 177 |
% \DescribeMacro{rcskwsave}{\kmarg{keyword}} |
| 178 |
% This macro lets you include and save any keyword you like. The keyword can be |
| 179 |
% already expanded or not (no value and only ``|:|'' or nothing after the key |
| 180 |
% name). This macro is also used internally and does not create any output. |
| 181 |
% Please note that the argument is read verbatim and that there should be no |
| 182 |
% space between the macro and the argument's left brace. |
| 183 |
% |
| 184 |
% |
| 185 |
% \subsection{Typesetting the Keyword Values}\label{sec:kwaccess} |
| 186 |
% The following macros can be used to typeset the keyword values anywhere in the |
| 187 |
% document. Please note that not all \LaTeX{} fonts have all special |
| 188 |
% characters, \eg `|_|' is not provided in the standard roman font. To proper |
| 189 |
% typeset file names and URLs containing these letters you can use either |
| 190 |
% teletype font (|\texttt|) or use |{\urlstyle{rm}\rcsnolinkurl{...}}| which |
| 191 |
% requires the \pkg{hyperref} package. |
| 192 |
% |
| 193 |
% \DescribeMacro{rcsrev} |
| 194 |
% \DescribeMacro{rcsdate} |
| 195 |
% \DescribeMacro{rcsauthor} |
| 196 |
% These macros hold the keyword values of the whole document, \ie of the most |
| 197 |
% recent revision. They can be used everywhere in every file of the \LaTeX{} |
| 198 |
% document, after |\usepackage{rcs-multi}| of course. Please see |
| 199 |
% section~\ref{sec:date} how to typeset parts of the date. |
| 200 |
% |
| 201 |
% \DescribeMacro{rcsfilerev} |
| 202 |
% \DescribeMacro{rcsfiledate} |
| 203 |
% \DescribeMacro{rcsfileauthor} |
| 204 |
% These macros hold the keyword values of the current \LaTeX{} file, but only if |
| 205 |
% it contains a \cs{rcsid} or \cs{rcsidlong} macro. Otherwise the macros hold |
| 206 |
% either zero values or the values of the last file dependent on whether an |
| 207 |
% option is enabled which enabled the \pkg{fink} package. Please see |
| 208 |
% section~\ref{sec:date} how to typeset parts of the date. See \cs{rcskw} below |
| 209 |
% for all other keywords. |
| 210 |
% |
| 211 |
% \DescribeMacro{rcsmainfilename} |
| 212 |
% The macro \cs{rcsmainfilename} hold the filename of the main \LaTeX{file}. |
| 213 |
% It can be used to typeset this information anywhere in the document which |
| 214 |
% might be more descriptive as the name of the current file (which can be |
| 215 |
% typeset with \cs{rcskw}|{HeadURL}| or \cs{rcskw}|{Filename}| after \cs{rcsid} |
| 216 |
% or \cs{rcsidlong}, respectively). ^^A TODO: Change to correct names! |
| 217 |
% |
| 218 |
% \DescribeMacro{rcssetmainfile} |
| 219 |
% This will declare the current file as the main LaTeX file by defining the |
| 220 |
% above macros. It will automatically be called at the end of the preamble so |
| 221 |
% the user normally doesn't have to use it by him- or herself as long it isn't |
| 222 |
% needed in the preamble.\par Please note that this macro changes the definition |
| 223 |
% of \cs{rcsmainfilename} directly without going over the auxiliary file. |
| 224 |
% Calling it in several files will make this two macros inconsistent. |
| 225 |
% |
| 226 |
% \DescribeMacro{rcskw}{<keyword name>} |
| 227 |
% All keywords saved with \cs{rcsid} or \cs{rcskwsave} can be typeset by this |
| 228 |
% macro which is a holdover from a very early version of this |
| 229 |
% package when multiple files where not supported. It takes one argument which |
| 230 |
% must be a RCS keyword name. It then returns the current value of this |
| 231 |
% keyword or nothing (|\relax|) when the keyword was not set yet. |
| 232 |
% Examples:\\ |
| 233 |
% \indent\indent |\textsl{Revision: \rcskw{Revision}}|\\ |
| 234 |
% \indent\indent |URL: \url{\rcskw{HeadURL}}|\\ ^^A TODO: Change name! |
| 235 |
% In the second example |\url| (\pkg{hyperref} package) is used to add a hyperlink |
| 236 |
% and to avoid problems with underscores (|_|) inside the URL. \rcsmulti is |
| 237 |
% also providing a macro \cs{rcsnolinkurl} which works like |\url| but doesn't |
| 238 |
% adds an hyperlink. See the description of this macro for more details. |
| 239 |
% |
| 240 |
% If the given keyword doesn't exists a package warning is given to allow |
| 241 |
% spelling errors to be tracked down. This doesn't work well when \cs{rcskw} is |
| 242 |
% used inside |\url|. In this case the warning code will be typeset(!) verbatim |
| 243 |
% into the document by |\url|. |
| 244 |
% |
| 245 |
% \DescribeMacro{rcskwdef}{<keyword name>}{<value>} |
| 246 |
% This macro is used to define the keyword values. This is normally only called |
| 247 |
% internally but could be used by the user to override single keywords. The |
| 248 |
% values can then be typeset by \cs{rcskw}. Note that this macro has no |
| 249 |
% influence on the calculation of the latest revision. |
| 250 |
% |
| 251 |
% \subsection{Accessing Date Values}\label{sec:date} |
| 252 |
% \begin{DescribeMacrosTab}{ll} |
| 253 |
% \Macro{rcsyear} & \Macro{rcsfileyear} \\ |
| 254 |
% \Macro{rcsmonth} & \Macro{rcsfilemonth} \\ |
| 255 |
% \Macro{rcsday} & \Macro{rcsfileday} \\ |
| 256 |
% \Macro{rcshour} & \Macro{rcsfilehour} \\ |
| 257 |
% \Macro{rcsminute} & \Macro{rcsfileminute} \\ |
| 258 |
% \Macro{rcssecond} & \Macro{rcsfilesecond} \\ |
| 259 |
% \end{DescribeMacrosTab} |
| 260 |
% Whenever the date information is read, \ie by |
| 261 |
% \cs{rcskwsave}|{Date}| or \cs{rcsid}, the following macros are set to the |
| 262 |
% appropriate date parts for the |
| 263 |
% current file (the |\rcsfile...| versions) and for the whole document. |
| 264 |
% |
| 265 |
% |
| 266 |
% \DescribeMacro{rcstime} |
| 267 |
% \DescribeMacro{rcsfiletime} |
| 268 |
% This macros return the time part of the date only and simply return the |
| 269 |
% corresponding hour, minute and second macros with a colon as separator. |
| 270 |
% |
| 271 |
% \DescribeMacro{rcspdfdate} |
| 272 |
% Returns the last changed date of the whole document in a format needed for |
| 273 |
% |\pdfinfo|. Can be used like this:\\ |
| 274 |
% \hbox{}\hfill|\pdfinfo{ /CreationDate (D:\rcspdfdate) }|\hfill\hbox{}\\ |
| 275 |
% to set the PDF creation date to the last changed date if you use |pdflatex| to |
| 276 |
% compile your \LaTeX{} document. |
| 277 |
% |
| 278 |
% \DescribeMacro{rcstoday} |
| 279 |
% \DescribeMacro{rcsfiletoday} |
| 280 |
% These macros typeset the document-global or current-file, respectively, using |
| 281 |
% the format of |\today| which depends on the used language. |
| 282 |
% To adjust the language of your document use the \pkg{babel} package. |
| 283 |
% |
| 284 |
% \subsection{Using Full Author Names} |
| 285 |
% If you like to have the full author\footnote{This means RCS authors, |
| 286 |
% \eg the persons who commit changes into the rcs repository.} names, not only |
| 287 |
% the usernames, in your document you can use the following macros. First you |
| 288 |
% have to register all authors of the document with \cs{rcsRegisterAuthor} and |
| 289 |
% then you can write \eg |\rcsFullAuthor{\rcsauthor}| or |
| 290 |
% |\rcsFullAuthor{\rcsfileauthor}|. |
| 291 |
% |
| 292 |
% \DescribeMacro{rcsRegisterAuthor}{<author>}{<full name>} |
| 293 |
% This macro registers \meta{full name} as full name for \meta{author} (a |
| 294 |
% RCS username) for later use with \cs{rcsFullAuthor}. |
| 295 |
% |
| 296 |
% \DescribeMacro{rcsFullAuthor}{<author name or macror>} |
| 297 |
% \DescribeMacro{rcsFullAuthor*}{<author name or macro>} |
| 298 |
% Takes the username as argument and returns the full name if it was registered |
| 299 |
% first with \Macro\rcsRegisterAuthor, otherwise it returns the given username. |
| 300 |
% The star version returns the username in parentheses after the full name. |
| 301 |
% This is normally used in one of the following forms: |
| 302 |
% \begin{macroquote} |
| 303 |
% \rcsFullAuthor{\AlsoMacro\rcsauthor} \\ |
| 304 |
% \rcsFullAuthor{\AlsoMacro\rcsfileauthor} |
| 305 |
% \end{macroquote} |
| 306 |
% |
| 307 |
% \subsection{Using Full Revision Names} |
| 308 |
% Like the author's also revision names/tags can be registered and used later. |
| 309 |
% These macros were implemented on user request and have the drawback that you |
| 310 |
% have to guess the next revision number of your document in order to get |
| 311 |
% correct results when you like to tag the to-be-checked-in revision. Please |
| 312 |
% note that this has nothing to do with the normal tagging. |
| 313 |
% |
| 314 |
% \DescribeMacro{rcsRegisterRevision}{<revision number>}{<tag name>} |
| 315 |
% This registers \meta{tag name} as tag name for \meta{revision number} for |
| 316 |
% later use with \cs{rcsFullRevision}. |
| 317 |
% |
| 318 |
% \DescribeMacro{rcsFullRevision}{<revision number or macro>} |
| 319 |
% \DescribeMacro{rcsFullRevision*}{<revision number or macro>} |
| 320 |
% Takes a revision number coming from a macro like \cs{rcsrev}, \cs{rcsfilerev} |
| 321 |
% or a number as argument and returns the full name if it was registered first |
| 322 |
% with \cs{rcsRegisterRevision}, otherwise it returns ``Revision \meta{revision |
| 323 |
% number}''. The star version returns also the revision number leaded by `r' in |
| 324 |
% parentheses after the tag name, \eg |Name (1.2)|. |
| 325 |
% |
| 326 |
% \subsection{Verbatim URLs with and without Hyperlinks} |
| 327 |
% \DescribeMacro{rcsnolinkurl}{<macro with returns special text>} |
| 328 |
% This macro allows you to write |\rcsnolinkurl{\rcskw{HeadURL}}| and get the |
| 329 |
% Head URL typeset verbatim. However |\url{|\cs{rcskw}|{HeadURL}}| |
| 330 |
% (\pkg{hyperref} package) gives you the same result with a hyperlink. Both |
| 331 |
% macros require the \pkg{hyperref} package which is not automatically loaded by |
| 332 |
% \rcsmulti. Please load it manually when you like to use \cs{rcsnolinkurl}. |
| 333 |
% |
| 334 |
% Please note that you can't use \pkg{hyperref}'s |\nolinkurl| because it won't |
| 335 |
% expand \cs{rcskw}. |
| 336 |
% |
| 337 |
% \StopEventually{} |
| 338 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 339 |
% \clearpage |
| 340 |
% \section{Implementation} |
| 341 |
% \subsection{Package Header} |
| 342 |
% \begin{macrocode} |
| 343 |
\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 344 |
\ProvidesPackage{rcs-multi} |
| 345 |
[\filedate\space\fileversion\space RCS Keywords for multi-file LaTeX documents] |
| 346 |
% \end{macrocode} |
| 347 |
|
| 348 |
% \subsection{General Internal Macros} |
| 349 |
% Some internal used macro which don't fit in any other section. |
| 350 |
% |
| 351 |
% \begin{macro}{\rcs@ifempty}[1]{string} |
| 352 |
% Tests if the given argument is empty. If so the first of the next two token |
| 353 |
% will be expanded, the second one otherwise. |
| 354 |
% \begin{macrocode} |
| 355 |
\def\rcs@ifempty#1{% |
| 356 |
\begingroup |
| 357 |
\edef\rcs@temp{#1}% |
| 358 |
\ifx\rcs@temp\empty |
| 359 |
\endgroup |
| 360 |
\expandafter |
| 361 |
\@firstoftwo |
| 362 |
\else |
| 363 |
\endgroup |
| 364 |
\expandafter |
| 365 |
\@secondoftwo |
| 366 |
\fi |
| 367 |
} |
| 368 |
% \end{macrocode} |
| 369 |
% \end{macro} |
| 370 |
|
| 371 |
% \begin{macro}{\rcs@ifequal}[2]{string a}{string b} |
| 372 |
% Tests if the given arguments are identical, \eg same strings. If so the first |
| 373 |
% of the next two token will be expanded, the second one otherwise. |
| 374 |
% \begin{macrocode} |
| 375 |
\def\rcs@ifequal#1#2{% |
| 376 |
\begingroup |
| 377 |
\edef\rcs@stringa{#1}% |
| 378 |
\edef\rcs@stringb{#2}% |
| 379 |
\ifx\rcs@stringa\rcs@stringb |
| 380 |
\endgroup |
| 381 |
\expandafter |
| 382 |
\@firstoftwo |
| 383 |
\else |
| 384 |
\endgroup |
| 385 |
\expandafter |
| 386 |
\@secondoftwo |
| 387 |
\fi |
| 388 |
} |
| 389 |
% \end{macrocode} |
| 390 |
% \end{macro} |
| 391 |
|
| 392 |
% \begin{macro}{\rcs@ifvalidrev}[1]{macro name} |
| 393 |
% Checks if the given macro (by name) is a valid revision, \ie defined and |
| 394 |
% greater than zero. |
| 395 |
% \begin{macrocode} |
| 396 |
\def\rcs@ifvalidrev#1{% |
| 397 |
\begingroup |
| 398 |
\@ifundefined{#1}% |
| 399 |
{\def\rcs@temp{-1}}% |
| 400 |
{\expandafter\edef |
| 401 |
\expandafter\rcs@temp\expandafter{\csname #1\endcsname}}% |
| 402 |
\ifnum\rcs@temp>-1\relax |
| 403 |
\endgroup |
| 404 |
\expandafter |
| 405 |
\@firstoftwo |
| 406 |
\else |
| 407 |
\endgroup |
| 408 |
\expandafter |
| 409 |
\@secondoftwo |
| 410 |
\fi |
| 411 |
} |
| 412 |
% \end{macrocode} |
| 413 |
% \end{macro} |
| 414 |
|
| 415 |
% \subsection{Definition of init values} |
| 416 |
% \begin{macrocode} |
| 417 |
% Init values |
| 418 |
\def\rcsrev{0.0} \def\@rcs@rev{0.0} |
| 419 |
\def\rcsdate{} \def\@rcs@date{} |
| 420 |
\def\rcsauthor{} \def\@rcs@author{} |
| 421 |
\def\rcsyear{0000} \def\@rcs@year{0000} |
| 422 |
\def\rcsmonth{00} \def\@rcs@month{00} |
| 423 |
\def\rcsday{00} \def\@rcs@day{00} |
| 424 |
\def\rcshour{00} \def\@rcs@hour{00} |
| 425 |
\def\rcsminute{00} \def\@rcs@minute{00} |
| 426 |
\def\rcssecond{00} \def\@rcs@second{00} |
| 427 |
\def\rcsname{} \def\@rcs@name{} |
| 428 |
\def\rcsurl{} \def\@rcs@url{} |
| 429 |
\def\rcsmainfilename{} |
| 430 |
\def\rcsmainurl{\rcsmainfilename} |
| 431 |
\def\rcs@temp{} |
| 432 |
\def\rcs@lastkw{} |
| 433 |
|
| 434 |
\def\rcsfilerev{0.0} |
| 435 |
\def\rcsfiledate{} |
| 436 |
\def\rcsfileauthor{} |
| 437 |
\def\rcsfileyear{0000} |
| 438 |
\def\rcsfilemonth{00} |
| 439 |
\def\rcsfileday{00} |
| 440 |
\def\rcsfilehour{00} |
| 441 |
\def\rcsfileminute{00} |
| 442 |
\def\rcsfilesecond{00} |
| 443 |
\def\rcsfileurl{} |
| 444 |
\def\rcsfilename{} |
| 445 |
% \end{macrocode} |
| 446 |
% |
| 447 |
|
| 448 |
% \subsection{Time and \textit{Today} macros} |
| 449 |
% |
| 450 |
% \begin{macro}{\rcstime} |
| 451 |
% \begin{macro}{\rcsfiletime} |
| 452 |
% This macros simple use the hour, minute and second macros. |
| 453 |
% \begin{macrocode} |
| 454 |
\def\rcstime{\rcshour:\rcsminute:\rcssecond} |
| 455 |
\def\rcsfiletime{\rcsfilehour:\rcsfileminute:\rcsfilesecond} |
| 456 |
% \end{macrocode} |
| 457 |
% \end{macro} |
| 458 |
% \end{macro} |
| 459 |
|
| 460 |
% These macros use the |\today| macro to typeset the current date using the |
| 461 |
% local language settings. Thanks and credit goes to Manuel P\'egouri\'e-Gonnard |
| 462 |
% for suggesting this feature and for providing some code. |
| 463 |
% \begin{macro}{\rcstoday} |
| 464 |
% \begin{macrocode} |
| 465 |
\newcommand*{\rcstoday}{% |
| 466 |
\begingroup |
| 467 |
\year\rcsyear \month\rcsmonth \day\rcsday |
| 468 |
\relax \today |
| 469 |
\endgroup |
| 470 |
} |
| 471 |
% \end{macrocode} |
| 472 |
% \end{macro} |
| 473 |
% |
| 474 |
% \begin{macro}{\rcsfiletoday} |
| 475 |
% \begin{macrocode} |
| 476 |
\newcommand*{\rcsfiletoday}{% |
| 477 |
\begingroup |
| 478 |
\year\rcsfileyear \month\rcsfilemonth \day\rcsfileday |
| 479 |
\relax \today |
| 480 |
\endgroup |
| 481 |
} |
| 482 |
% \end{macrocode} |
| 483 |
% \end{macro} |
| 484 |
|
| 485 |
% \subsection{Id macro} |
| 486 |
% \begin{macro}{\rcsid} |
| 487 |
% Calls \cs{rcskwsave} with |\@rcsidswtrue| so that the Id keyword will be |
| 488 |
% parsed at the end of \cs{rcskwsave}. |
| 489 |
% \begin{macrocode} |
| 490 |
\newcommand*{\rcsid}{% |
| 491 |
\@rcsidswtrue |
| 492 |
\rcskwsave |
| 493 |
} |
| 494 |
\newif\if@rcsidsw |
| 495 |
\@rcsidswfalse |
| 496 |
% \end{macrocode} |
| 497 |
% \end{macro} |
| 498 |
% |
| 499 |
|
| 500 |
% \begin{macro}{\rcs@scanId}[6]{file name}{revision}{date (YYYY-MM-DD)}{time |
| 501 |
% (HH:MM:SS)}{author (username)}{rest} |
| 502 |
% Scans rcs Id (after it got parsed by \cs{rcskwsave}). Awaits only Id value |
| 503 |
% without leading `|Id:|' and a trailing |\relax| as end marker. It calls |
| 504 |
% \cs{@rcs@scandate} to extract the date information and \cs{@rcs@updateid} to |
| 505 |
% update global Id values and also sets the appropriate keywords. |
| 506 |
% \begin{macrocode} |
| 507 |
\def\rcs@scanId#1,v #2 #3 #4 #5 #6\relax{% |
| 508 |
\@rcs@scandate{#3 #4}% |
| 509 |
\@rcs@updateid{#2}{#3 #4}{#5}{#1}% |
| 510 |
\rcskwdef{Filename}{#1}% |
| 511 |
\rcskwdef{Date}{#3 #4}% |
| 512 |
\rcskwdef{Revision}{#2}% |
| 513 |
\rcskwdef{Author}{#5}% |
| 514 |
} |
| 515 |
% \end{macrocode} |
| 516 |
% \end{macro} |
| 517 |
% |
| 518 |
|
| 519 |
% \begin{macro}{\@rcs@updateid}[4]{rev}{date}{author (username)}{url} |
| 520 |
% We first define the expanded arguments to variables for the user. The |
| 521 |
% expansion is needed because the arguments content is mostly generic like |
| 522 |
% |\rcs@value| which can change very soon after this macro. |
| 523 |
% \begin{macrocode} |
| 524 |
\def\@rcs@updateid#1#2#3#4{% |
| 525 |
\xdef\rcsfilerev{#1}% |
| 526 |
\xdef\rcsfiledate{#2}% |
| 527 |
\xdef\rcsfileauthor{#3}% |
| 528 |
\xdef\rcsfileurl{#4}% |
| 529 |
\rcs@getfilename\rcsfileurl |
| 530 |
% \end{macrocode} |
| 531 |
% Then we check if the revision is non-empty (not yet expanded by RCS?) |
| 532 |
% and larger then the current maximum value |\@rcs@rev|. If yes we save all |
| 533 |
% value to save them in the .aux-file later. |
| 534 |
% \begin{macrocode} |
| 535 |
\ifx\rcsfiledate\empty\else |
| 536 |
\begingroup |
| 537 |
\edef\@tempa{\@rcs@year\@rcs@month\@rcs@day} |
| 538 |
\edef\@tempb{\rcsfileyear\rcsfilemonth\rcsfileday} |
| 539 |
\ifnum\@tempa<\@tempb |
| 540 |
\rcs@update |
| 541 |
\else\ifnum\@tempa=\@tempb |
| 542 |
\edef\@tempa{\@rcs@hour\@rcs@minute\@rcs@second} |
| 543 |
\edef\@tempb{\rcsfilehour\rcsfileminute\rcsfilesecond} |
| 544 |
\ifnum\@tempa<\@tempb |
| 545 |
\rcs@update |
| 546 |
\fi |
| 547 |
\fi\fi |
| 548 |
\endgroup |
| 549 |
\fi |
| 550 |
} |
| 551 |
% \end{macrocode} |
| 552 |
% \end{macro} |
| 553 |
% |
| 554 |
|
| 555 |
% \begin{macro}{\rcs@updateid} |
| 556 |
% Updates the max-hold macros with the values of the current file VC |
| 557 |
% information. |
| 558 |
% \begin{macrocode} |
| 559 |
\def\rcs@update{% |
| 560 |
\xdef\@rcs@rev{\rcsfilerev}% |
| 561 |
\xdef\@rcs@date{\rcsfiledate}% |
| 562 |
\xdef\@rcs@author{\rcsfileauthor}% |
| 563 |
\xdef\@rcs@year{\rcsfileyear}% |
| 564 |
\xdef\@rcs@month{\rcsfilemonth}% |
| 565 |
\xdef\@rcs@day{\rcsfileday}% |
| 566 |
\xdef\@rcs@hour{\rcsfilehour}% |
| 567 |
\xdef\@rcs@minute{\rcsfileminute}% |
| 568 |
\xdef\@rcs@second{\rcsfilesecond}% |
| 569 |
\xdef\@rcs@name{\rcsfilename}% |
| 570 |
\xdef\@rcs@url{\rcsfileurl}% |
| 571 |
} |
| 572 |
% \end{macrocode} |
| 573 |
% \end{macro} |
| 574 |
% |
| 575 |
|
| 576 |
% \begin{macro}{\rcs@catcodes} |
| 577 |
% Changes all \TeX-special character to category ``other''. The newline aka |
| 578 |
% return is changed to category ``ignore'' so line breaks are not taken as part |
| 579 |
% of the verbatim arguments. |
| 580 |
% \begin{macrocode} |
| 581 |
\def\rcs@catcodes{% |
| 582 |
\let\do\@makeother |
| 583 |
\dospecials |
| 584 |
\catcode`\^^M9 |
| 585 |
\catcode`\ 10 |
| 586 |
\catcode`\{1 |
| 587 |
\catcode`\}2 |
| 588 |
} |
| 589 |
% \end{macrocode} |
| 590 |
% \end{macro} |
| 591 |
|
| 592 |
% \begin{macro}{\rcs@gdefverb}[1]{macro} |
| 593 |
% \begin{macrocode} |
| 594 |
\def\rcs@gdefverb#1{% |
| 595 |
\begingroup |
| 596 |
\def\rcs@temp{#1}% |
| 597 |
\begingroup |
| 598 |
\rcs@catcodes |
| 599 |
\rcs@gdefverb@ |
| 600 |
} |
| 601 |
% \end{macrocode} |
| 602 |
% \end{macro} |
| 603 |
|
| 604 |
% \begin{macro}{\rcs@defverb@}[1]{verbatim stuff} |
| 605 |
% \begin{macrocode} |
| 606 |
\def\rcs@gdefverb@#1{% |
| 607 |
\endgroup |
| 608 |
\expandafter\gdef\rcs@temp{#1}% |
| 609 |
\endgroup |
| 610 |
} |
| 611 |
% \end{macrocode} |
| 612 |
% \end{macro} |
| 613 |
|
| 614 |
% \subsection{Keyword Macros} |
| 615 |
% \begin{macro}{\rcskwsave} |
| 616 |
% Enabled verbatim mode and uses a sub macro to read the arguments afterwards. |
| 617 |
% \begin{macrocode} |
| 618 |
\def\rcskwsave{% |
| 619 |
\begingroup |
| 620 |
\rcs@catcodes |
| 621 |
\rcskwsave@readargs |
| 622 |
} |
| 623 |
% \end{macrocode} |
| 624 |
% \end{macro} |
| 625 |
|
| 626 |
% \begin{macro}{\rcskwsave@readargs}[1]{\$kw: value\$} |
| 627 |
% Reads full argument, calls parse submacro and ends catcode changes. |
| 628 |
% If \cs{rcskwsave} was called by \cs{rcsid} scans the id keyword by calling the |
| 629 |
% scan macro. |
| 630 |
% \begin{macrocode} |
| 631 |
\gdef\rcskwsave@readargs#1{% |
| 632 |
\rcskwsave@read#1\relax |
| 633 |
\endgroup |
| 634 |
\if@rcsidsw |
| 635 |
\rcs@ifequal{\rcs@lastkw}{Id}% |
| 636 |
{\ifx\rcskwId\empty\else |
| 637 |
\expandafter |
| 638 |
\rcs@scanId\rcskwId\relax |
| 639 |
\@rcsidswfalse |
| 640 |
\fi}{% |
| 641 |
\rcs@ifequal{\rcs@lastkw}{Header}% |
| 642 |
{\ifx\rcskwHeader\empty\else |
| 643 |
\expandafter |
| 644 |
\rcs@scanId\rcskwHeader\relax |
| 645 |
\@rcsidswfalse |
| 646 |
\fi}{}% |
| 647 |
}% |
| 648 |
\fi |
| 649 |
\ignorespaces |
| 650 |
} |
| 651 |
% \end{macrocode} |
| 652 |
% \end{macro} |
| 653 |
|
| 654 |
% \begin{macro}{\rcskwsave@read}[1]{keyword line without surrounding \$ \$} |
| 655 |
% Reads the full keyword and strips the dollars. |
| 656 |
% \begin{macrocode} |
| 657 |
\begingroup |
| 658 |
\catcode`\$=12 |
| 659 |
\gdef\rcskwsave@read $#1$\relax{% |
| 660 |
\rcs@checkcolon#1:\relax |
| 661 |
} |
| 662 |
\endgroup |
| 663 |
% \end{macrocode} |
| 664 |
% \end{macro} |
| 665 |
|
| 666 |
% \begin{macro}{\rcskwsave@parse}[2]{key}{value} |
| 667 |
% Parse the keyword and save it away. |
| 668 |
% \begin{macrocode} |
| 669 |
\begingroup |
| 670 |
\catcode`\$=11 |
| 671 |
\gdef\rcskwsave@parse$#1:#2${% |
| 672 |
\expandafter\xdef\csname rcskw#1\endcsname{#2}% |
| 673 |
}% |
| 674 |
\endgroup |
| 675 |
% \end{macrocode} |
| 676 |
% \end{macro} |
| 677 |
|
| 678 |
% \begin{macro}{\rcskwdef}[2]{key}{value} |
| 679 |
% \begin{macrocode} |
| 680 |
\newcommand{\rcskwdef}[2]{% |
| 681 |
\gdef\rcs@lastkw{#1}% |
| 682 |
\expandafter\xdef\csname rcskw#1\endcsname{#2}% |
| 683 |
} |
| 684 |
% \end{macrocode} |
| 685 |
% Example: |\rcskwdef{Rev}{2.3}| will define |\rcskwRev| as `|2.3|'. |
| 686 |
% \end{macro} |
| 687 |
|
| 688 |
% We define default values for normal keywords. Keyword |Filename| is the name |
| 689 |
% given by |Id| and not a real keyword. |
| 690 |
% \begin{macrocode} ^^A TODO: check if needed |
| 691 |
\rcskwdef{Rev}{0.0} |
| 692 |
\rcskwdef{Date}{} |
| 693 |
\rcskwdef{Author}{} |
| 694 |
\rcskwdef{Filename}{} |
| 695 |
\rcskwdef{HeadURL}{} |
| 696 |
% \end{macrocode} |
| 697 |
|
| 698 |
% \begin{macro}{\rcskw}[1]{keyword name} |
| 699 |
% Macro to get keyword value. Just calls \cs{rcskw}\meta{ARGUMENT} where |
| 700 |
% the argument interpreted as text. So \eg |\rcskw{Date}| is the same as |
| 701 |
% |rcskwDate| but this could be changed later so always use this interface |
| 702 |
% to get the keyword values. |
| 703 |
% |
| 704 |
% \changes{v1.2}{2007/06/22}{Added warning when a wrong, maybe |
| 705 |
% misspelled, keyword is given.} |
| 706 |
% \begin{macrocode} |
| 707 |
\newcommand{\rcskw}[1]{% |
| 708 |
\@ifundefined{rcskw#1}% |
| 709 |
{\PackageWarning{rcs-multi}{RCS keyword '#1' not defined (typo?)}}% |
| 710 |
{\csname rcskw#1\endcsname}% |
| 711 |
}% |
| 712 |
% \end{macrocode} |
| 713 |
% \end{macro} |
| 714 |
% |
| 715 |
|
| 716 |
% \subsection{Keyword check and strip macros} |
| 717 |
% The following macros are used to test whether the given keywords are fully |
| 718 |
% expanded or not. |
| 719 |
% RCS supports unexpanded keywords as input with or without colon and |
| 720 |
% with or without trailing space(s), \ie a:~|$KW$|, b:~|$KW:$| or c:~|$KW: $|. |
| 721 |
% To avoid \LaTeX{} syntax errors in this pre-commit state the keyword is |
| 722 |
% checked by the following macros. Unexpanded keywords result in an empty value. |
| 723 |
% Also leading and trailing spaces are removed. |
| 724 |
% |
| 725 |
% \begin{macro}{\rcs@checkcolon}[2]{key}{potential value, might be empty} |
| 726 |
% Checks if the keyword contains a colon. It is called by \cs{rcskwsave@read} |
| 727 |
% with a trailing |:\relax| so that \#2 will be empty if there is no earlier |
| 728 |
% colon or will hold the value with this trailing colon otherwise. |
| 729 |
% The first case means that the keyword is unexpanded without colon (case a) |
| 730 |
% which leads to an empty value. In the second case \cs{rcs@stripcolon} is |
| 731 |
% called to strip the colon and surrounding spaces. The final value is |
| 732 |
% returned by |\rcs@value|. |
| 733 |
% \begin{macrocode} |
| 734 |
\def\rcs@checkcolon#1:#2\relax{% |
| 735 |
\rcs@ifempty{#2}% |
| 736 |
{\rcskwdef{#1}{}}% |
| 737 |
{\rcs@stripcolon#2\relax\rcskwdef{#1}{\rcs@value}}% |
| 738 |
} |
| 739 |
% \end{macrocode} |
| 740 |
% \end{macro} |
| 741 |
|
| 742 |
% \begin{macro}{\rcs@stripcolon}[1]{potential value} |
| 743 |
% Strips the previous added colon (for \cs{rcs@checkcolon}). |
| 744 |
% The remaining argument is checked if it's empty (case b) or only a space |
| 745 |
% (case c). Otherwise the keyword is expanded and \cs{rcs@stripspace} is |
| 746 |
% called to strip the spaces. |
| 747 |
% \begin{macrocode} |
| 748 |
\def\rcs@stripcolon#1:\relax{% |
| 749 |
\rcs@ifempty{#1}% |
| 750 |
{\gdef\rcs@value{}}% |
| 751 |
{\rcs@ifequal{#1}{ }% |
| 752 |
{\gdef\rcs@value{}}% |
| 753 |
{\rcs@stripspace#1\relax\relax}% |
| 754 |
}% |
| 755 |
} |
| 756 |
% \end{macrocode} |
| 757 |
% \end{macro} |
| 758 |
|
| 759 |
% \begin{macro}{\rcs@stripspace}[2]{first character}{rest of string} |
| 760 |
% Strips leading space if present and calls \cs{rcs@striptrailingspace} to |
| 761 |
% strip the trailing space. |
| 762 |
% \begin{macrocode} |
| 763 |
\def\rcs@stripspace#1#2\relax{% |
| 764 |
\rcs@ifequal{#1}{ }% |
| 765 |
{\gdef\rcs@value{#2}}% |
| 766 |
{\rcs@striptrailingspace#1#2\relax}% |
| 767 |
} |
| 768 |
% \end{macrocode} |
| 769 |
% \end{macro} |
| 770 |
|
| 771 |
% \begin{macro}{\rcs@striptrailingspace}[1]{string} |
| 772 |
% Strips trailing space using the macros parameter text. Must be called with |
| 773 |
% |\relax| as end marker. |
| 774 |
% \begin{macrocode} |
| 775 |
\def\rcs@striptrailingspace#1 \relax{% |
| 776 |
\gdef\rcs@value{#1}% |
| 777 |
} |
| 778 |
% \end{macrocode} |
| 779 |
% \end{macro} |
| 780 |
|
| 781 |
|
| 782 |
% \subsection{Date Macros} |
| 783 |
% \begin{macro}{\@rcs@scandate}[1]{date} |
| 784 |
% Scans data information in Id keyword and saves them in macros. |
| 785 |
% \begin{macrocode} |
| 786 |
\def\@rcs@scandate#1{\@rcs@scandate@#1\empty\relax} |
| 787 |
|
| 788 |
\def\@rcs@scandate@#1/#2/#3 #4:#5:#6#7#8\relax{% |
| 789 |
\gdef\rcsfileyear{#1}% |
| 790 |
\gdef\rcsfilemonth{#2}% |
| 791 |
\gdef\rcsfileday{#3}% |
| 792 |
\gdef\rcsfilehour{#4}% |
| 793 |
\gdef\rcsfileminute{#5}% |
| 794 |
\gdef\rcsfilesecond{#6#7}% |
| 795 |
} |
| 796 |
% \end{macrocode} |
| 797 |
% \end{macro} |
| 798 |
|
| 799 |
% \begin{macro}{\rcspdfdate} |
| 800 |
% Returns date in a format needed for |\pdfinfo|. |
| 801 |
% \begin{macrocode} |
| 802 |
\def\rcspdfdate{% |
| 803 |
\rcsyear\rcsmonth\rcsday |
| 804 |
\rcshour\rcsminute\rcssecond00'00'% |
| 805 |
} |
| 806 |
% \end{macrocode} |
| 807 |
% \end{macro} |
| 808 |
|
| 809 |
% \subsection{Mainfile Makros} |
| 810 |
% \begin{macro}{\rcssetmainfile} |
| 811 |
% Saves the current filename and URL to macros. |
| 812 |
% Will be called automatically in the preamble. |
| 813 |
% \changes{v1.2}{2007/06/22}{New macro} |
| 814 |
% \begin{macrocode} |
| 815 |
\newcommand{\rcssetmainfile}{% |
| 816 |
\xdef\rcsmainfilename{\rcsfilename}% |
| 817 |
\xdef\rcsmainfileurl{\rcsfileurl}% |
| 818 |
} |
| 819 |
\AtBeginDocument{\rcssetmainfile} |
| 820 |
% \end{macrocode} |
| 821 |
% \end{macro} |
| 822 |
|
| 823 |
% \subsection{Register and FullName Macros} |
| 824 |
% \begin{macro}{\rcsRegisterAuthor}[2]{author username}{Full Name} |
| 825 |
% Saves the author's name by defining |rcs@author@|\meta{username} to it. |
| 826 |
% \begin{macrocode} |
| 827 |
\newcommand{\rcsRegisterAuthor}[2]{% |
| 828 |
\expandafter\def\csname rcs@author@#1\endcsname{#2}% |
| 829 |
} |
| 830 |
% \end{macrocode} |
| 831 |
% \end{macro} |
| 832 |
|
| 833 |
% \begin{macro}{\rcsFullAuthor} |
| 834 |
% \begin{macro}{\rcsFullAuthor*} |
| 835 |
% We test if the starred or the normal version is used and call the |
| 836 |
% appropriate submacro |rcsFullAuthor@star| or |rcsFullAuthor@normal|. |
| 837 |
% \changes{v1.2}{2007/06/22}{Macro now returns the username if the full name |
| 838 |
% was not registered.} |
| 839 |
% \begin{macrocode} |
| 840 |
\newcommand{\rcsFullAuthor}{% |
| 841 |
\@ifnextchar{*}% |
| 842 |
{\rcsFullAuthor@star}% |
| 843 |
{\rcsFullAuthor@normal}% |
| 844 |
}% |
| 845 |
% \end{macrocode} |
| 846 |
% \end{macro} |
| 847 |
% \end{macro} |
| 848 |
% \begin{macro}{\rcsFullAuthor@star}[1]{username} |
| 849 |
% Both submacros are calling |rcsFullAuthor@| but with different arguments. |
| 850 |
% The star macro also removes the star of course. |
| 851 |
% \begin{macrocode} |
| 852 |
\def\rcsFullAuthor@star*#1{% |
| 853 |
\edef\rcs@temp{#1}% |
| 854 |
\rcsFullAuthor@{\rcs@temp}{~(\rcs@temp)}% |
| 855 |
}% |
| 856 |
% \end{macrocode} |
| 857 |
% \end{macro} |
| 858 |
% \begin{macro}{\rcsFullAuthor@normal}[1]{username} |
| 859 |
% \begin{macrocode} |
| 860 |
\def\rcsFullAuthor@normal#1{% |
| 861 |
\edef\rcs@temp{#1}% |
| 862 |
\rcsFullAuthor@{\rcs@temp}{}% |
| 863 |
}% |
| 864 |
% \end{macrocode} |
| 865 |
% \end{macro} |
| 866 |
% \begin{macro}{\rcsFullAuthor@}[2]{username}{previous defined trailing string} |
| 867 |
% |rcsFullAuthor@| now sets the author's full name. Note that |#2| is empty |
| 868 |
% when the normal version is called. |
| 869 |
% \begin{macrocode} |
| 870 |
\def\rcsFullAuthor@#1#2{% |
| 871 |
\@ifundefined{rcs@author@#1}% |
| 872 |
{#1}% |
| 873 |
{\csname rcs@author@#1\endcsname #2}% |
| 874 |
} |
| 875 |
% \end{macrocode} |
| 876 |
% \end{macro} |
| 877 |
|
| 878 |
% \begin{macro}{\rcsRegisterRevision}[2]{revision number}{tag name} |
| 879 |
% Saves the revision's name or tag by defining |
| 880 |
% |rcs@revision@|\meta{revisionnumber} to it. |
| 881 |
% \changes{v1.2}{2007/06/22}{New macro} |
| 882 |
% \begin{macrocode} |
| 883 |
\newcommand{\rcsRegisterRevision}[2]{% |
| 884 |
\expandafter\def\csname rcs@revision@#1\endcsname{#2}% |
| 885 |
} |
| 886 |
% \end{macrocode} |
| 887 |
% \end{macro} |
| 888 |
|
| 889 |
% \begin{macro}{\rcsFullRevision} |
| 890 |
% \begin{macro}{\rcsFullRevision*} |
| 891 |
% We test if the starred or the normal version is used and call the |
| 892 |
% appropriate submacro |rcsFullRevision@star| or |rcsFullRevision@normal|. |
| 893 |
% \changes{v1.2}{2007/06/22}{New macro} |
| 894 |
% \begin{macrocode} |
| 895 |
\newcommand{\rcsFullRevision}{% |
| 896 |
\@ifnextchar{*}% |
| 897 |
{\rcsFullRevision@star}% |
| 898 |
{\rcsFullRevision@normal}% |
| 899 |
} |
| 900 |
% \end{macrocode} |
| 901 |
% \end{macro} |
| 902 |
% \end{macro} |
| 903 |
% |
| 904 |
% \begin{macro}{\rcsFullRevision@star}[1]{revision number} |
| 905 |
% Both submacros are calling |rcsFullRevision@| but with different arguments. |
| 906 |
% The star macro also removes the star of course. |
| 907 |
% \begin{macrocode} |
| 908 |
\def\rcsFullRevision@star*#1{% |
| 909 |
\edef\rcs@temp{#1}% |
| 910 |
\rcsFullRevision@{\rcs@temp}{~(r\rcs@temp)}% |
| 911 |
} |
| 912 |
% \end{macrocode} |
| 913 |
% \end{macro} |
| 914 |
% \begin{macro}{\rcsFullRevision@normal}[1]{revision number} |
| 915 |
% \begin{macrocode} |
| 916 |
\def\rcsFullRevision@normal#1{% |
| 917 |
\edef\rcs@temp{#1}% |
| 918 |
\rcsFullRevision@{\rcs@temp}{}% |
| 919 |
} |
| 920 |
% \end{macrocode} |
| 921 |
% \end{macro} |
| 922 |
% \begin{macro}{\rcsFullRevision@}[2]{revision number}{previous defined trailing |
| 923 |
% string} |
| 924 |
% |rcsFullRevision@| now sets the revision name. Note that |#2| is empty |
| 925 |
% when the normal version is called. |
| 926 |
% \begin{macrocode} |
| 927 |
\def\rcsFullRevision@#1#2{% |
| 928 |
\@ifundefined{rcs@revision@#1}% |
| 929 |
{Revision #1}% |
| 930 |
{\csname rcs@revision@#1\endcsname #2}% |
| 931 |
} |
| 932 |
% \end{macrocode} |
| 933 |
% \end{macro} |
| 934 |
|
| 935 |
% \subsection{Other macros} |
| 936 |
% This section contains macros which don't fit in any other section. |
| 937 |
% |
| 938 |
% \begin{macro}{\rcs} |
| 939 |
% Strips the |$ $| around the keyword. A space must be before the final dollar. |
| 940 |
% \begin{macrocode} |
| 941 |
\providecommand{\rcs}[1]{\@revs#1} |
| 942 |
\def\@rcs$#1 ${#1} |
| 943 |
% \end{macrocode} |
| 944 |
% \end{macro} |
| 945 |
|
| 946 |
% \begin{macro}{\rcsnolinkurl}[1]{URL} |
| 947 |
% This code is taken from the \pkg{hyperref} package and is the definition of |
| 948 |
% |\url| just without the part which creates the actual hyperlink. This needs |
| 949 |
% of course the \pkg{hyperref} package. A warning is given if it isn't loaded. |
| 950 |
% \changes{v1.2}{2007/06/22}{New macro} |
| 951 |
% \begin{macrocode} |
| 952 |
%% Adapted from the \url macro of the `hyperref` package. |
| 953 |
\DeclareRobustCommand*{\rcsnolinkurl}{% |
| 954 |
\@ifundefined{hyper@normalise}% |
| 955 |
{\PackageWarning{rcs-multi}{Package hyperref is needed for \noexpand |
| 956 |
\rcsnolinkurl.}}% |
| 957 |
{\hyper@normalise\rcsnolinkurl@}% |
| 958 |
}% |
| 959 |
\def\rcsnolinkurl@#1{\Hurl{#1}}% |
| 960 |
% \end{macrocode} |
| 961 |
% \end{macro} |
| 962 |
|
| 963 |
% \begin{macro}{\rcs@getfilename}[1]{URL} |
| 964 |
% This macro expands the content using the temporary macro and sets it in front |
| 965 |
% of the \csi{rcs@getfilename} sub-macro together with |/{}| to make sure the |
| 966 |
% macro does not break at values without directories. A |\relax| is used as |
| 967 |
% end marker. |
| 968 |
% \begin{macrocode} |
| 969 |
\def\rcs@getfilename#1{% |
| 970 |
\begingroup |
| 971 |
\edef\rcs@temp{#1}% |
| 972 |
\expandafter\@rcs@getfilename\rcs@temp/{}\relax |
| 973 |
}% |
| 974 |
% \end{macrocode} |
| 975 |
% \end{macro} |
| 976 |
|
| 977 |
% \begin{macro}{\@rcs@getfilename}[2]{URL part before first slash}{URL part after |
| 978 |
% first slash} |
| 979 |
% Splits the content at the first slash (|/|) and checks if the remainder is |
| 980 |
% empty. If so the end marker got reached and the part before the slash is the |
| 981 |
% filename which is returned. Otherwise the macro recursively calls itself to |
| 982 |
% split the remainder. |
| 983 |
% \begin{macrocode} |
| 984 |
\def\@rcs@getfilename#1/#2\relax{% |
| 985 |
\rcs@ifempty{#2}% |
| 986 |
{\endgroup\gdef\rcsfilename{#1}}% |
| 987 |
{\@rcs@getfilename#2\relax}% |
| 988 |
}% |
| 989 |
% \end{macrocode} |
| 990 |
% \end{macro} |
| 991 |
|
| 992 |
% \subsection{Write to Auxiliary file} |
| 993 |
% |
| 994 |
|
| 995 |
% \begin{macro}{\rcs@writeaux} |
| 996 |
% This macro writes the |.aux| auxiliary file and is called from a |
| 997 |
% |\AtEndDocument| macro later on. |
| 998 |
% \begin{macrocode} |
| 999 |
\def\rcs@writeaux{% |
| 1000 |
\immediate\write\@mainaux{^^J% |
| 1001 |
\noexpand\gdef\noexpand\rcsrev{\@rcs@rev}^^J% |
| 1002 |
\noexpand\gdef\noexpand\rcsdate{\@rcs@date}^^J% |
| 1003 |
\noexpand\gdef\noexpand\rcsauthor{\@rcs@author}^^J% |
| 1004 |
\noexpand\gdef\noexpand\rcsyear{\@rcs@year}^^J% |
| 1005 |
\noexpand\gdef\noexpand\rcsmonth{\@rcs@month}^^J% |
| 1006 |
\noexpand\gdef\noexpand\rcsday{\@rcs@day}^^J% |
| 1007 |
\noexpand\gdef\noexpand\rcshour{\@rcs@hour}^^J% |
| 1008 |
\noexpand\gdef\noexpand\rcsminute{\@rcs@minute}^^J% |
| 1009 |
\noexpand\gdef\noexpand\rcssecond{\@rcs@second}^^J% |
| 1010 |
\noexpand\rcs@gdefverb\noexpand\rcsname{\@rcs@name}^^J% |
| 1011 |
\noexpand\rcs@gdefverb\noexpand\rcsurl{\@rcs@url}^^J% |
| 1012 |
}% |
| 1013 |
} |
| 1014 |
% \end{macrocode} |
| 1015 |
% \end{macro} |
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
% At the end of document the values are written to the auxiliary file. |
| 1020 |
% \begin{macrocode} |
| 1021 |
\AtEndDocument{% |
| 1022 |
\if@filesw |
| 1023 |
\ifx\@rcs@date\empty\else |
| 1024 |
\rcs@writeaux |
| 1025 |
\fi |
| 1026 |
\fi |
| 1027 |
} |
| 1028 |
% \end{macrocode} |
| 1029 |
% |
| 1030 |
% \Finale |
| 1031 |
\endinput |