Changeset 609ba11 in git for doc/doc2tex.pl
- Timestamp:
- Jul 9, 1999, 4:12:59 PM (24 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 34fbd934a748fec8c0dcc9325052eddde20bd10e
- Parents:
- 63374c2a45ce7f0660de1047f95a58b4d23d5055
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/doc2tex.pl
r63374c r609ba11 1 1 #!/usr/local/bin/perl 2 # $Id: doc2tex.pl,v 1. 4 1999-07-07 16:38:34obachman Exp $2 # $Id: doc2tex.pl,v 1.5 1999-07-09 14:12:47 obachman Exp $ 3 3 ################################################################### 4 4 # Computer Algebra System SINGULAR … … 292 292 # break after $ex_length characters 293 293 $to_do = $_; 294 while (length($to_do) > $ex_length )294 while (length($to_do) > $ex_length && $to_do =~ /\w/) 295 295 { 296 296 $done .= substr($to_do, 0, $ex_length)."\\\n "; … … 570 570 { 571 571 print LDOC "\@strong{Example:}\n"; 572 print LDOC "\@ example\n\@c example\n";572 print LDOC "\@smallexample\n\@c example\n"; 573 573 print LDOC $example; 574 print LDOC "\n\@c example\n\@end example\n";574 print LDOC "\n\@c example\n\@end smallexample\n"; 575 575 } 576 576 OutRef(\*LDOC, $ref) if $ref; … … 639 639 sub FormatInfoText 640 640 { 641 s/^\s*//; # remove whitespaces from beginning and end 642 s/\s*$//; 643 s/ +/ /g; # replace double whitespeces by one 644 &protect_texi; # protect texinfo special chars 645 s/\n/\n\@*/g; # replace newline by forced newline 641 my $length = shift; 642 $length = 0 unless $length; 643 # insert @* infront of all lines whose previous line is shorter than 644 # 60 characters 645 $_ = ' ' x $length . $_; 646 if (/^(.*)\n/) 647 { 648 $_ .= "\n"; 649 my $pline; 650 my $line; 651 my $ptext = $_; 652 my $text = ''; 653 while ($ptext =~ /(.*)\n/g) 654 { 655 $line = $1; 656 $text .= '@*' 657 if ($line =~ /\w/ && $pline =~ /\w/ && 658 ((length($pline) < 60) || $line =~ /^\s*\w\(.*?\)/)); 659 $line =~ s/\s*$//; 660 $text .= "$line\n"; 661 $pline = $line; 662 } 663 $_ = $text; 664 } 665 s/\t/ /g; 666 s/\n +/\n/g; 667 s/\s*$//g; 668 s/ +/ /g; # replace double whitespaces by one 669 s/\@\*\s*/\@\*/g; 670 s/(\@[^\*])/\@$1/g; # escape @ signs, except @* 671 s/{/\@{/g; 672 s/}/\@}/g; 646 673 } 647 674 … … 678 705 if ($l_fun) 679 706 { 680 print $FH "\@strong{$item }\n\@menu\n";707 print $FH "\@strong{$item:}\n\@menu\n"; 681 708 } 682 709 else 683 710 { 684 print $FH "\@item \@strong{$item }\n\@table \@asis\n";711 print $FH "\@item \@strong{$item:}\n\@table \@asis\n"; 685 712 } 686 713 while ($text =~ /(.*\n)/g) … … 725 752 { 726 753 # just print the text 727 &FormatInfoText;754 FormatInfoText(length($item) + 1); 728 755 # if functions are in text, then make it in code 729 756 s/(\w+\(.*?\))/\@code{$1}/g … … 741 768 s/^[;\s]*//; 742 769 s/\n/ /g; 743 &FormatInfoText;770 FormatInfoText(); 744 771 745 772 if ($l_fun) … … 790 817 # erase EXAMPLE, echo and pause statements 791 818 $example =~ s/"EXAMPLE.*"[^;]*;//g; 792 $example =~ s/echo[^;\n]*;//g; 793 $example =~ s/pause\(.*?\)[^;]*;//g; 819 $example .= "\n"; 820 my ($mexample, $line); 821 while ($example =~ m/(.*)\n/g) 822 { 823 $line = $1; 824 $line =~ s|echo[^;]*;||g if $line !~ m|(.*)//(.*)echo[^;]*;|; 825 $line =~ s|pause\(.*?\)[^;]*;||g if $line !~ m|(.*)//(.*)pause\(.*?\)[^;]*;|; 826 $mexample .= "$line\n"; 827 } 828 $example = $mexample; 794 829 795 830 # prepend LIB command
Note: See TracChangeset
for help on using the changeset viewer.