Skip to content

Commit e2b7eea

Browse files
committed
[css2] Fixed bug that left old headers in the db if the chapter had become shorter.
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401427
1 parent 0a27e6f commit e2b7eea

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

css2/bin/Attic/addhanch

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# The files are rwritten.
44
# Arnaud Le Hors - lehors@w3.org
55
# Modifications by Bert Bos <bert@w3.org>
6-
# $Id: addhanch,v 2.0 1998-02-02 18:52:15 bbos Exp $
6+
# $Id: addhanch,v 2.1 1998-03-25 14:07:40 bbos Exp $
77

88
use Getopt::Std;
99
use lib 'bin';
@@ -162,5 +162,14 @@ $buf =~ s/<!--.*?-->(?!\s*<\/h[1-6])//sgio; # rm comments, except before </h?>
162162
# Do the real work: insert numbers and anchors
163163
$buf =~ s/(<h([1-6]).*?(?:title\s*=\s*\"(.*?)\".*?)?>)(.*?)(?:<!--(.*?)-->)?(<\/h[1-6][^>]*>)/addanchor($chap, $i++, $1, $2, $3, $4, $5, $6)/sgieo;
164164

165+
# Remove next keys, if any (may happen if the chapter has become shorter)
166+
my $file = $chapter[$chap];
167+
LOOP: while (1) {
168+
my $dbkey = "$file\t$i";
169+
last LOOP if (! $anchors{$dbkey});
170+
delete $anchors{$dbkey};
171+
$i++;
172+
}
173+
165174
writefile($output, $buf);
166175
dbmclose(%anchors);

css2/bin/addhanch

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# The files are rwritten.
44
# Arnaud Le Hors - lehors@w3.org
55
# Modifications by Bert Bos <bert@w3.org>
6-
# $Id: addhanch,v 2.0 1998-02-02 18:52:15 bbos Exp $
6+
# $Id: addhanch,v 2.1 1998-03-25 14:07:40 bbos Exp $
77

88
use Getopt::Std;
99
use lib 'bin';
@@ -162,5 +162,14 @@ $buf =~ s/<!--.*?-->(?!\s*<\/h[1-6])//sgio; # rm comments, except before </h?>
162162
# Do the real work: insert numbers and anchors
163163
$buf =~ s/(<h([1-6]).*?(?:title\s*=\s*\"(.*?)\".*?)?>)(.*?)(?:<!--(.*?)-->)?(<\/h[1-6][^>]*>)/addanchor($chap, $i++, $1, $2, $3, $4, $5, $6)/sgieo;
164164

165+
# Remove next keys, if any (may happen if the chapter has become shorter)
166+
my $file = $chapter[$chap];
167+
LOOP: while (1) {
168+
my $dbkey = "$file\t$i";
169+
last LOOP if (! $anchors{$dbkey});
170+
delete $anchors{$dbkey};
171+
$i++;
172+
}
173+
165174
writefile($output, $buf);
166175
dbmclose(%anchors);

0 commit comments

Comments
 (0)