The R Project SVN R

Rev

Rev 31770 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31770 Rev 34091
Line 328... Line 328...
328
my $nextskipping = 0;
328
my $nextskipping = 0;
329
my $text = "";
329
my $text = "";
330
my $fun;
330
my $fun;
331
my $InArgs = 0;
331
my $InArgs = 0;
332
 
332
 
-
 
333
my $nalias = 0;
-
 
334
my $nexamples = 0;
-
 
335
 
333
sub doS4 {
336
sub doS4 {
334
  foreach $_ (@lines) {
337
  foreach $_ (@lines) {
335
    # skip header
338
    # skip header
336
    if (/^<!doctype/) {
339
    if (/^<!doctype/) {
337
      $skipping = 1;
340
      $skipping = 1;
Line 347... Line 350...
347
    $skipping = $nextskipping;
350
    $skipping = $nextskipping;
348
  }
351
  }
349
 
352
 
350
  ($type, $text, $rest) = get_group($text); # s-function-doc or whatever
353
  ($type, $text, $rest) = get_group($text); # s-function-doc or whatever
351
  if($type ne "function-doc" && $type ne "method-doc") {
354
  if($type ne "function-doc" && $type ne "method-doc") {
352
    die "Document class `s-$type' is not supported";
355
    die "Document class 's-$type' is not supported";
353
  }
356
  }
354
 
357
 
355
  chomp $text;
358
  chomp $text;
356
 
359
 
357
  while(length($text) > 0) {
360
  while(length($text) > 0) {
Line 375... Line 378...
375
    $tt =~ s/([a-zA-Z-]+).*/$1/;
378
    $tt =~ s/([a-zA-Z-]+).*/$1/;
376
    if($text =~ /^\s*<s-\Q$type\E>(.*?)<\/s-$tt>(.*)/s) {
379
    if($text =~ /^\s*<s-\Q$type\E>(.*?)<\/s-$tt>(.*)/s) {
377
	$body = $1;
380
	$body = $1;
378
	$rest = $2;
381
	$rest = $2;
379
    } else { 
382
    } else { 
380
	warn "no match for `s-$tt'";
383
	warn "no match for 's-$tt'";
381
	$text =~ /^\s*<s-\Q$type\E>\s*(.*)/s;
384
	$text =~ /^\s*<s-\Q$type\E>\s*(.*)/s;
382
	$body = $1;
385
	$body = $1;
383
	$rest = "";
386
	$rest = "";
384
    }
387
    }
385
    ($type, $body, $rest);
388
    ($type, $body, $rest);
Line 513... Line 516...
513
 
516
 
514
    } elsif ($type eq "keywords") {
517
    } elsif ($type eq "keywords") {
515
	process_sub_groups($text, "keyword");
518
	process_sub_groups($text, "keyword");
516
 
519
 
517
    } else {
520
    } else {
518
	warn "unknown SGML entity `$type'";
521
	warn "unknown SGML entity '$type'";
519
	print "%type:\n%$text\n";
522
	print "%type:\n%$text\n";
520
    }
523
    }
521
}
524
}
522
 
525
 
523
sub process_sub_groups{
526
sub process_sub_groups {
-
 
527
  
524
    my $text = $_[0];
528
    my $text = $_[0];
525
    my $topic = $_[1];
529
    my $topic = $_[1];
526
 
530
 
527
    while(length($text) > 0) {
531
    while(length($text) > 0) {
528
	($type, $body, $text) = get_group($text);
532
	($type, $body, $text) = get_group($text);
529
	die "invalid subgroup" unless $type =~ /^$topic/;
533
	die "invalid subgroup" unless $type =~ /^$topic/;
530
	process_sub_group($type, $body);
534
	process_sub_group($type, $body);
531
    }
535
    }
532
}
536
}
533
 
537
 
534
sub process_sub_group{
538
sub process_sub_group {
-
 
539
  
535
    my $topic = $_[0];
540
    my $topic = $_[0];
536
    my $text = $_[1];
541
    my $text = $_[1];
537
    my $nalias = 0;
-
 
538
    my $example = 0;
-
 
539
 
542
 
540
    $text =~ s/^\n*//;
543
    $text =~ s/^\n*//;
541
    $text =~ s/\n*$//;
544
    $text =~ s/\n*$//;
542
    if ($type eq "topic") {
545
    if ($type eq "topic") {
543
	 $text =~ s/^\s*//; $text =~ s/\s*$//;
546
	 $text =~ s/^\s*//; $text =~ s/\s*$//;
Line 560... Line 563...
560
	$name =~ s/\s*\"(.*?)\"/$1/o;
563
	$name =~ s/\s*\"(.*?)\"/$1/o;
561
	$name =~ s/\s*(\w*)\s*/$1/o;
564
	$name =~ s/\s*(\w*)\s*/$1/o;
562
	$name =~ s/\.\.\./\\dots/;
565
	$name =~ s/\.\.\./\\dots/;
563
	print "\\item{$name}{\n", sub4($text), "\n}\n";	
566
	print "\\item{$name}{\n", sub4($text), "\n}\n";	
564
    } else {
567
    } else {
565
	warn "unknown SGML entity `$type'";
568
	warn "unknown SGML entity '$type'";
566
	print "%type:\n%$text\n";
569
	print "%type:\n%$text\n";
567
    }
570
    }
568
}
571
}
569
 
572
 
570
sub inref {
573
sub inref {