summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/svn-multi/group_example.tex
blob: e961e7da9fe97f054b9dc714f1994188ec505f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
\RequirePackage{atbegshi}
\documentclass[a4paper,oneside]{scrbook}
\usepackage[all]{svn-multi}[2010/12/29]
\svnidlong
{$HeadURL: svn://server/group_example.tex $}
{$LastChangedDate: 2000-01-01 01:44:01 +0000 (Main file) $}
{$LastChangedRevision: 98 $}
{$LastChangedBy: author3 $}


% Pre-declaration of groups to define order in table
\svngroup{abc}
\svngroup{def}
\svngroup{ghi}
\svngroup{jkl}
%\svngroup{Images}
\svngroup{}

% Ignore logo in subfiles and set it explicitly into the main file:
%\svnexternal{{logo.jpg}}%
%\svnignoregraphic{logo.jpg}

% Special groups for images and other external files:
%\svngraphicsgroup{Images}
%\svnexternalgroup{external}

\let\ifvtex=\relax
\usepackage{hyperref}
\usepackage{ifthen}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\makeatletter
% Workaround for listinputlisting
\newcommand*{\svnlstinputlisting}[2][]{%
  {\let\input\@input\lstinputlisting[#1]{#2}}%
}
\makeatother
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}

% This is an example document to show the group feature of svn-multi 2.0.
% Please the notes below.

\makeatletter
% Version control information table for each chapter
\newcommand{\chaptervctable}{%
\par\noindent
\textbf{Version Control Information for this chapter}\\[\bigskipamount]%
\begin{tabular}{lp{0.7\textwidth}}
Chapter URL           & \svnnolinkurl{\svnfileurl}\\
Chapter File name     & \svnnolinkurl{\svnfilefname}\\
Last Changed Revision & \svnfilerev\\
Last Changed Author   & \svnfileauthor\\
Last Changed Date     & \svnfiledate\\
\end{tabular}
\bigskip
\par\noindent
This files contains the following SVN keywords:\\*[-\baselineskip]
{\let\input\@input
\svnlstinputlisting[firstline=5,lastline=9]{\currfilepath}
}
}
\makeatother

% This file generates some example sub files from this file to avoid a lot of small
% example files in the CTAN directory. In real life there would be separate
% files from the beginning.

\begin{filecontents}{group_example_part1a.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part1a.tex $}
{$LastChangedDate: 2000-01-01 01:00:01 +0000 (Chapter 1a) $}
{$LastChangedRevision: 101 $}
{$LastChangedBy: author1 $}

\chapter{Subfile 1a}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part1b.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part1b.tex $}
{$LastChangedDate: 2001-01-01 00:00:01 +0000 (Subfile 1b) $}
{$LastChangedRevision: 102 $}
{$LastChangedBy: author2 $}

\chapter{Subfile 1b}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part1c.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part1c.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 1c) $}
{$LastChangedRevision: 104 $}
{$LastChangedBy: author3 $}

\chapter{Subfile 1c}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part2a.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part2a.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 2a) $}
{$LastChangedRevision: 100 $}
{$LastChangedBy: author1 $}

\chapter{Subfile 2a}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part2b.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part2b.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 2b) $}
{$LastChangedRevision: 101 $}
{$LastChangedBy: author1 $}

\chapter{Subfile 2b}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part3a.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part3a.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 3a) $}
{$LastChangedRevision: 104 $}
{$LastChangedBy: author3 $}

\chapter{Subfile 3a}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part3b.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part3b.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 3b) $}
{$LastChangedRevision: 103 $}
{$LastChangedBy: author2 $}

\chapter{Subfile 3b}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_part4a.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part4a.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 4a) $}
{$LastChangedRevision: 99 $}
{$LastChangedBy: author3 $}

\chapter{Subfile 4a}
\chaptervctable
\input{group_example_part4a_sub1.tex}
\end{filecontents}

\begin{filecontents}{group_example_part4a_sub1.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part4a_sub1.tex $}
{$LastChangedDate: 2000-01-01 00:00:00 +0000 (SubSubfile 4a-1) $}
{$LastChangedRevision: 96 $}
{$LastChangedBy: author2 $}

\section{SubSubfile 4a-1}
This is a sub file in a sub file.
\svnexternal{{Makefile}}
\end{filecontents}

\begin{filecontents}{group_example_part4b.tex}
\svnidlong
{$HeadURL: svn://server/group_example_part4b.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (Subfile 4b) $}
{$LastChangedRevision: 105 $}
{$LastChangedBy: author2 $}

\chapter{Subfile 4b}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_end.tex}
\svnidlong
{$HeadURL: svn://server/group_example_end.tex $}
{$LastChangedDate: 2000-01-01 00:00:01 +0000 (End) $}
{$LastChangedRevision: 100 $}
{$LastChangedBy: author1 $}

\chapter{End credits}
\chaptervctable
\end{filecontents}

\begin{filecontents}{group_example_unexpanded.tex}
\svnidlong
{$HeadURL$}
{$LastChangedDate$}
{$LastChangedRevision$}
{$LastChangedBy$}

\chapter{File with unexpanded keywords}
\chaptervctable
\end{filecontents}

\svnRegisterAuthor{author1}{Andy Author, I.}
\svnRegisterAuthor{author2}{A. Author, II.}
\svnRegisterAuthor{author3}{Anthony Author, III.}

% Have VC info on every part page
\let\origpart=\part
\def\part{%
\setpartpreamble{%
\vspace*{5cm}
\par\noindent
\textbf{Version Control Information for this part:}\\[\bigskipamount]%
\begin{tabular}{lp{0.7\textwidth}}
URL of latest File    & \svnnolinkurl{\svncgurl}\\
Name of latest File   & \svnnolinkurl{\svncgfname}\\
Last Changed Revision & \svncgrev\\
Last Changed Author   & \svncgauthor\\
Last Changed Date     & \svncgdate\\
\end{tabular}
}\origpart
}

\listfiles
\begin{document}

% Custom titlepage:
\hbox{}%
\vfill
\pdfbookmark{Title Page}{titlepage}%
{\centering
\Huge\texttt{svn-multi} v2.0 Keyword Groups Example Document\\
\Large Martin Scharrer\\
\large 2009/03/01\\
}%
\vfill
\par\noindent
This is an example and test document for the group feature of svn-multi 2.0.
Please note that the revision keywords were generated manually for testing
purposes. The dates are not consistent with the revisions and contain a debug
name instead of the date text like `(Sat, January 1 2009)'. This doesn't
influence the correct functionality of the svn-multi package.\\
\bigskip
{\hbox{}\hfill Happy \TeX ing!}\\
\vfill%
\par\noindent
{\large Version Control Information for this document:\\[\bigskipamount]}%
\begin{tabular}{lp{0.7\textwidth}}
Main URL              & \svnnolinkurl{\svnmainurl}\\
Main File name        & \svnnolinkurl{\svnmainfilename}\\
URL of latest file    & \svnnolinkurl{\svnurl}\\
Name of latest file   & \svnnolinkurl{\svnfname}\\
Last Changed Revision & \svnrev\\
Last Changed Author   & \svnauthor\\
Last Changed Date     & \svndate\\
\end{tabular}
\bigskip\par\noindent
The main file of this document contains the following SVN
keywords:\\*[-\baselineskip]
\svnlstinputlisting[firstline=3,lastline=7]{\currfilepath}
\thispagestyle{empty}
\clearpage

% Default in Engish
\renewcommand{\svnbeforetable}{%
This is an automatic generated table using the \textbf{\sffamily table} option.
\bigskip\par\noindent
}
\clearpage
\pdfbookmark{Table of Revisions (1)}{tora}%
\tableofrevisions
\clearpage

% Redefined to German
% Uses booktabs for nicer table
\renewcommand{\svnbeforetable}{%
Can be redefined to another format and language: Verstehen Sie Deutsch?
\bigskip\par\noindent
}
\renewenvironment{svntable}{%
\begin{longtable}{p{6.2cm}rll}
\toprule
}
{%
\bottomrule
\end{longtable}
}
\renewcommand*\svntablehead{%
    Name & Rev & Autor & Datum \\
\midrule[\heavyrulewidth]
}
\renewcommand{\svnrevisionsname}{Revisionen}
\renewcommand{\svntabgroup}[1]{Gruppe `#1'}

% Some highlight examples:
% Print highest revision bold:
\renewcommand{\svntabrev}[1]{\ifthenelse{#1=\svnrev}{\textbf{#1}}{#1}}
% Highlight all dates after the 14th March 2008 12:00:00:
\renewcommand{\svntabdate}[8]{%
  \ifthenelse{#1#2#3#4>2008031412}{\color{red}\bfseries}{}%
  \small #3.#2.#1\ #4:#5:#6%
}
% Mark all files last changed by the last author:
\renewcommand{\svntabauthor}[1]{%
  \ifthenelse{\equal{#1}{\svnauthor}}{\color{green}}{}%
  \svnFullAuthor{#1}%
}

% Using \scriptsize and \svnnolinkurl for files and subgroups:
\renewcommand{\svntabfile}[2]{%
  \addtolength{\leftskip}{#1\medskipamount}%
  Datei `{\scriptsize\svnnolinkurl{#2}}'
}
\renewcommand{\svntabsubgroup}[2]{%
  \addtolength{\leftskip}{#1\medskipamount}%
  Untergruppe `{\scriptsize\svnnolinkurl{#2}}'%
}
\renewcommand{\svntabglobal}[1]{Gesamtes Dokument}

% Add rule before group rows:
\renewcommand{\svngrouprow}{\midrule}
% Add rule and description after global row:
\renewcommand{\endsvnglobalrow}{\midrule Ohne Gruppe:\\}

\pdfbookmark{Table of Revisions (2)}{torb}%
\tableofrevisions
\clearpage


\svngroup{abc}
\part{Abc}
\input{group_example_part1a}
\include{group_example_part1b}
\include{group_example_part1c}

\svngroup{def}
\part{Def}
\include{group_example_part2a}
\include{group_example_part2b}

\svngroup{ghi}
\part{Ghi}
\include{group_example_part3a}
\include{group_example_part3b}

\svngroup{jkl}
\part{jkl}
\include{group_example_part4a}
\include{group_example_part4b}

% The rest doesn't belong to a file group:
\svngroup{}
\include{group_example_end}
\include{group_example_unexpanded}

\chapter*{Reference Examples}
%To reference e.g.\ keyword from group `abc' use:
\section*{Group `abc'}
\svnsetcg{abc} Revision \svncgrev\ from \svncgtoday\ \svncgtime\ done by
\svnFullAuthor{\svncgauthor}. Latest file is \svnnolinkurl{\svncgfname} (URL: \url{\svncgurl}).

\section*{Subgroup `group\_example\_part3b'}
\svnsetcg{group_example_part3b} Revision \svncgrev\ from \svncgtoday\ \svncgtime\ done by
\svnFullAuthor{\svncgauthor}. Latest file is \svnnolinkurl{\svncgfname} (URL: \url{\svncgurl}).

\section*{File `group\_example\_part3b.tex'}
\svnsetcg{group_example_part3b.tex} Revision \svncgrev\ from \svncgtoday\ \svncgtime\ done by
\svnFullAuthor{\svncgauthor}. File name and url: \svnnolinkurl{\svncgfname} (URL: \url{\svncgurl}).


\end{document}