From f7685d79e26417e6f7fe0ed337548f58a61950b8 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Sat, 25 Jul 1998 03:31:46 +0000 Subject: [PATCH] Fix up the synopsis table stuff so it gets things right at each chapter, instead of stringing it all together. Yay! --- Doc/perl/python.perl | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 7af19094705..107ed54d5f0 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -867,19 +867,25 @@ sub do_cmd_maketitle { require SynopsisTable; -$MY_CHAPTER_COUNTER = 0; - -sub get_chapter_id{ - return $MY_CHAPTER_COUNTER; +sub get_chapter_id(){ + my $id = do_cmd_thechapter(''); + $id =~ s/(\d+)<\/SPAN>\./\1/; + return $id; } -sub get_synopsis_table{ - my $chap = @_; +%ModuleSynopses = ('chapter' => 'SynopsisTable instance'); + +sub get_synopsis_table($){ + my($chap) = @_; my $st = $ModuleSynopses{$chap}; - if (!$st) { - $st = SynopsisTable->new(); - $ModuleSynopses{$chap} = $st; + my $key; + foreach $key (keys %ModuleSynopses) { + if ($key eq $chap) { + return $ModuleSynopses{$chap}; + } } + $st = SynopsisTable->new(); + $ModuleSynopses{$chap} = $st; return $st; } @@ -907,17 +913,17 @@ sub do_cmd_modulesynopsis{ sub do_cmd_localmoduletable{ local($_) = @_; - $MY_CHAPTER_COUNTER = $MY_CHAPTER_COUNTER + 1; my $chap = get_chapter_id(); "<$chap>" . $_; } sub process_all_localmoduletables{ while (/<(\d+)>/) { + my $match = $&; my $chap = $1; my $st = get_synopsis_table($chap); my $data = $st->tohtml(); - s/$&/$data/; + s/$match/$data/; } }