Changeset 460c1e1 in git for doc/doc2tex.pl
- Timestamp:
- Jul 19, 1999, 2:06:33 PM (24 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- b00a82cbecb96fbd56a19be975fa94c5c6ee3016
- Parents:
- a204eaabfd4864b4c4e333658414701e14bee58f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/doc2tex.pl
ra204ea r460c1e1 1 1 #!/usr/local/bin/perl 2 # $Id: doc2tex.pl,v 1. 8 1999-07-17 14:49:10obachman Exp $2 # $Id: doc2tex.pl,v 1.9 1999-07-19 12:06:13 obachman Exp $ 3 3 ################################################################### 4 4 # Computer Algebra System SINGULAR … … 319 319 { 320 320 s/^\@c\s*include\s+([^\s]+)\s/$1/; 321 s/\s*$//; 321 322 unless (&Open(*INC, "<$_")) 322 323 { … … 407 408 sub HandleLib 408 409 { 409 local($lib, $lib_name, $ltex_file, $l_ex, $l_fun );410 local($lib, $lib_name, $ltex_file, $l_ex, $l_fun, $no_node, $section); 410 411 my ($func); 411 412 … … 426 427 $l_fun = 1 if (($lib_fun || (/lib_fun/)) && !/no_fun/); 427 428 $l_ex = 1 if (($lib_ex || /lib_ex/) && !/no_ex/ && $l_fun); 428 429 if (/(\w+)section/) 430 { 431 $section = $1. 'section'; 432 } 433 else 434 { 435 $section = "subsection"; 436 } 429 437 $ltex_file = "$doc_subdir/$lib"."_lib"; 430 438 unless ($l_ex) … … 555 563 print LDOC " ".$procs[$i-1] if ($i > 0); 556 564 print LDOC ", " . $lib ."_lib\n"; 557 print LDOC "\@ subsection " . $procs[$i] . "\n";565 print LDOC "\@$section " . $procs[$i] . "\n"; 558 566 print LDOC "\@cindex ". $procs[$i] . "\n"; 559 567 560 568 print LDOC "\@c ---content $procs[$i]---\n"; 561 569 print LDOC "Procedure from library \@code{$lib.lib} (\@pxref{${lib}_lib}).\n\n"; 562 print LDOC "\@table \@asis\n"; 563 $table_is_open = 1; 564 # print help 565 $ref = OutInfo(\*LDOC, $help{$procs[$i]}); 566 print LDOC "\@end table\n"; 567 $table_is_open = 0; 570 if ($help{$procs[$i]} =~ /^\@/) 571 { 572 print LDOC $help{$procs[$i]}; 573 $ref = ''; 574 } 575 else 576 { 577 print LDOC "\@table \@asis\n"; 578 $table_is_open = 1; 579 # print help 580 $ref = OutInfo(\*LDOC, $help{$procs[$i]}); 581 print LDOC "\@end table\n"; 582 } 568 583 # print example 569 584 if ($example = &CleanUpExample($lib, $example{$procs[$i]})) … … 600 615 my ($FH, $info, $l_fun) = @_; 601 616 print $FH "\@c ---content LibInfo---\n"; 617 if ($info =~ /^\@/) 618 { 619 print $FH $info; 620 return; 621 } 602 622 print $FH "\@table \@asis\n"; 603 623 $table_is_open = 1; … … 614 634 { 615 635 my ($FH, $info, $l_fun) = @_; 636 if ($info =~ /^\@/) 637 { 638 print $FH $info; 639 return; 640 } 616 641 $info =~ s/^\s*//; 617 642 $info =~ s/\s*$//; … … 654 679 { 655 680 $line = $1; 681 # break line if 656 682 $text .= '@*' 657 if ($line =~ /\w/ && $pline =~ /\w/ && 658 ((length($pline) < 60) || $line =~ /^\s*\w*\(.*?\)/)); 683 if ($line =~ /\w/ && $pline =~ /\w/ # line and prev line are not empty 684 && $line !~ /^\s*\@\*/ # line does not start with @* 685 && $pline !~ /\@\*\s*/ # prev line does not end with @* 686 && 687 ((length($pline) < 60 && # prev line is shorter than 60 chars 688 $pline !~ /\@code{.*?}/ # and does not contain @code, @math 689 && $pline !~ /\@math{.*?}/) 690 || 691 $line =~ /^\s*\w*\(.*?\)/ # $line starts with \w*(..) 692 || 693 $pline =~ /^\s*\w*\(.*?\)[\s;:]*$/)); # prev line is only \w(..) 659 694 $line =~ s/\s*$//; 660 695 $text .= "$line\n"; … … 667 702 s/\s*$//g; 668 703 s/ +/ /g; # replace double whitespaces by one 704 s/(\w+\(.*?\))/\@code{$1}/g; 669 705 s/\@\*\s*/\@\*/g; 670 706 s/(\@[^\*])/\@$1/g; # escape @ signs, except @* 671 s/{/\@{/g; 707 s/{/\@{/g; # escape {} 672 708 s/}/\@}/g; 709 # unprotect @@math@{@}, @code@{@} 710 s/\@\@math\@{(.*?)\@}/\@math{$1}/g; 711 s/\@\@code\@{(.*?)\@}/\@code{$1}/g; 673 712 } 674 713 … … 753 792 # just print the text 754 793 FormatInfoText(length($item) + 1); 755 # if functions are in text, then make it in code756 s/(\w+\(.*?\))/\@code{$1}/g757 if ($item =~ /usage/i || $item =~ /Return/i);758 759 794 print $FH "$_\n"; 760 795 } … … 787 822 $refs =~ s/^\s*//; 788 823 $refs =~ s/\s*$//; 789 my @refs = split (/[\s,]+/, $refs); 824 $refs =~ s/\n/,/g; 825 my @refs = split (/[,;\.]+/, $refs); 790 826 my $ref; 791 827 … … 795 831 for $ref (@refs) 796 832 { 797 print $FH ", \@ref{$ref}"; 833 $ref =~ s/^\s*//; 834 $ref =~ s/\s*$//; 835 print $FH ", \@ref{$ref}" if ($ref =~ /\w/); 798 836 } 799 837 print $FH "\n\@c ref\n";
Note: See TracChangeset
for help on using the changeset viewer.