The R Project SVN R

Rev

Rev 5136 | Rev 6124 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5136 Rev 6098
Line 12... Line 12...
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
# General Public License for more details.
13
# General Public License for more details.
14
#
14
#
15
# A copy of the GNU General Public License is available via WWW at
15
# A copy of the GNU General Public License is available via WWW at
16
# http://www.gnu.org/copyleft/gpl.html.  You can also obtain it by
16
# http://www.gnu.org/copyleft/gpl.html.  You can also obtain it by
17
# writing to the Free Software Foundation, Inc., 675 Mass Ave,
17
# writing to the Free Software Foundation, Inc., 59 Temple Place,
18
# Cambridge, MA 02139, USA.
18
# Suite 330, Boston, MA  02111-1307  USA.
19
 
19
 
20
# Send any bug reports to Friedrich.Leisch@ci.tuwien.ac.at
20
# Send any bug reports to Friedrich.Leisch@ci.tuwien.ac.at
21
 
21
 
22
 
22
 
23
use Cwd;
23
use Cwd;
Line 238... Line 238...
238
	print htmlfile "$key</A><TD>";
238
	print htmlfile "$key</A><TD>";
239
	print htmlfile $htmltitles{$key};
239
	print htmlfile $htmltitles{$key};
240
    }
240
    }
241
 
241
 
242
    print htmlfile "</TABLE>\n";
242
    print htmlfile "</TABLE>\n";
243
    print htmlfile "</BODY>\n";
243
    print htmlfile "</BODY></HTML>\n";
244
 
244
 
245
    close htmlfile;
245
    close htmlfile;
246
}
246
}
247
 
247
 
248
 
248
 
Line 259... Line 259...
259
 
259
 
260
    open title, "<../TITLE";
260
    open title, "<../TITLE";
261
#    open out, ">$dest/TITLE";
261
#    open out, ">$dest/TITLE";
262
    $title = <title>;
262
    $title = <title>;
263
#    print out "$title";
263
#    print out "$title";
264
#    close title;
264
    close title;
265
    close out;
265
#    close out;
266
    $title =~ s/^\S*\s*(.*)/$1/;
266
    $title =~ s/^\S*\s*(.*)/$1/;
267
 
267
 
268
    mkdir "$dest/help", $dir_mod || die "Could not create $dest/help: $!\n";
268
    mkdir "$dest/help", $dir_mod || die "Could not create $dest/help: $!\n";
269
    mkdir "$dest/html", $dir_mod || die "Could not create $dest/html: $!\n";
269
    mkdir "$dest/html", $dir_mod || die "Could not create $dest/html: $!\n";
270
 
270
 
Line 276... Line 276...
276
 
276
 
277
    foreach $manfile (@mandir) {
277
    foreach $manfile (@mandir) {
278
	if($manfile =~ /\.Rd$/i){
278
	if($manfile =~ /\.Rd$/i){
279
 
279
 
280
	    my $rdname = basename($manfile, (".Rd", ".rd"));
280
	    my $rdname = basename($manfile, (".Rd", ".rd"));
281
 
281
	    
282
	    if($opt_dosnames){
282
	    if($opt_dosnames){
283
		    $manfilebase = "x" . (1000 + $nmanfiles++);
283
		    $manfilebase = "x" . (1000 + $nmanfiles++);
284
	    }else{
284
	    }else{
285
		$manfilebase = $rdname;
285
		$manfilebase = $rdname;
286
	    }
286
	    }
287
 
287
 
288
	    open(rdfile, "<$manfile");
288
	    open(rdfile, "<$manfile");
289
	    undef $text;
289
	    undef $text;
290
	    while(<rdfile>){ $text .= $_;}
290
	    while(<rdfile>){  # skip comment lines
-
 
291
		if(!/^%/) { $text .= $_; }
-
 
292
	    }
291
	    close rdfile;
293
	    close rdfile;
292
	    $text =~ /\\title\{\s*([^\}]+)\s*\}/s;
294
	    $text =~ /\\title\{\s*([^\}]+)\s*\}/s;
293
	    my $rdtitle = $1;
295
	    my $rdtitle = $1;
294
	    $rdtitle =~ s/\n/ /sg;
296
	    $rdtitle =~ s/\n/ /sg;
-
 
297
	    $rdtitle =~ s/\\R/R/g; # don't use \R in titles
295
 
298
 
296
	    $filenm{$rdname} = $manfilebase;
299
	    $filenm{$rdname} = $manfilebase;
-
 
300
	    $title2file{$rdtitle} = $manfilebase;
297
 
301
 
298
	    while($text =~ s/\\(alias|name)\{\s*([^\}]+)\s*\}//){
302
	    while($text =~ s/\\(alias|name)\{\s*([^\}]+)\s*\}//){
299
		$alias = $2;
303
		$alias = $2;
300
		$alias =~ s/\\%/%/g;
304
		$alias =~ s/\\%/%/g;
301
		$alltitles{$alias} = $rdtitle;
305
		$alltitles{$alias} = $rdtitle;
Line 315... Line 319...
315
 
319
 
316
 
320
 
317
    open(anindex, "<$anindex");
321
    open(anindex, "<$anindex");
318
    open(titleindex, ">$lib/$pkg/help/00Titles");
322
    open(titleindex, ">$lib/$pkg/help/00Titles");
319
    open(htmlfile, ">$lib/$pkg/html/00Index.$HTML");
323
    open(htmlfile, ">$lib/$pkg/html/00Index.$HTML");
-
 
324
    if($opt_chm) {open(chmfile, ">$chmdir/00Index.$HTML");}
320
 
325
 
321
    print htmlfile html_pagehead("$title", "../../../doc/html",
326
    print htmlfile html_pagehead("$title", "../../../doc/html",
322
				 "../../../doc/html/index.$HTML", "Top",
327
				 "../../../doc/html/index.$HTML", "Top",
323
				 "../../../doc/html/packages.$HTML",
328
				 "../../../doc/html/packages.$HTML",
324
				 "Package List");
329
				 "Package List");
325
 
330
 
-
 
331
    if($opt_chm) {print chmfile chm_pagehead("$title");}
-
 
332
 
326
 
333
 
327
    if($naliases>100){
334
    if($naliases>100){
328
       print htmlfile html_alphabet();
335
	print htmlfile html_alphabet();
-
 
336
	if($opt_chm) {print chmfile html_alphabet();}
329
   }
337
   }
330
 
338
 
331
    print htmlfile "\n<p>\n<table width=100%>\n";
339
    print htmlfile "\n<p>\n<table width=\"100%\">\n";
-
 
340
    if($opt_chm) {print chmfile "\n<p>\n<table width=\"100%\">\n";}
332
 
341
 
333
    my $firstletter = "";
342
    my $firstletter = "";
334
    while(<anindex>){ 
343
    while(<anindex>){ 
335
        chomp;  ($alias, $file) = split /\t/; 
344
        chomp;  ($alias, $file) = split /\t/; 
336
        $aliasfirst = uc substr($alias, 0, 1); 
345
        $aliasfirst = uc substr($alias, 0, 1);
337
        if(($aliasfirst ne $firstletter) && 
346
	if($aliasfirst lt "A") { $aliasfirst = ""; }
338
	   ($aliasfirst =~ /[A-Z]/) &&
347
	if($aliasfirst gt "Z") { $aliasfirst = "misc"; }
339
	   ($naliases>100)){
348
	if( ($naliases > 100) && ($aliasfirst ne $firstletter) ) {
340
	    print htmlfile "</table>\n";
349
	    print htmlfile "</table>\n";
-
 
350
	    print htmlfile html_title2("<a name=\"$aliasfirst\">-- $aliasfirst --</a>");
341
	    print htmlfile "<a name=\"$aliasfirst\">\n";
351
	    print htmlfile "<table width=\"100%\">\n";
-
 
352
	    if($opt_chm) {
-
 
353
		print chmfile "</table>\n";
342
	    print htmlfile html_title2("-- $aliasfirst --");
354
		print chmfile html_title2("<a name=\"$aliasfirst\">-- $aliasfirst --</a>");
343
	    print htmlfile "<table width=100%>\n";
355
		print chmfile "<table width=\"100%\">\n";
-
 
356
	    }
344
	    $firstletter = $aliasfirst;
357
	    $firstletter = $aliasfirst;
345
	}
358
	}
346
	print titleindex "$alias\t$alltitles{$alias}\n";
359
	print titleindex "$alias\t$alltitles{$alias}\n";
-
 
360
	$htmlalias = $alias;
-
 
361
	$htmlalias =~ s/</&lt;/go;
-
 
362
	$htmlalias =~ s/>/&gt;/go;
347
	print htmlfile "<TR><TD width=25%><A HREF=\"$file.$HTML\">" .
363
	print htmlfile "<TR><TD width=\"25%\"><A HREF=\"$file.$HTML\">" .
348
	    "$alias</A></TD>\n<TD>$alltitles{$alias}</TD></TR>\n";
364
	    "$htmlalias</A></TD>\n<TD>$alltitles{$alias}</TD></TR>\n";
-
 
365
	if($opt_chm) {
-
 
366
	    print chmfile "<TR><TD width=\"25%\"><A HREF=\"$file.$HTML\">" .
-
 
367
		"$htmlalias</A></TD>\n<TD>$alltitles{$alias}</TD></TR>\n";}
349
    }
368
    }
350
 
369
 
351
    print htmlfile "</TABLE>\n";
370
    print htmlfile "</TABLE>\n";
352
    print htmlfile "</BODY>\n";
371
    print htmlfile "</BODY></HTML>\n";
-
 
372
    if($opt_chm) {print chmfile "</table>\n</body></HTML>\n";}
353
 
373
 
354
    close titleindex;
374
    close titleindex;
355
    close htmlfile;
375
    close htmlfile;
-
 
376
    if($opt_chm) {close chmfile;}
356
    close anindex;
377
    close anindex;
357
 
378
 
358
    build_htmlpkglist($lib);
379
    build_htmlpkglist($lib);
359
}
380
}
360
 
381
 
Line 373... Line 394...
373
				 "packages.$HTML", "Packages");
394
				 "packages.$HTML", "Packages");
374
 
395
 
375
    print htmlfile html_alphabet();
396
    print htmlfile html_alphabet();
376
 
397
 
377
    print htmlfile html_title2("-- Operators, Global Variables, ... --");
398
    print htmlfile html_title2("-- Operators, Global Variables, ... --");
378
    print htmlfile "\n<p>\n<table width=100%>\n";
399
    print htmlfile "\n<p>\n<table width=\"100%\">\n";
379
    foreach $alias (sort foldorder keys %htmltitles) {
400
    foreach $alias (sort foldorder keys %htmltitles) {
380
	print htmlfile "<TR><TD width=25%>" .
401
	print htmlfile "<TR><TD width=\"25%\">" .
381
	    "<A HREF=\"../../library/$htmlindex{$alias}\">" .
402
	    "<A HREF=\"../../library/$htmlindex{$alias}\">" .
382
	    "$alias</A></TD>\n<TD>$htmltitles{$alias}</TD></TR>\n"
403
	    "$alias</A></TD>\n<TD>$htmltitles{$alias}</TD></TR>\n"
383
		unless $alias =~ /^[a-zA-Z]/;
404
		unless $alias =~ /^[a-zA-Z]/;
384
    }
405
    }
385
    print htmlfile "\n</table>\n<p>\n<table width=100%>\n";
406
    print htmlfile "\n</table>\n<p>\n<table width=\"100%\">\n";
386
 
407
 
387
    my $firstletter = "";
408
    my $firstletter = "";
388
    foreach $alias (sort foldorder keys %htmltitles) {
409
    foreach $alias (sort foldorder keys %htmltitles) {
389
	$aliasfirst = uc substr($alias, 0, 1);
410
	$aliasfirst = uc substr($alias, 0, 1);
390
	if($aliasfirst =~ /[A-Z]/){
411
	if($aliasfirst =~ /[A-Z]/){
391
	    if($aliasfirst ne $firstletter){
412
	    if($aliasfirst ne $firstletter){
392
		print htmlfile "</table>\n";
413
		print htmlfile "</table>\n";
393
		print htmlfile "<a name=\"" . uc $aliasfirst . "\">\n";
414
		print htmlfile "<a name=\"" . uc $aliasfirst . "\">\n";
394
		print htmlfile html_title2("-- " . uc $aliasfirst . " --");
415
		print htmlfile html_title2("-- " . uc $aliasfirst . " --");
395
		print htmlfile "<table width=100%>\n";
416
		print htmlfile "<table width=\"100%\">\n";
396
		$firstletter = $aliasfirst;
417
		$firstletter = $aliasfirst;
397
	    }
418
	    }
398
	    print htmlfile "<TR><TD width=25%>" .
419
	    print htmlfile "<TR><TD width=\"25%\">" .
399
		"<A HREF=\"../../library/$htmlindex{$alias}\">" .
420
		"<A HREF=\"../../library/$htmlindex{$alias}\">" .
400
		    "$alias</A></TD>\n<TD>$htmltitles{$alias}</TD></TR>\n";
421
		    "$alias</A></TD>\n<TD>$htmltitles{$alias}</TD></TR>\n";
401
	}
422
	}
402
    }
423
    }
403
 
424
 
Line 411... Line 432...
411
    my($file, $age) = @_;
432
    my($file, $age) = @_;
412
    #- return ``true'' if file exists and is older than $age
433
    #- return ``true'' if file exists and is older than $age
413
    (! ((-f $file) && ((-M $file) < $age)))
434
    (! ((-f $file) && ((-M $file) < $age)))
414
}
435
}
415
 
436
 
-
 
437
sub build_chm_toc {
-
 
438
    open tocfile, ">../chm/$pkg.toc" 
-
 
439
	|| die "Couldn't open the chm toc file";
-
 
440
    print tocfile
-
 
441
	"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n",
-
 
442
	"<HEAD></HEAD><HTML><BODY>\n<UL>\n";
-
 
443
    print tocfile
-
 
444
	"<LI> <OBJECT type=\"text/sitemap\">\n",
-
 
445
	"<param name=\"Name\" value=\"Package $pkg:  Contents\">\n",
-
 
446
	"<param name=\"Local\" value=\"00Index.html\">\n",
-
 
447
	"</OBJECT>\n";
-
 
448
    print tocfile
-
 
449
	"<LI> <OBJECT type=\"text/sitemap\">\n",
-
 
450
	"<param name=\"Name\" value=\"Package $pkg:  R objects\">\n",
-
 
451
	"</OBJECT>\n";
-
 
452
    print tocfile "<UL>\n";   # contents of a book
-
 
453
    foreach $alias (sort foldorder keys %aliasnm) {
-
 
454
	print tocfile
-
 
455
	    "<LI> <OBJECT type=\"text/sitemap\">\n",
-
 
456
	    "<param name=\"Name\" value=\"$alias\">\n",
-
 
457
	    "<param name=\"Local\" value=\"$aliasnm{$alias}.html\">\n",
-
 
458
	    "</OBJECT>\n";
-
 
459
    }
-
 
460
    print tocfile "</UL>\n";  # end of a book
-
 
461
    print tocfile
-
 
462
	"<LI> <OBJECT type=\"text/sitemap\">\n",
-
 
463
	"<param name=\"Name\" value=\"Package $pkg:  Titles\">\n",
-
 
464
	"</OBJECT>\n";
-
 
465
    print tocfile "<UL>\n";   # contents of a book
-
 
466
    foreach $title (sort foldorder keys %title2file) {
-
 
467
	print tocfile
-
 
468
	    "<LI> <OBJECT type=\"text/sitemap\">\n",
-
 
469
	    "<param name=\"Name\" value=\"$title\">\n",
-
 
470
	    "<param name=\"Local\" value=\"$title2file{$title}.html\">\n",
-
 
471
	    "</OBJECT>\n";
-
 
472
    }
-
 
473
    print tocfile "</UL>\n";  # end of a book
-
 
474
    print tocfile "</UL>\n</BODY></HTML>\n";
-
 
475
    close tocfile;
-
 
476
}
-
 
477
 
416
1;
478
1;
417
# Local variables: **
479
# Local variables: **
418
# perl-indent-level: 4 **
480
# perl-indent-level: 4 **
419
# cperl-indent-level: 4 **
481
# cperl-indent-level: 4 **
420
# End: **
482
# End: **