Changeset 460c1e1 in git for doc/doc2tex.pl


Ignore:
Timestamp:
Jul 19, 1999, 2:06:33 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
b00a82cbecb96fbd56a19be975fa94c5c6ee3016
Parents:
a204eaabfd4864b4c4e333658414701e14bee58f
Message:
* increased version 1o 1-3-4
* parsing of help strings by doc2tex
* much better texi2html
* new directory layout for install in source tree


git-svn-id: file:///usr/local/Singular/svn/trunk@3292 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/doc2tex.pl

    ra204ea r460c1e1  
    11#!/usr/local/bin/perl
    2 # $Id: doc2tex.pl,v 1.8 1999-07-17 14:49:10 obachman Exp $
     2# $Id: doc2tex.pl,v 1.9 1999-07-19 12:06:13 obachman Exp $
    33###################################################################
    44#  Computer Algebra System SINGULAR
     
    319319{
    320320  s/^\@c\s*include\s+([^\s]+)\s/$1/;
     321  s/\s*$//;
    321322  unless (&Open(*INC, "<$_"))
    322323  {
     
    407408sub HandleLib
    408409{
    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);
    410411  my ($func);
    411412
     
    426427  $l_fun = 1 if (($lib_fun || (/lib_fun/)) && !/no_fun/);
    427428  $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  }
    429437  $ltex_file = "$doc_subdir/$lib"."_lib";
    430438  unless ($l_ex)
     
    555563        print LDOC " ".$procs[$i-1] if ($i > 0);
    556564        print LDOC ", " . $lib ."_lib\n";
    557         print LDOC "\@subsection " . $procs[$i] . "\n";
     565        print LDOC "\@$section " . $procs[$i] . "\n";
    558566        print LDOC "\@cindex ". $procs[$i] . "\n";
    559567
    560568        print LDOC "\@c ---content $procs[$i]---\n";
    561569        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        }
    568583        # print example
    569584        if ($example = &CleanUpExample($lib, $example{$procs[$i]}))
     
    600615  my ($FH, $info, $l_fun) = @_;
    601616  print $FH "\@c ---content LibInfo---\n";
     617    if ($info =~ /^\@/)
     618  {
     619    print $FH $info;
     620    return;
     621  }
    602622  print $FH "\@table \@asis\n";
    603623  $table_is_open = 1;
     
    614634{
    615635  my ($FH, $info, $l_fun) = @_;
     636  if ($info =~ /^\@/)
     637  {
     638    print $FH $info;
     639    return;
     640  }
    616641  $info =~ s/^\s*//;
    617642  $info =~ s/\s*$//;
     
    654679    {
    655680      $line = $1;
     681      # break line if
    656682      $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(..)
    659694      $line =~ s/\s*$//;
    660695      $text .= "$line\n";
     
    667702  s/\s*$//g;
    668703  s/ +/ /g;  # replace double whitespaces by one
     704  s/(\w+\(.*?\))/\@code{$1}/g;
    669705  s/\@\*\s*/\@\*/g;
    670706  s/(\@[^\*])/\@$1/g; # escape @ signs, except @*
    671   s/{/\@{/g;
     707  s/{/\@{/g; # escape {}
    672708  s/}/\@}/g;
     709  # unprotect @@math@{@}, @code@{@}
     710  s/\@\@math\@{(.*?)\@}/\@math{$1}/g;
     711  s/\@\@code\@{(.*?)\@}/\@code{$1}/g;
    673712}
    674713
     
    753792    # just print the text
    754793    FormatInfoText(length($item) + 1);
    755     # if functions are in text, then make it in code
    756     s/(\w+\(.*?\))/\@code{$1}/g
    757       if ($item =~ /usage/i || $item =~ /Return/i);
    758 
    759794    print $FH "$_\n";
    760795  }
     
    787822  $refs =~ s/^\s*//;
    788823  $refs =~ s/\s*$//;
    789   my @refs = split (/[\s,]+/, $refs);
     824  $refs =~ s/\n/,/g;
     825  my @refs = split (/[,;\.]+/, $refs);
    790826  my $ref;
    791827
     
    795831  for $ref (@refs)
    796832  {
    797     print $FH ", \@ref{$ref}";
     833    $ref =~ s/^\s*//;
     834    $ref =~ s/\s*$//;
     835    print $FH ", \@ref{$ref}"  if ($ref =~ /\w/);
    798836  }
    799837  print $FH "\n\@c ref\n";
Note: See TracChangeset for help on using the changeset viewer.