[Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.81,1.82

Fred L. Drake python-dev@python.org
Fri, 8 Sep 2000 23:07:40 -0700


Update of /cvsroot/python/python/dist/src/Doc/perl
In directory slayer.i.sourceforge.net:/tmp/cvs-serv18448/perl

Modified Files:
	python.perl 
Log Message:

Add support for new \pep, \seepep, excclassdesc markup.

Update processing of module synopsis tables (found at the beginning of
most chapters of the library reference) to reflect changes in the 
processing pattern of recent versions LaTeX2HMTL.  Requires most
recent change to SynopsisTable.pm.

This does not fix the module index problem.



Index: python.perl
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -r1.81 -r1.82
*** python.perl	2000/08/31 06:22:54	1.81
--- python.perl	2000/09/09 06:07:37	1.82
***************
*** 239,242 ****
--- 239,259 ----
  }
  
+ sub get_pep_url{
+     my $rfcnum = sprintf("%04d", @_[0]);
+     return "http://python.sourceforge.net/peps/pep-$rfcnum.html";
+ }
+ 
+ sub do_cmd_pep{
+     local($_) = @_;
+     my $rfcnumber = next_argument();
+     my $id = "rfcref-" . ++$global{'max_id'};
+     my $href = get_pep_url($rfcnumber);
+     # Save the reference
+     my $nstr = gen_index_id("Python Enhancement Proposals!PEP $rfcnumber", '');
+     $index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
+     return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">PEP $rfcnumber</a>"
+             . $_);
+ }
+ 
  sub get_rfc_url{
      my $rfcnum = sprintf("%04d", @_[0]);
***************
*** 815,829 ****
  
  
! sub do_env_classdesc{
!     local($_) = @_;
      $THIS_CLASS = next_argument();
      my $arg_list = next_argument();
      $idx = make_str_index_entry(
! 		"<tt class='class'>$THIS_CLASS</tt> (class in $THIS_MODULE)" );
      $idx =~ s/ \(.*\)//;
      return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
  }
  
  
  sub do_env_methoddesc{
      local($_) = @_;
--- 832,854 ----
  
  
! sub handle_classlike_descriptor{
!     local($_, $what) = @_;
      $THIS_CLASS = next_argument();
      my $arg_list = next_argument();
      $idx = make_str_index_entry(
! 		"<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" );
      $idx =~ s/ \(.*\)//;
      return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
  }
  
+ sub do_env_classdesc{
+     return handle_classlike_descriptor(@_[0], "class");
+ }
+ 
+ sub do_env_excclassdesc{
+     return handle_classlike_descriptor(@_[0], "exception");
+ }
  
+ 
  sub do_env_methoddesc{
      local($_) = @_;
***************
*** 1270,1278 ****
  }
  
! %ModuleSynopses = ('chapter' => 'SynopsisTable instance');
  
  sub get_synopsis_table($){
      my($chap) = @_;
-     my $st = $ModuleSynopses{$chap};
      my $key;
      foreach $key (keys %ModuleSynopses) {
--- 1295,1303 ----
  }
  
! # 'chapter' => 'SynopsisTable instance'
! %ModuleSynopses = ();
  
  sub get_synopsis_table($){
      my($chap) = @_;
      my $key;
      foreach $key (keys %ModuleSynopses) {
***************
*** 1281,1285 ****
  	}
      }
!     $st = SynopsisTable->new();
      $ModuleSynopses{$chap} = $st;
      return $st;
--- 1306,1310 ----
  	}
      }
!     my $st = SynopsisTable->new();
      $ModuleSynopses{$chap} = $st;
      return $st;
***************
*** 1324,1331 ****
--- 1349,1379 ----
      local($_) = @_;
      my $chap = get_chapter_id();
+     my $st = get_synopsis_table($chap);
+     $st->set_file("$CURRENT_FILE");
      return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_;
  }
  
  sub process_all_localmoduletables{
+     my $key;
+     my $st, $file;
+     foreach $key (keys %ModuleSynopses) {
+         $st = $ModuleSynopses{$key};
+         $file = $st->get_file();
+         if ($file) {
+             process_localmoduletables_in_file($file);
+         }
+         else {
+             print "\nsynopsis table $key has no file association";
+         }
+     }
+ }
+ 
+ sub process_localmoduletables_in_file{
+     my $file = @_[0];
+     open(MYFILE, "<$file");
+     local($_);
+     sysread(MYFILE, $_, 1024*1024);
+     close(MYFILE);
+     # need to get contents of file in $_
      while (/<tex2html-localmoduletable><(\d+)>/) {
  	my $match = $&;
***************
*** 1335,1338 ****
--- 1383,1389 ----
  	s/$match/$data/;
      }
+     open(MYFILE,">$file");
+     print MYFILE $_;
+     close(MYFILE);
  }
  sub process_python_state{
***************
*** 1372,1377 ****
  }
  
! sub do_cmd_seerfc{
!     local($_) = @_;
      my $rfcnum = next_argument();
      my $title = next_argument();
--- 1423,1428 ----
  }
  
! sub handle_rfclike_reference{
!     local($_, $what) = @_;
      my $rfcnum = next_argument();
      my $title = next_argument();
***************
*** 1381,1387 ****
        . "\n    <dt><a href=\"$url\""
        . "\n        title=\"$title\""
!       . "\n        >RFC $rfcnum, <em>$title</em></a>:"
        . "\n    <dd>$text\n  </dl>"
        . $_;
  }
  
--- 1432,1446 ----
        . "\n    <dt><a href=\"$url\""
        . "\n        title=\"$title\""
!       . "\n        >$what $rfcnum, <em>$title</em></a>:"
        . "\n    <dd>$text\n  </dl>"
        . $_;
+ }
+ 
+ sub do_cmd_seepep{
+     return handle_rfclike_reference(@_[0], "PEP");
+ }
+ 
+ sub do_cmd_seerfc{
+     return handle_rfclike_reference(@_[0], "RFC");
  }