From 643d76d735726352dd40433b663d48617e27e200 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Sat, 9 Sep 2000 06:07:37 +0000 Subject: [PATCH] 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. --- Doc/perl/python.perl | 77 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 5c31e804f3d..f457715596c 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -238,6 +238,23 @@ sub do_cmd_manpage{ return "$page($section)" . $_; } +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 ("PEP $rfcnumber" + . $_); +} + sub get_rfc_url{ my $rfcnum = sprintf("%04d", @_[0]); return "http://www.ietf.org/rfc/rfc$rfcnum.txt"; @@ -814,16 +831,24 @@ sub do_env_excdesc{ sub do_env_fulllineitems{ return do_env_itemize(@_); } -sub do_env_classdesc{ - local($_) = @_; +sub handle_classlike_descriptor{ + local($_, $what) = @_; $THIS_CLASS = next_argument(); my $arg_list = next_argument(); $idx = make_str_index_entry( - "$THIS_CLASS (class in $THIS_MODULE)" ); + "$THIS_CLASS ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; return "
$idx ($arg_list)\n
" . $_ . '
'; } +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($_) = @_; @@ -1269,18 +1294,18 @@ sub get_chapter_id(){ return $id; } -%ModuleSynopses = ('chapter' => 'SynopsisTable instance'); +# 'chapter' => 'SynopsisTable instance' +%ModuleSynopses = (); sub get_synopsis_table($){ my($chap) = @_; - my $st = $ModuleSynopses{$chap}; my $key; foreach $key (keys %ModuleSynopses) { if ($key eq $chap) { return $ModuleSynopses{$chap}; } } - $st = SynopsisTable->new(); + my $st = SynopsisTable->new(); $ModuleSynopses{$chap} = $st; return $st; } @@ -1323,10 +1348,33 @@ sub do_cmd_modulesynopsis{ sub do_cmd_localmoduletable{ local($_) = @_; my $chap = get_chapter_id(); + my $st = get_synopsis_table($chap); + $st->set_file("$CURRENT_FILE"); return "<$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 (/<(\d+)>/) { my $match = $&; my $chap = $1; @@ -1334,6 +1382,9 @@ sub process_all_localmoduletables{ my $data = $st->tohtml(); s/$match/$data/; } + open(MYFILE,">$file"); + print MYFILE $_; + close(MYFILE); } sub process_python_state{ process_all_localmoduletables(); @@ -1371,8 +1422,8 @@ sub do_cmd_seemodule{ . $_; } -sub do_cmd_seerfc{ - local($_) = @_; +sub handle_rfclike_reference{ + local($_, $what) = @_; my $rfcnum = next_argument(); my $title = next_argument(); my $text = next_argument(); @@ -1380,11 +1431,19 @@ sub do_cmd_seerfc{ return '
' . "\n
RFC $rfcnum, $title:" + . "\n >$what $rfcnum, $title:" . "\n
$text\n
" . $_; } +sub do_cmd_seepep{ + return handle_rfclike_reference(@_[0], "PEP"); +} + +sub do_cmd_seerfc{ + return handle_rfclike_reference(@_[0], "RFC"); +} + sub do_cmd_seeurl{ local($_) = @_; my $url = next_argument();