Debian Codegraph @

texmf-dist/doc/latex/rcsinfo/rcsinfo.perl

raw
1
2 ###############################################################################
3 # RCSINFO.PERL
4 # Copyright 1995, Dr. Juergen Vollmer <[email protected]>
5 #
6 # Extension to LaTeX2HTML to translate LaTeX commands of the
7 # rcsinfo
8 # package to equivalent HTML commands.
9 #
10 # This is file `rcsinfo.perl',
11 # generated with the docstrip utility.
12 #
13 # The original source files were:
14 #
15 # rcsinfo.dtx (with options: `perl')
16 #
17 # IMPORTANT NOTICE:
18 #
19 # For the copyright see the source file.
20 #
21 # Any modified versions of this file must be renamed
22 # with new filenames distinct from rcsinfo.perl.
23 #
24 # For distribution of the original source see the terms
25 # for copying and modification in the file rcsinfo.dtx.
26 #
27 # This generated file may be distributed as long as the
28 # original source files, as listed above, are part of the
29 # same distribution. (The sources need not necessarily be
30 # in the same archive or directory.)
31 #
32 # $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $
33 #
34 ###############################################################################
35
36 package rcsinfo;
37
38 ($Dummy1,$PackageVersionDate,$PackageVersionTime,$Dummy2) =
39 split (/ /,'$Date: 2005/02/25 08:37:03 $');
40
41 print "\n\t rcsinfo style interface for LaTeX2HTML, $PackageVersionDate\n";
42
43 # set defaults options
44 $OptionFancy = 1;
45 $OptionToday = 1;
46 $OptionLong = 1;
47
48 # set default values
49 $Date = `date '+%Y/%m/%d'`;
50 $Time = `date '+%H:%M:%S'`;
51 $File = "--sourcefile--";
52 $Revision = "--revision--";
53 $Owner = "--owner--";
54 $Status = "--status--";
55 $Locker = "--locker--";
56 $Year = `date '+%Y'`;
57 $Month = `date '+%m'`;
58 $Day = `date '+%d'`;
59 $LongDate = $Date;
60
61 sub SetAddress
62 {
63 $main::address_data[1] = "Revision: $rcsinfo::Revision, $rcsinfo::LongDate";
64 # Supply your own string if you don't like the default <Name> <Date>
65 $main::ADDRESS = "<I>$main::address_data[0] <BR>\n$main::address_data[1]</I>";
66 }
67 if ($SetAddressProc == "") {
68 $SetAddressProc = \&rcsinfo::SetAddress;
69 }
70 sub make_cmds
71 {
72 my $cmd;
73 foreach $cmd (File,Revision,Date,Time,Owner,Status,Locker,Year,Month,Day,LongDate) {
74 eval "sub main::do_cmd_rcsInfo$cmd { "
75 . 'my $val = $rcsinfo::' . "$cmd; "
76 # . 'printf STDERR "\ndo_cmd_rcsInfo%s=%s\n", ' . $cmd .', $val;'
77 . "join('',\$val,\$_[0]);"
78 . "}";
79 }
80 }
81
82 @GermanMonthName = ('','Januar','Februar','M&auml;rz','April','Mai','Juni','Juli',
83 'August','September','Oktober','November','Dezember');
84 @EnglishMonthName = ('','January','February','March','April','May','June','July',
85 'August','September','October','November','December');
86 @FrenchMonthName = ('','Janvier','F&eacute;vrier','Mars','Avril','Mai','Juin',
87 'Juillet','Ao&ucirc;t','Septembre','Octobre','Novembre',
88 'D&eacute;cembre');
89
90 ###############################################################################
91
92 package main;
93
94 # handling package options
95 sub do_rcsinfo_fancyhdr { $rcsinfo::OptionFancy = 1; }
96 sub do_rcsinfo_fancy { $rcsinfo::OptionFancy = 1; }
97 sub do_rcsinfo_nofancy { $rcsinfo::OptionFancy = 0; }
98 sub do_rcsinfo_today { $rcsinfo::OptionToday = 1; }
99 sub do_rcsinfo_notoday { $rcsinfo::OptionToday = 0; }
100 sub do_rcsinfo_short { $rcsinfo::OptionLong = 0; }
101 sub do_rcsinfo_long { $rcsinfo::OptionLong = 1; }
102 sub do_rcsinfo_datehyphen { } # nothing just ignore it
103
104 # handling of LaTeX commands
105 sub do_cmd_rcsInfo
106 {
107
108 local ($_) = @_;
109
110 # printf STDERR "\ndo_cmd_rcsInfo\n";
111
112 # see latex2html, procedure: substitute_meta_cmds, process_body_newcommand
113 # the format of the variable $new_command{cmd} is:
114 # $new_command{$cmd} = join(':!:',$argn,$body,$opt);
115 # note: opt = "}" means: Flag for no optional arg
116 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoFILE};
117 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoREVISION};
118 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoYEAR};
119 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoMONTH};
120 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoDAY};
121 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoTIME};
122 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoOWNER};
123 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoSTATUS};
124 # printf STDERR "xxxxxxxxxxx `%s'\n", $new_command{rcsInfoLOCKER};
125
126 # the following assumes: LaTeX2HTML Version 99.1 release (March 30, 1999)
127 # may be later
128 my ($argn, $opt);
129 if (exists $new_command{rcsInfoFILE}) {
130 ($argn, $rcsinfo::File, $opt) = split(/:!:/, $new_command{rcsInfoFILE});
131 } else {
132 $rcsinfo::File = $File
133 }
134 if (exists $new_command{rcsInfoREVISION}) {
135 ($argn, $rcsinfo::Revision, $opt) = split(/:!:/, $new_command{rcsInfoREVISION});
136 } else {
137 $rcsinfo::Revision = $Revision
138 }
139 if (exists $new_command{rcsInfoYEAR}) {
140 ($argn, $rcsinfo::Year, $opt) = split(/:!:/, $new_command{rcsInfoYEAR});
141 } else {
142 $rcsinfo::Year = $Year
143 }
144 if (exists $new_command{rcsInfoMONTH}) {
145 ($argn, $rcsinfo::Month, $opt) = split(/:!:/, $new_command{rcsInfoMONTH});
146 } else {
147 $rcsinfo::Month = $Month
148 }
149 if (exists $new_command{rcsInfoDAY}) {
150 ($argn, $rcsinfo::Day, $opt) = split(/:!:/, $new_command{rcsInfoDAY});
151 } else {
152 $rcsinfo::Day = $Day
153 }
154 if (exists $new_command{rcsInfoTIME}) {
155 ($argn, $rcsinfo::Time, $opt) = split(/:!:/, $new_command{rcsInfoTIME});
156 } else {
157 $rcsinfo::Time = $Time
158 }
159 if (exists $new_command{rcsInfoOWNER}) {
160 ($argn, $rcsinfo::Owner, $opt) = split(/:!:/, $new_command{rcsInfoOWNER});
161 } else {
162 $rcsinfo::Owner = $Owner
163 }
164 if (exists $new_command{rcsInfoSTATUS}) {
165 ($argn, $rcsinfo::Status, $opt) = split(/:!:/, $new_command{rcsInfoSTATUS});
166 } else {
167 $rcsinfo::Status = $Status
168 }
169 if (exists $new_command{rcsInfoLOCKER}) {
170 ($argn, $rcsinfo::Locker, $opt) = split(/:!:/, $new_command{rcsInfoLOCKER});
171 } else {
172 $rcsinfo::Locker = $Locker
173 }
174
175 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::File;
176 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Revision;
177 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Year;
178 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Month;
179 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Day;
180 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Time;
181 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Owner;
182 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Status;
183 # printf STDERR "yyyyyyyyyyy `%s'\n", $rcsinfo::Locker;
184
185 # the following code is for oldfashioned latex2hmtl, not anymore supported
186 # format of $_:
187 # vvvvvv that's text following the RCS-Id-string
188 # <#nr#>.....<#nr>......
189 # ^ ^ ^ that's the RCS-Id-string
190 # my ($Nr,$IdString,$Rest) = /(<#\d+#>)(.*)\1(.*)/s ;
191
192 # The Id-String may contain various tags, remove them
193 # $IdString =~ s/<[^>]*>//g;
194
195 # The Id-String may contain various tags, remove them
196 # $IdString =~ s/<[^>]*>//g;
197
198 # split the Id-string
199 # my ($id,$file,$revision,$date,$time,$owner,$status,$locker) = split(/\s/,$IdString);
200
201 # remove trailing ,v
202 # $file =~ s/,v$//;
203
204 # split date
205 # ($rcsinfo::Year,$rcsinfo::Month,$rcsinfo::Day) = split (/[\-]//,$date);
206
207 # $rcsinfo::Revision = $revision;
208 # $rcsinfo::File = $file;
209 # $rcsinfo::Date = $date;
210 # $rcsinfo::Time = $time;
211 # $rcsinfo::Owner = $owner;
212 # $rcsinfo::Status = $status;
213 # $rcsinfo::Locker = $locker;
214
215 if ($default_language eq 'german' || $default_language eq 'austrian') {
216 $rcsinfo::LongDate = $rcsinfo::Day . '.&nbsp;' .
217 $rcsinfo::GermanMonthName[$rcsinfo::Month] . '&nbsp;' .
218 $rcsinfo::Year;
219 $rcsInfo::Date = $rcsinfo::Day . '.&nbsp;' . $rcsinfo::Month . '.&nbsp;' . $rcsinfo::Year;
220 } elsif ($default_language eq 'french') {
221 $rcsinfo::LongDate = $rcsinfo::Day . '.&nbsp;' .
222 $rcsinfo::FrenchMonthName[$rcsinfo::Month] . '&nbsp;' .
223 $rcsinfo::Year;
224 $rcsInfo::Date = $rcsinfo::Day . '.&nbsp;' .$rcsinfo::Month . '.&nbsp;' . $rcsinfo::Year;
225 } else { # english is the default
226 $rcsinfo::LongDate = $rcsinfo::EnglishMonthName[$rcsinfo::Month] . '&nbsp;' .
227 $rcsinfo::Day . ',&nbsp;' .
228 $rcsinfo::Year;
229 $rcsInfo::Date = $rcsinfo::Year . '/' .$rcsinfo::Month . '/' . $rcsinfo::Day;
230 }
231
232 if ($rcsinfo::OptionFancy == 1) {
233 &$rcsinfo::SetAddressProc;
234 }
235 rcsinfo::make_cmds();
236
237 # printf STDERR "xxx $HTML_VERSION, $HTML_OPTIONS\n";
238 # remove stuff generated for the $Id: rcsinfo.dtx,v 1.7 2005/02/25 08:37:03 vollmer draft vollmer $-string
239 # we assume that noting follows the "\rcsInfo $Id....$"
240 if ($HTML_VERSION >= 3.2) {
241 /^<tex2html_verbatim_mark>[^\n]*/;
242 return $';
243 } elsif ($HTML_VERSION == 3.1 || $HTML_VERSION == 2.1) {
244 /^<tex2html_image_mark>[^\n]*/;
245 return $';
246 } else {
247 if ($HTML_OPTIONS =~ /math/) {
248 /^<tex2html_verbatim_mark>[^\n]*/;
249 return $';
250 } else {
251 /^<tex2html_image_mark>[^\n]*/;
252 return $';
253 }
254 }
255 }
256
257 # Replace do_cmd_today (\today) using the RCS date.
258 sub do_cmd_today {
259 local($today);
260 if ($rcsinfo::OptionToday == 1) {
261 $today = $rcsinfo::LongDate;
262 } else {
263 if ($default_language eq 'german' || $default_language eq 'austrian') {
264 $today = (`date "+%m:%d, 20%y"`);
265 $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2. $rcsinfo::GermanMonthName[$1]/o;
266 $today =~ s/20([7|8|9]\d{1})/19$1/o;
267 } elsif ($default_language eq 'french') {
268 $today = (`date "+%m:%d, 20%y"`);
269 $today =~ s/(\d{1,2}):0?(\d{1,2}),/$2 $rcsinfo::FrenchMonthName[$1]/o;
270 $today =~ s/20([7|8|9]\d{1})/19$1/o;
271 } else { # english is the default
272 $today = (`date "+%m:%d, 20%y"`);
273 $today =~ s/(\d{1,2}):0?/$rcsinfo::EnglishMonthName[$1] /o;
274 $today =~ s/20([7|8|9]\d{1})/19$1/o;
275 }
276 }
277 join('',$today,$_[0]);
278 }
279
280 1;
281
282 ###############################################################################