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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
|
%\iffalse
%<*header>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `svninfo' package to use with LaTeX2e.
%%
%% This package is used to extract the revision and file information provided
%% by the Subversion revision control system.
%% A PERL-package supporting svninfo and LaTeX2HTML is provieded too.
%%
%% Copyright (C) 1995 Dr. Juergen Vollmer
%% Copyright (C) 2003-2005 Achim D. Brucker
%%
%% License:
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or any later version.
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%\iffalse
% to test the checksum, uncomment \OnlyDescription
% in the driver
%\fi
%
%% \CheckSum{345}
%% \CharacterTable
%% {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
%% 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
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%</header>
%\fi
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\if,\else,\fi,\emph,\footnotesize,\footrulewidth,\let}
% \DoNotIndex{\newcount,\newif,\number,\or,\parindent,\plainfootrulewidth}
% \DoNotIndex{\PrintChanges,\PrintIndex,\relax,\setlength,\space}
% \DoNotIndex{\the,\textwidth,\thepage,\newcommand,\texttt,\verb,\vfill}
% \DoNotIndex{\input,\newpage,\setcounter,\newcounter,\\,\ ,\typeout,\today}
%
% \MakeShortVerb{\|}
% \newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
% \newcommand{\Cmd}[1]{\texttt{$\backslash$#1}}
% \newcommand{\SVN}{\emph{Subversion}}
% \newcommand{\blank}{{\tiny$_\sqcup$}}
% \newcommand{\Id}{\texttt{\$Id\$}}
% \newcommand{\SvnInfoCmd}[1]{\texttt{$\backslash$svnInfo\blank\$Id#1\$}}
%
% \changes{v0.3}{2005/09/30}{Added support for \texttt{\$Id:\$} keywords without
% owner information (a bug reported by Uwe Ziegenhagen).}
% \changes{v0.2.1}{2005/04/07}{Added \texttt{\\svnId} (suggested by Thomas Weber).}
% \changes{v0.2}{2005/01/17}{Removed \LatexToHtml{} build-dependency.}
% \changes{v0.1}{2003/08/14}{Initial version, mainly a modified version
% of the \texttt{rcsinfo} package.}
%
% \title{The \texttt{svninfo} package}
% \author{Achim D.~Brucker\\
% {\footnotesize email: brucker@freiburg.linux.de}}
% \date{Oktober 3, 2005\\Version 0.3}
%
% \maketitle
%
% \begin{abstract}
% \noindent This package is used to extract the revision and file
% information provided by the \SVN\ revision control system
% (\texttt{http://subversion.tigris.org}). Support for the \LatexToHtml\
% conversion tool is provided\footnote{\LatexToHtml\ is a conversion
% tool that allows documents written in \LaTeX\ to become part of the
% World Wide Web. It's written by \emph{Nikos Drakos, Computer Based
% Learning Unit, University of Leeds.}}.
% \end{abstract}
%
%\section{Introduction}
%
% To maintain different versions of a document or to keep track on the
% development of one,
% the document is kept under a revison control system like \emph{SCCS},
% \emph{CVS}, or \SVN.
% This package assumes you are using the \SVN\ system.
% To present the version information of a document, one needs to extract it
% from some kind of text inserted by the revision control system.
% \SVN\ offers therefore the \Id\ keyword, which is expanded by the \SVN\
% \emph{update} command and contains a
% lot of useful information. This information is made available through
% this package.
%
% The information obtained from the expanded \Id\ string are
% \begin{itemize}
% \item the filename,
% \item the revision number,
% \item the date and time of the last \SVN\ \emph{co} command, and
% \item name of the user who has done this action.
% \end{itemize}
% For each of these items a macro is defined.
% When \emph{updating} a file, the \SVN\ keywords should be contained in
% the \emph{updated} source. Further, one has to set the \SVN property
% for keyword expansion of that file, e.g.\
% \begin{verbatim}
% svn propset svn:keywords "Id" svninfo.dtx
% \end{verbatim}
% See the \SVN\ documentation for more details.
% If the user wishes, the |\today| macro is redefined, so that it returns
% the \SVN\ date.
%
% If you want to read about the implementation, put a \% before
% |\Only|\-|Description| in the code marked with |<*driver>| in the file
% |svninfo.dtx|.
%
%\section{User Interface}
%
%\subsection{Options}
%
% Options for this package are:
%
% \begin{description}
% \item[today]
% Set the date of |\today| to the date obtained by the \SVN\ information.
% If the \Id\ string is not expanded (see below), the current date is
% used.
% \item[notoday]
% Don't use the \SVN\ date for |\today|.
% \item[fancyhdr]
% We use the \texttt{fancyhdr} package to fill the footline with
% \SVN\ information: filename, revision-number and date.
%
% If the \texttt{fancyhdr} package is not already loaded, it will be
% loaded
% by this package. To use the footnotes, put something like:\\
% \hspace*{1em}|\pagestyle{fancyplain}|\\
% \hspace*{1em}|\fancyhead[RE,LO]{\leftmark}|\\
% \hspace*{1em}|\fancyhead[LE,RO]{\thepage}|\\
% in the preamble.
% \item[nofancy]
% We don't define the footline. The
% \texttt{fancyhdr} package is not loaded.
% \item[long]
% If used together with \texttt{fancy} / \texttt{fancyhdr} the date
% string is printed in the long format
% as |\today| returns it. If \texttt{fancy} / \texttt{fancyhdr}
% is not used, nothing.
% \item[short]
% If used together with \texttt{fancy} / \texttt{fancyhdr} the date
% string is printed in the short
% format \emph{YYYY-MM-DD}.
% If \texttt{fancy} / \texttt{fancyhdr} is not used, nothing.
% \end{description}
% If the \texttt{babel} package is used, the |\today| string is language
% dependent.
%
% The default options are: \emph{today,long}. In the configuration file
% |svninfo.cfg| one of fancy heading packages may be set as a default
% option too.
%
%\subsection{Commands}
%
% \subsubsection{Defining the \SVN\ information}
%
% There is only one macro to define the information:
% |\svnInfo|\DescribeMacro{\svnInfo}.
% Since it must collaborate with \SVN\ it has an ``unusual'' calling sequence:
% The arguments are surrouned by \$.
% The following arguments are valid:\\
% \hspace*{0.5em} \SvnInfoCmd{}\\
% \hspace*{0.5em} \SvnInfoCmd{:}\\
% \hspace*{0.5em} \SvnInfoCmd{:\blank\emph{file}\blank\emph{rev}\blank\emph{YYYY-MM-DD}\blank\emph{hh:mm:ss}\blank\emph{owner}}
%
% In the first two forms, \SVN\ has not expanded the \Id\ string.
% This form will usually be used before the file is \emph{checked in}
% the first time.
%
% \emph{YYYY-MM-DD} is a date, \emph{hh:mm:ss} a time.
% Note: when you perform the \SVN\ \emph{check out} command, the \Id\ string
% is expanded by \SVN\ automatically.
%
% To take effect, |\svnInfo| must follow the |\begin{document}|.
% If you are using multiple files for a document, you could place
% |\svnInfo| at the
% beginning of each file, so the information from the current file is
% obtained (this is not valid, when translating with \LatexToHtml, see below).
%
% \subsubsection{Accessing the \SVN\ information}
% There are the following macros to access the information provided by \SVN.
% If \SVN\ has not expanded the \Id\ string, or no |\svnInfo| command is given,
% default values are returned.
%
% \begin{itemize}
% \item \DescribeMacro{\svnInfoFile} The name of the source file.
% Default: \texttt{--sourcefile--}.
% \item \DescribeMacro{\svnInfoRevision} The \SVN\ revision number, of the
% \emph{checked out} file.
% Default: \texttt{--revision--}.
% \item \DescribeMacro{\svnInfoDate} The date in the form \emph{YYYY-MM-DD},
% when the file was \emph{checked out}.
% Default: the current date.
% \item \DescribeMacro{\svnInfoTime} The time, when the file was
% \emph{checked out}.
% Default: \texttt{--time--}.
% \item \DescribeMacro{\svnInfoOwner} The user name of the file owner.
% Default: \texttt{--owner--}.
% \item \DescribeMacro{\svnInfoYear} The year \emph{YYYY} of |\svnInfoDate|.
% Default: the current year.
% \item \DescribeMacro{\svnInfoMonth} The month \emph{MM} of |\svnInfoDate|.
% Default: the current month.
% \item \DescribeMacro{\svnInfoDay} The day \emph{DD} of |\svnInfoDate|.
% Default: the current day.
% \item \DescribeMacro{\svnInfoLongDate} The date in the form of |\today|
% when the file was \emph{checked out}. This is language dependend.
% Default: the current date.
% \item \DescribeMacro{\svnId} Mimicks the behavior of the \Id\ strings, i.e.\ it
% prints a string with a summary of the above described information.
% \end{itemize}
%
% \subsection{\LatexToHtml}
%
% When converting a \LaTeX\ document to \texttt{HTML} using the
% \LatexToHtml\ tool,
% it's possible to use the \SVN\ information in the \texttt{HTML} document too.
% This functionality is offered by the extension file \texttt{svninfo.perl}
% which should be placed into the directory \texttt{LATEX2HTML/styles}.
% For more information have a look at the documentation of \LatexToHtml.
%
% An example is given in the file \texttt{svninfo2html.tex}.
%
% \noindent\underline{Notes}
% \begin{itemize}
% \item Use at least version \emph{99.1 release (March 30, 1999)} of
% \LatexToHtml.
%
% \item You should |\usepackage{html}|.
%
% \item You must run \LaTeX\ on the input file before running \LatexToHtml.
%
% \item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
% either:
% \begin{itemize}
% \item call \LatexToHtml\ with the option
% \verb|-show_section_numbers| or
% \item include the \verb|.aux| file explicitly in your \LaTeX-source, by
% adding the lines in the preamble:\\
% \verb|\begin{htmlonly}|\\
% \verb|\input{|\emph{source}\verb|.aux}|\\
% \verb|\end{htmlonly}|\\
% which requires \verb|\usepackage{html}|.
% \end{itemize}
% If you don't do so, the \verb|\svnInfo...| commands give no value.
%
% \item If using the \LatexToHtml\ tool, only the last |\svnInfo| takes
% effect, e.g.~if using several input files each having the |\svnInfo|
% command, only the vales of the last included file are used.
% (If this is a serious problem for you, drop me a mail).
%
% \item If the \verb|fancy| / \verb|fancyhdr| option is given to the
% \verb|svninfo| package,
% the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
% page is set to the \SVN\ date.
%
% \item If you would like to set your own \verb|ADDRESS| text, you should
% define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
% variable in your local \texttt{.latex2html} initialization file.
% The routine may use the \texttt{perl}
% variables shown below. Assign a reference of this procdure to the
% \texttt{perl}-variable
% \verb|$svninfo::SetAddressProc|.
% E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
% then \\
% \verb|$svninfo::SetAddressProc = &my_address_field|.
% \end{itemize}
%
% \newcommand{\Var}[1]{\texttt{\$svninfo::#1}}
% \noindent
% Here are the commands, the Perl-variables and their output:\\
% \begin{tabular}{lll}
% \LaTeX-command & \texttt{perl} variable & Result for this file \\\hline
% \verb|\today| & \texttt{\$today} & \today \\
% \verb|\svnInfoFile| & \Var{File} & \svnInfoFile \\
% \verb|\svnInfoRevision| & \Var{Revision} & \svnInfoRevision \\
% \verb|\svnInfoOwner| & \Var{Owner} & \svnInfoOwner \\
% \verb|\svnInfoDate| & \Var{Date} & \svnInfoDate \\
% \verb|\svnInfoLongDate| & \Var{LongDate} & \svnInfoLongDate \\
% \verb|\svnInfoDay| & \Var{Day} & \svnInfoDay \\
% \verb|\svnInfoMonth| & \Var{Month} & \svnInfoMonth \\
% \verb|\svnInfoYear| & \Var{Year} & \svnInfoYear \\
% \end{tabular}
%
% \section{Examples}
%
% \newcommand{\svnExample}{
% \begin{tabular}[t]{rl}
% \Cmd{svnInfoFile} & \svnInfoFile \\
% \Cmd{svnInfoRevision} & \svnInfoRevision \\
% \Cmd{svnInfoDate} & \svnInfoDate \\
% \Cmd{svnInfoTime} & \svnInfoTime \\
% \Cmd{svnInfoOwner} & \svnInfoOwner \\
% \end{tabular}
% \begin{tabular}[t]{rl}
% \Cmd{svnInfoYear} & \svnInfoYear \\
% \Cmd{svnInfoMonth} & \svnInfoMonth \\
% \Cmd{svnInfoDay} & \svnInfoDay \\
% \Cmd{svnInfoLongDate} & \svnInfoLongDate \\
% \Cmd{today} & \today \\
% \end{tabular}\\
% \Cmd{svnId} \svnId
% \bigskip
%}
%
% \svnInfo $Id$
% |\svnInfo| not expanded, no colon\\
% \verb+\svnInfo $+\verb+Id$+\\
% \svnExample
%
% \svnInfo $Id:$
% |\svnInfo| not expanded, having colon\\
% \verb+\svnInfo $+\verb+Id:$+\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
% |\svnInfo| standard version\\
% {\small\verb+\svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $+}\\
% \svnExample
%
% \svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z $
% |\svnInfo| standard version without owner\\
% {\small\verb+\svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z $+}\\
% \svnExample
%
% \svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $
% |\svnInfo| no leading \$\\
% {\footnotesize\verb+\svnInfo Id: svninfo.dtx 12 2002-04-19 12:27:55 brucker $+}\\
% \svnExample
%
% \section{Acknowledgements}
% %%%%%%%%%%%%%%%%%%%%%%%%%
% This package is directly based on \texttt{rcsinfo} from
% Dr.~J{\"u}rgen Vollmer which is distributed via the CTAN archives
% in directory '\texttt{macros/latex/contrib/rcsinfo}'. All the honour
% belongs to him, I only adopted his code to the format of the
% \verb+Id+ line subversion uses % and removed the support for
% the outdated fancyheadings package.
%
% \section{Copyright and License}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{tabular}{ll}
% Copyright (\copyright) 1995 & Dr. J{\"u}rgen Vollmer\\
% Copyright (\copyright) 2003--2005 & Achim D.~Brucker \texttt{brucker@freiburg.linux.de}\\
% \end{tabular}
%
% \noindent This program can be redistributed and/or modified under
% the terms of the \LaTeX Project Public License Distributed from CTAN
% archives in directory '\texttt{macros/latex/base/lppl.txt}'; either
% version 1 of the License, or any later version.
%
% \StopEventually{}
%
% \section{The Documentation Driver File}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The next bit of code contains the documentation driver file for
% \TeX\, i.e., the file that will produce the documentation you are
% currently reading. It will be extracted from this file by the
% \texttt{docstrip} program.
%
% If you want to read about the implementation, put a \% before
% |\OnlyDescription| in the following code.
% \begin{macrocode}
%<*driver>
\documentclass{article}
\usepackage{doc}
\usepackage{svninfo}
\OnlyDescription
\makeatletter
\if@svnInfoUseFancyhdr@
\pagestyle{fancyplain}
\if@twoside
\fancyhead[RE,LO]{\leftmark}
\fancyhead[LE,RO]{\thepage}
\else
\fancyhead[R]{\leftmark}
\fancyhead[L]{\thepage}
\fi
\fi
\makeatother
\RecordChanges
\EnableCrossrefs
\CodelineIndex
\begin{document}
\DocInput{svninfo.dtx}
\PrintChanges
\setcounter{IndexColumns}{2}
\PrintIndex
\end{document}
%</driver>
% \end{macrocode}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{The Configuration File}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% You can set up the default fancy headings package in the file
% |svninfo.cfg|.
% Use the |fancyhdr| package, by setting the default option: |fancyhdr|.
% \begin{macrocode}
%<*config>
\ExecuteOptions{fancyhdr}
%</config>
% \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \section{The Implementation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The implementation is based on cracking the \Id\ string. To support
% \LatexToHtml\ some macro definitions are written to the |.aux| file.
% These macros are the used by \LatexToHtml\ and |svninfo.perl| to extract
% the \SVN\ info.
%
% What do we need, and who we are:
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{svninfo}[2005/09/29 v0.3]
% \end{macrocode}
%
% Declare some local counters to store the \SVN\ date
% \begin{macrocode}
\newcount\@svnInfoDay
\newcount\@svnInfoMonth
\newcount\@svnInfoYear
% \end{macrocode}
% Declare some local counters to hold some temporary information
% \begin{macrocode}
\newcount\@svnInfoYearTmp
\newcount\@svnInfoMonthTmp
\newcount\@svnInfoDayTmp
% \end{macrocode}
%
% To memorize, that we want to set |\today| to the date obtained by the
% \SVN\ information.
% \begin{macrocode}
\newif\if@svnInfoToday@
% \end{macrocode}
%
% |\today| should return the date obtained by the \SVN\ information.
% \begin{macrocode}
\DeclareOption{today}{
\@svnInfoToday@true
}
% \end{macrocode}
%
% Ok we don't want do use it.
% \begin{macrocode}
\DeclareOption{notoday}{
\@svnInfoToday@false
}
% \end{macrocode}
%
% To memorize, that we want to have the the new
% \texttt{fancyhdr} footline filled with \SVN\ information.
% \begin{macrocode}
\newif\if@svnInfoUseFancyhdr@
% \end{macrocode}
%
% We want to use the \texttt{fancyhdr}
% package, and set the footline with the \SVN\ information.
% Only one option may be in effect.
% \begin{macrocode}
\DeclareOption{fancy}{
\@svnInfoUseFancyhdr@false
}
\DeclareOption{fancyhdr}{
\@svnInfoUseFancyhdr@true
}
% \end{macrocode}
%
% Ok we don't want do use it.
% \begin{macrocode}
\DeclareOption{nofancy}{
\@svnInfoUseFancyhdr@false
}
% \end{macrocode}
%
% To memorize, that we want to use the long date format.
% \begin{macrocode}
\newif\if@svnInfoLong@
% \end{macrocode}
%
% We want to use the long date format.
% \begin{macrocode}
\DeclareOption{long}{
\@svnInfoLong@true
}
% \end{macrocode}
%
% Ok we don't want do use it.
% \begin{macrocode}
\DeclareOption{short}{
\@svnInfoLong@false
}
% \end{macrocode}
%
% Use these default options,
% \begin{macrocode}
\ExecuteOptions{today,long}
% \end{macrocode}
%
% read the configuration file, to set the default fancy headings package,
% \begin{macrocode}
\IfFileExists{svninfo.cfg}{\input{svninfo.cfg}}{}
% \end{macrocode}
%
% and the process the user options.
% \begin{macrocode}
\ProcessOptions
% \end{macrocode}
% Load \texttt{fancyhdr} if neccessary.
% \begin{macrocode}
\if@svnInfoUseFancyhdr@
\RequirePackage{fancyhdr}
\fi
% \end{macrocode}
%
% If no language for the |babel| package is given in the document,
% we have to redefine |\today| (otherwise the changed |\year|, |\month| and
% |\day| won't work). In this case use the english version of |\today|.
% \begin{macrocode}
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
% \end{macrocode}
%
% We have a problem, since the number of arguments of |\svnInfo| vary from
% zero to five.
% To deal with that, we use some kind ``contuinuation passing'' style of
% programming.
% |\@svnInfoNext| contains the action to be done next.
%
% Some packages (e.g.\ the |babel|-package with the |french|-option)
% change the catcode of |:| (colon). If this happens, we have to
% undo this in order to parse the \Id\ string (which contains a colon)
% and restore its original catcode afterwards.
% This flag is used to store whether the state of the colon was changed to
% be active.
% \begin{macrocode}
\newif\if@svnInfoColonIsActive@
% \end{macrocode}
%\begin{macro}{\svnInfo}
% Extract the \SVN\ information, and give commands shown above their values.
% Check the catcode of |:| and set the flag. The restoration is done after the
% |:| has been read. Allow \_ (underscore) in file names, hence change the
% |\catcode| of it.
% \begin{macrocode}
\def\svnInfo {
\catcode`\_=13
\ifnum\catcode`\:=13
\@svnInfoColonIsActive@true
\catcode`:=12
\else
\@svnInfoColonIsActive@false
\fi
\@svnInfoReadArgs
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoReadArgs}
% First check, if the \Id\ string is not-expanded.
% Set the default values, so that for not expanded \Id\ strings, we get them.
% The \$ before |Id| may be omitted (I use this to avoid expansion of
% \$Id-Tags to be expanded by SVN in some cases).
% Restore the catcode of the |:|.
% \begin{macrocode}
\def\@svnInfoReadArgs #1Id#2 {
\@svnInfoDefaults
\if $#2 \let \@svnInfoNext = \@svnInfoEat
\else \let \@svnInfoNext = \@svnInfoEatColon
\fi
% \end{macrocode}
% |#2| contains either |$| or |:$| or |:|\blank\ hence we have read the colon
% and can restore the catode of it.
% \begin{macrocode}
\if@svnInfoColonIsActive@
\catcode`:=13
\fi
% \end{macrocode}
% Start processing the \Id\ string.
% \begin{macrocode}
\@svnInfoNext $Id#2
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoEat}
% This macro eats up its argument, i.e.\ removes it from the input.
% Reset the |\catcode| of the underscore.
% \begin{macrocode}
\def\@svnInfoEat #1 {\catcode`\_=8}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoEatColon}
% This macro eats up the colon following \texttt{Id}.
% The colon may be followed by a \$, which means that the \Id\ string is not
% expanded.
% \begin{macrocode}
\def\@svnInfoEatColon $Id:#1 {
\if $#1 \let \@svnInfoNext = \@svnInfoEat
\else \let \@svnInfoNext = \@svnInfoCrackAndEat
\fi
\@svnInfoNext #1
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoCrackAndEat}
% Take an expanded \Id\ string pass it to the crack routine
% |\@svnInfoCrack|\-|String|, which specifies what has to be done
% after it. We have already eaten the \$.
% Note: here we don't give an argument to |\@svnInfoNext|, since it is taken
% form the source, in case of |\@svnInfoEat|.
% We have to take the next 7 tokens.
% Note, first argument (\verb|#1|) contains only spaces.
% \begin{macrocode}
\def\@svnInfoCrackAndEat #1 #2 #3 #4 #5 #6 {
\@svnInfoCrackString #2 #3 #4 #5 #6
\@svnInfoNext
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@svnInfoCrackString}
% Take an expanded \Id\ string and crack it:\\
% \#1: filename, \#2 revision, \#3 date, \#4 time, \#5 owner\\
% Hence we have to consume the terminating \$ afterwards. Reset
% the |\catcode| of the underscore.
%
% If the document checked into the repository without authentication,
% the owner may be empty. In that case the argument \#5 is \$ and
% we already consumed the terminating \$.
%
% Split the date into year,month and day.
% If the option \texttt{today} is given, |\today| returns from now
% on the \SVN\ date.
%
% Write some macro definitions to the |.aux| file, to support \LatexToHtml.
% \begin{macrocode}
\def\@svnInfoCrackString #1 #2 #3 #4 #5 {
\def\svnInfoFile{#1}
\def\svnInfoRevision{#2}
\def\svnInfoTime{#4}
\if $#5 \let \@svnInfoNext = \relax
\def\svnInfoOwner{}
\def\svnId{#1\ #2\ #3\ #4}
\else \let \@svnInfoNext = \@svnInfoEat
\def\svnInfoOwner{#5}
\def\svnId{#1\ #2\ #3\ #4\ #5}
\fi
\write\@mainaux{\string\def\string\svnInfoFILE{#1}}
\write\@mainaux{\string\def\string\svnInfoREVISION{#2}}
\write\@mainaux{\string\def\string\svnInfoTIME{#4}}
\write\@mainaux{\string\def\string\svnInfoOWNER{#5}}
\catcode`\_=8
\@svnInfoSplitDate x#3x
\def\svnInfoLongDate{\@svnInfoToday}
\if@svnInfoToday@
\year = \@svnInfoYear
\month = \@svnInfoMonth
\day = \@svnInfoDay
\fi
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoSplitDate}
% This macro sets |\svnInfoYear|, |\svnInfoMonth|, and |\svnInfoDay|.
% It takes a \texttt{x}\emph{YYYY-MM-DD}\texttt{x} style of argument.
% \begin{macrocode}
\def\@svnInfoSplitDate x#1-#2-#3x{
\@svnInfoDay = #3
\@svnInfoMonth= #2
\@svnInfoYear = #1
\write\@mainaux{\string\def\string\svnInfoDAY{#3}}
\write\@mainaux{\string\def\string\svnInfoMONTH{#2}}
\write\@mainaux{\string\def\string\svnInfoYEAR{#1}}
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoToday}
% Returns the \SVN\ date in the form as |\today| does it.
% To do this, we set |\year|, |\month| and |\day| commands to the
% corresponding \SVN\ information, let |\today| does its work, i.e.\
% transforming the date into a language dependent string and reset
% |\year|, |\month| and |\day| to their previous value.
%
% \begin{macrocode}
\def\@svnInfoToday {%
\@svnInfoYearTmp = \year
\@svnInfoMonthTmp = \month
\@svnInfoDayTmp = \day
\year = \@svnInfoYear
\month = \@svnInfoMonth
\day = \@svnInfoDay
\today%
\year = \@svnInfoYearTmp
\month = \@svnInfoMonthTmp
\day = \@svnInfoDayTmp
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoDefaults}
% This macro sets the default values.
% \begin{macrocode}
\def\@svnInfoDefaults {
\@svnInfoYear = \year
\@svnInfoMonth = \month
\@svnInfoDay = \day
\def\svnInfoFile{--sourcefile--}
\def\svnInfoDate{\the\@svnInfoYear-\two@digits\@svnInfoMonth-%
\two@digits\@svnInfoDay}
\def\svnInfoTime{--time--}
\def\svnInfoRevision{--revision--}
\def\svnInfoOwner{--owner--}
\def\svnInfoYear{\the\@svnInfoYear}
\def\svnInfoMonth{\the\@svnInfoMonth}
\def\svnInfoDay{\the\@svnInfoDay}
\def\svnInfoLongDate{\@svnInfoToday}
\def\svnId{\svnInfoFile\ \svnInfoRevision\ \svnInfoTime\ \svnInfoOwner}
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@svnInfoFancyFoot}
% This defines the contents of the footline
% \begin{macrocode}
\def\@svnInfoFancyFoot {
\if@svnInfoLong@
\def\@svnInfoFancyInfo{{\footnotesize%
\emph{Rev: \svnInfoRevision,
\svnInfoLongDate}}}
\else
\def\@svnInfoFancyInfo{{\footnotesize%
\emph{Rev: \svnInfoRevision,
\svnInfoDate}}}
\fi
\def\@svnInfoFancyFile{{\footnotesize\emph{\svnInfoFile}}}
% \end{macrocode}
% and set it for the \texttt{fancyhdr} package.
% \begin{macrocode}
\if@svnInfoUseFancyhdr@
\if@twoside
\fancyfoot[LE,RO]{\@svnInfoFancyInfo}
\fancyfoot[LO,RE]{\@svnInfoFancyFile}
\fancyfoot[CO,CE]{\thepage}
\else
\fancyfoot[L,RO]{\@svnInfoFancyInfo}
\fancyfoot[LO,R]{\@svnInfoFancyFile}
\fancyfoot[C]{\thepage}
\fi
\renewcommand{\footrulewidth}{0.4pt}
\if@twoside
\fancypagestyle{plain}{%
\fancyfoot[LE,RO]{\@svnInfoFancyInfo}
\fancyfoot[LO,RE]{\@svnInfoFancyFile}
\fancyfoot[CO,CE]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}
}
\else
\fancypagestyle{plain}{%
\fancyfoot[L,RO]{\@svnInfoFancyInfo}
\fancyfoot[LO,R]{\@svnInfoFancyFile}
\fancyfoot[C]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}
}
\fi
\fi
}
% \end{macrocode}
%\end{macro}
% Initialize the defaults
% \begin{macrocode}
\@svnInfoDefaults
% \end{macrocode}
% At the start of the document, if we use the
% \texttt{fancyhdr} footline, we should set it here.
% \begin{macrocode}
\AtBeginDocument{
\if@svnInfoUseFancyhdr@
\@svnInfoFancyFoot
\fi
}
%</package>
% \end{macrocode}
% \centerline{That's the end}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \Finale
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \iffalse
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
%
% svninfo2html.tex: the example file for transforming to HTML
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%<*html>
\documentclass{article}
\IfFileExists{html.sty}{\usepackage{html}}{}
\usepackage{svninfo}
\IfFileExists{html.sty}{%
% the svninfo.perl stuff needs that the .aux file has been read!
\begin{htmlonly}%
\input{svninfo2html.aux}%
\end{htmlonly}%
}{}
\newcommand{\LatexToHtml}{\LaTeX 2\texttt{HTML}}
\newcommand{\Var}[1]{\texttt{\$svninfo::#1}}
\newcommand{\SVN}{\emph{SVN}}
\pagestyle{fancy}
\begin{document}
\svnInfo $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
\author{Achim D. Brucker\\
\small{\texttt{brucker@freiburg.linux.de}}}
\date{\today}
\title{Example for converting a \LaTeX\ document to \texttt{HTML}\\
using \LatexToHtml\ and the \texttt{svninfo}-package}
\maketitle
\section{Notes}
%%%%%%%%%%%%%%%
\begin{itemize}
\item Use at least version \emph{99.1 release (March 30, 1999)} of
\LatexToHtml.
\item You should \verb|\usepackage{html}|.
\item You must run \LaTeX\ on the input file before running \LatexToHtml.
\item In order to make \LatexToHtml\ read the \verb|.aux| file, you must
either:
\begin{itemize}
\item call \LatexToHtml\ with the option
\verb|-show_section_numbers| or
\item include the \verb|.aux| file explicitly in your \LaTeX-source, by
adding the lines in the preamble:\\
\verb|\begin{|\verb|htmlonly}|\\ % looks ulgy, but otherwise
\verb|\input{|\emph{source}\verb|.aux}|\\
\verb|\end{|\verb|htmlonly}|\\ % latex2html fails.
which requires \verb|\usepackage{html}|.
\end{itemize}
If you don't do so, the \verb|\svnInfo...| commands give no value.
\item If using the \LatexToHtml\ tool, only the last \verb|\svnInfo| takes
effect, e.g.~if using several input files each having the \verb|\svnInfo|
command, only the vales of the last included file are used.
(If this is a serious problem for you, drop me a mail).
\item If the \verb|fancy| / \verb|fancyhdr| option is given to the
\verb|svninfo| package,
the date of the \verb|ADDRESS| at the bottom of the \texttt{HTML}
page is set to the \SVN\ date.
\item If you would like to set your own \verb|ADDRESS| text, you should
define a procedure, which sets \texttt{perl} \verb|$main::ADDRESS|
variable in your local \texttt{.latex2html} initialization file.
The routine may use the \texttt{perl}
variables shown below. Assign a reference of this procdure to the
\texttt{perl}-variable
\verb|$svninfo::SetAddressProc|.
E.g.\ if you have a \texttt{perl} routine \verb|&my_address_field|,
then \\
\verb|$svninfo::SetAddressProc = &my_address_field|.
For example the follownig \texttt{perl}-code does the job:
\begin{verbatim}
sub my_address_field
{
$ADDRESS = '<hr>This file was last updated on ' .
$svninfo::Date .
' by ' .
'<a href="mailto: brucker@freiburg.linux.de">' .
'Achim D. Brucker ' .
'<brucker@freiburg.linux.de></a>';
}
$svninfo::SetAddressProc = \&my_address_field;
\end{verbatim}
\end{itemize}
\newpage
\section{Example}
%%%%%%%%%%%%%%%%%
\label{sec-examples}
Here are the commands and their output:
\begin{tabular}{lll}
\LaTeX-command & \texttt{perl} variable & Result for this file \\\hline
\verb|\today| & \texttt{\$today} & \today \\
\verb|\svnInfoFile| & \Var{File} & \svnInfoFile \\
\verb|\svnInfoRevision| & \Var{Revision} & \svnInfoRevision \\
\verb|\svnInfoOwner| & \Var{Owner} & \svnInfoOwner \\
\verb|\svnInfoDate| & \Var{Date} & \svnInfoDate \\
\verb|\svnInfoLongDate| & \Var{LongDate} & \svnInfoLongDate \\
\verb|\svnInfoDay| & \Var{Day} & \svnInfoDay \\
\verb|\svnInfoMonth| & \Var{Month} & \svnInfoMonth \\
\verb|\svnInfoYear| & \Var{Year} & \svnInfoYear \\
\end{tabular}
\end{document}
%</html>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% svninfo.ins
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*ins>
\def\batchfile{svninfo.ins}
\input docstrip.tex
\Msg{}
\Msg{***********************************************************}
\Msg{** Hello to the installation of the `svninfo' package.}
\Msg{** Version 0.3, September 29, 2005}
\Msg{***********************************************************}
\Msg{}
\generate{
\askforoverwritefalse
% \file{svninfo.ins}{\from{svninfo.dtx}{header,ins}}
\file{svninfo.sty}{\from{svninfo.dtx}{header,package}}
\file{svninfo2html.tex}{\from{svninfo.dtx}{header,html}}
\usepreamble\empty
\usepostamble\empty
\file{svninfo.perl}{\from{svninfo.dtx}{perl}}
\file{svninfo.init}{\from{svninfo.dtx}{init}}
\file{svninfo.cfg}{\from{svninfo.dtx}{header,config}}
}
\Msg{}
\Msg{***********************************************************}
\Msg{** Edit the file svninfo.cfg and set the default fancy headings package}
\Msg{** To finish the installation move the file `svninfo.sty' and}
\Msg{** svninfo.cfg to a place where LaTeX will find it.}
\Msg{** To Get the documentation: `latex svninfo.dtx'}
\Msg{** and `latex svninfo2html.dtx'}
\Msg{** If you are using LaTeX2HTML, move the PERL-package}
\Msg{** `svninfo.perl' to a place where LaTeX2HTML will find it.}
\Msg{** `svninfo.perl' is created by running `latex svninfo.dtx'.}
\Msg{** Happy TeXing}
\Msg{***********************************************************}
\Msg{}
%</ins>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% svninfo.perl
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*perl>
###############################################################################
# SVNINFO.PERL
# Copyright 1995 Dr. Juergen Vollmer <Juergen.Vollmer@acm.org>
# Copyright 2003-2005 Achim D. Brucker <brucker@freiburg.linux.de>
#
# Extension to LaTeX2HTML to translate LaTeX commands of the
# svninfo
# package to equivalent HTML commands.
#
# This is file `svninfo.perl',
# generated with the docstrip utility.
#
# The original source files were:
#
# svninfo.dtx (with options: `perl')
#
# IMPORTANT NOTICE:
#
# For the copyright see the source file.
#
# Any modified versions of this file must be renamed
# with new filenames distinct from svninfo.perl.
#
# For distribution of the original source see the terms
# for copying and modification in the file svninfo.dtx.
#
# This generated file may be distributed as long as the
# original source files, as listed above, are part of the
# same distribution. (The sources need not necessarily be
# in the same archive or directory.)
#
# $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
#
###############################################################################
package svninfo;
($Dummy1,$PackageVersionDate,$PackageVersionTime,$Dummy2) =
split (/ /,'$Date: 2005-04-08 08:18:47 +0200 (Fr, 08 Apr 2005) $');
print "\n\t svninfo style interface for LaTeX2HTML, $PackageVersionDate\n";
# set defaults options
$OptionFancy = 1;
$OptionToday = 1;
$OptionLong = 1;
# set default values
$Date = `date '+%Y/%m/%d'`;
$Time = `date '+%H:%M:%S'`;
$File = "--sourcefile--";
$Revision = "--revision--";
$Owner = "--owner--";
$Year = `date '+%Y'`;
$Month = `date '+%m'`;
$Day = `date '+%d'`;
$LongDate = $Date;
sub SetAddress
{
$main::address_data[1] = "Revision: $svninfo::Revision, $svninfo::LongDate";
# Supply your own string if you don't like the default <Name> <Date>
$main::ADDRESS = "<I>$main::address_data[0] <BR>\n$main::address_data[1]</I>";
}
if ($SetAddressProc == "") {
$SetAddressProc = \&svninfo::SetAddress;
}
sub make_cmds
{
my $cmd;
foreach $cmd (File,Revision,Date,Time,Owner,Year,Month,Day,LongDate) {
eval "sub main::do_cmd_svnInfo$cmd { "
. 'my $val = $svninfo::' . "$cmd; "
# . 'printf STDERR "\ndo_cmd_svnInfo%s=%s\n", ' . $cmd .', $val;'
. "join('',\$val,\$_[0]);"
. "}";
}
}
@GermanMonthName = ('','Januar','Februar','März','April','Mai','Juni','Juli',
'August','September','Oktober','November','Dezember');
@EnglishMonthName = ('','January','February','March','April','May','June','July',
'August','September','October','November','December');
@FrenchMonthName = ('','Janvier','Février','Mars','Avril','Mai','Juin',
'Juillet','Août','Septembre','Octobre','Novembre',
'Décembre');
###############################################################################
package main;
# handling package options
sub do_svninfo_fancyhdr { $svninfo::OptionFancy = 1; }
sub do_svninfo_fancy { $svninfo::OptionFancy = 1; }
sub do_svninfo_nofancy { $svninfo::OptionFancy = 0; }
sub do_svninfo_today { $svninfo::OptionToday = 1; }
sub do_svninfo_notoday { $svninfo::OptionToday = 0; }
sub do_svninfo_short { $svninfo::OptionLong = 0; }
sub do_svninfo_long { $svninfo::OptionLong = 1; }
# handling of LaTeX commands
sub do_cmd_svnInfo
{
local ($_) = @_;
# printf STDERR "\ndo_cmd_svnInfo\n";
# see latex2html, procedure: substitute_meta_cmds, process_body_newcommand
# the format of the variable $new_command{cmd} is:
# $new_command{$cmd} = join(':!:',$argn,$body,$opt);
# note: opt = "}" means: Flag for no optional arg
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoFILE};
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoREVISION};
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoYEAR};
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoMONTH};
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoDAY};
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoTIME};
# printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{svnInfoOWNER};
# the following assumes: LaTeX2HTML Version 99.1 release (March 30, 1999)
# may be later
my ($argn, $opt);
if (exists $new_command{svnInfoFILE}) {
($argn, $svninfo::File, $opt) = split(/:!:/, $new_command{svnInfoFILE});
} else {
$svninfo::File = $File
}
if (exists $new_command{svnInfoREVISION}) {
($argn, $svninfo::Revision, $opt) = split(/:!:/, $new_command{svnInfoREVISION});
} else {
$svninfo::Revision = $Revision
}
if (exists $new_command{svnInfoYEAR}) {
($argn, $svninfo::Year, $opt) = split(/:!:/, $new_command{svnInfoYEAR});
} else {
$svninfo::Year = $Year
}
if (exists $new_command{svnInfoMONTH}) {
($argn, $svninfo::Month, $opt) = split(/:!:/, $new_command{svnInfoMONTH});
} else {
$svninfo::Month = $Month
}
if (exists $new_command{svnInfoDAY}) {
($argn, $svninfo::Day, $opt) = split(/:!:/, $new_command{svnInfoDAY});
} else {
$svninfo::Day = $Day
}
if (exists $new_command{svnInfoTIME}) {
($argn, $svninfo::Time, $opt) = split(/:!:/, $new_command{svnInfoTIME});
} else {
$svninfo::Time = $Time
}
if (exists $new_command{svnInfoOWNER}) {
($argn, $svninfo::Owner, $opt) = split(/:!:/, $new_command{svnInfoOWNER});
} else {
$svninfo::Owner = $Owner
}
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::File;
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::Revision;
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::Year;
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::Month;
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::Day;
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::Time;
# printf STDERR "yyyyyyyyyyy `%s'\n", $svninfo::Owner;
# the following code is for oldfashioned latex2hmtl, not anymore supported
# format of $_:
# vvvvvv that's text following the SVN-Id-string
# <#nr#>.....<#nr>......
# ^ ^ ^ that's the SVN-Id-string
# my ($Nr,$IdString,$Rest) = /(<#\d+#>)(.*)\1(.*)/s ;
# The Id-String may contain various tags, remove them
# $IdString =~ s/<[^>]*>//g;
# The Id-String may contain various tags, remove them
# $IdString =~ s/<[^>]*>//g;
# split the Id-string
# my ($id,$file,$revision,$date,$time,$owner) = split(/\s/,$IdString);
# remove trailing ,v
# $file =~ s/,v$//;
# split date
# ($svninfo::Year,$svninfo::Month,$svninfo::Day) = split (/\//,$date);
# $svninfo::Revision = $revision;
# $svninfo::File = $file;
# $svninfo::Date = $date;
# $svninfo::Time = $time;
# $svninfo::Owner = $owner;
if ($default_language eq 'german' || $default_language eq 'austrian') {
$svninfo::LongDate = $svninfo::Day . '. ' .
$svninfo::GermanMonthName[$svninfo::Month] . ' ' .
$svninfo::Year;
$svnInfo::Date = $svninfo::Day . '. ' . $svninfo::Month . '. ' . $svninfo::Year;
} elsif ($default_language eq 'french') {
$svninfo::LongDate = $svninfo::Day . '. ' .
$svninfo::FrenchMonthName[$svninfo::Month] . ' ' .
$svninfo::Year;
$svnInfo::Date = $svninfo::Day . '. ' .$svninfo::Month . '. ' . $svninfo::Year;
} else { # english is the default
$svninfo::LongDate = $svninfo::EnglishMonthName[$svninfo::Month] . ' ' .
$svninfo::Day . ', ' .
$svninfo::Year;
$svnInfo::Date = $svninfo::Year . '/' .$svninfo::Month . '/' . $svninfo::Day;
}
if ($svninfo::OptionFancy == 1) {
&$svninfo::SetAddressProc;
}
svninfo::make_cmds();
# printf STDERR "xxx $HTML_VERSION, $HTML_OPTIONS\n";
# remove stuff generated for the $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $-string
# we assume that noting follows the "\svnInfo $Id....$"
if ($HTML_VERSION >= 3.2) {
/^<tex2html_verbatim_mark>[^\n]*/;
return $';
} elsif ($HTML_VERSION == 3.1 || $HTML_VERSION == 2.1) {
/^<tex2html_image_mark>[^\n]*/;
return $';
} else {
if ($HTML_OPTIONS =~ /math/) {
/^<tex2html_verbatim_mark>[^\n]*/;
return $';
} else {
/^<tex2html_image_mark>[^\n]*/;
return $';
}
}
}
# Replace do_cmd_today (\today) using the SVN date.
sub do_cmd_today {
local($today);
if ($svninfo::OptionToday == 1) {
$today = $svninfo::LongDate;
} else {
if ($default_language eq 'german' || $default_language eq 'austrian') {
$today = (`date "+%m:%d, 20%y"`);
$today =~ s/(\d{1,2}):0?(\d{1,2}),/$2. $svninfo::GermanMonthName[$1]/o;
$today =~ s/20([7|8|9]\d{1})/19$1/o;
} elsif ($default_language eq 'french') {
$today = (`date "+%m:%d, 20%y"`);
$today =~ s/(\d{1,2}):0?(\d{1,2}),/$2 $svninfo::FrenchMonthName[$1]/o;
$today =~ s/20([7|8|9]\d{1})/19$1/o;
} else { # english is the default
$today = (`date "+%m:%d, 20%y"`);
$today =~ s/(\d{1,2}):0?/$svninfo::EnglishMonthName[$1] /o;
$today =~ s/20([7|8|9]\d{1})/19$1/o;
}
}
join('',$today,$_[0]);
}
1;
###############################################################################
%</perl>
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following stuff does not show up in the documentation of the package:
% latex2html.init
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%<*init>
# This is file `svninfo.init',
# generated with the docstrip utility.
#
# The original source files were:
#
# svninfo.dtx (with options: `init')
#
# IMPORTANT NOTICE:
#
# For the copyright see the source file.
#
# Any modified versions of this file must be renamed
# with new filenames distinct from svninfo.init.
#
# For distribution of the original source see the terms
# for copying and modification in the file svninfo.dtx.
#
# This generated file may be distributed as long as the
# original source files, as listed above, are part of the
# same distribution. (The sources need not necessarily be
# in the same archive or directory.)
#
# This file should be used as initialization file for LaTeX2HTML
# when transforming svninfo2html.tex --> HTML
#
# $Id: svninfo.dtx 1168 2005-04-08 06:18:47Z brucker $
###############################################################################
sub my_address_field
{
$ADDRESS = '<hr>This file was last updated on ' .
$svninfo::Date .
' by ' .
'<a href="mailto: brucker @ freiburg.linux.de@">' .
'Achim D. Brucker ' .
'<brucker @ freiburg.linux.de></a>';
}
$svninfo::SetAddressProc = \&my_address_field;
###############################################################################
%</init>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% E N D of R C S I N F O . D T X
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\fi
|