Skip to content

Commit e85e108

Browse files
committed
[css2] Bug fixes
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%40521
1 parent 823bc1f commit e85e108

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

css2/bin/Attic/mksubtoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# sub TOC builder
33
#
44
# Arnaud Le Hors - lehors@w3.org
5-
# $Id: mksubtoc,v 1.5 1997-12-09 15:16:00 ian Exp $
5+
# $Id: mksubtoc,v 1.6 1997-12-11 00:13:45 ijacobs Exp $
66

77
$startlvl = 0;
88
$maxlvl = 0;
@@ -93,9 +93,11 @@ while (/$file;(.*?);([0-9]*);([1-9A-Z].*?);(.*?)\n/sig) {
9393
$anchor = $4;
9494
if ($h > $startlvl && ($maxlvl == 0 || $h <= $maxlvl)) {
9595
ol($h);
96-
# If there's an anchor, reuse it.
96+
# If there's an anchor, it has a name attr (by mktoc).
97+
# Reuse it (and rename name -> href everywhere)
9798
if ($t =~ /<a[^>]+>/si) {
98-
$t =~ s/name=\"?.*?$anchor\"?/href=\"#$anchor\"/isg;
99+
$t =~ s/name\s*=\s*\"[^#]*?(#[^"]*?)\"/href=\"\1\"/isg;
100+
$t =~ s/name\s*=\s*[^#]*?(#[^\s>]*?)/href=\"\1\"/isg;
99101
print OUTPUT "<li>$t\n";
100102
} else {
101103
if ($h > 1) {

css2/bin/Attic/mktoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# 1. Some header - and its related comment
66
#
77
# Arnaud Le Hors - lehors@w3.org
8-
# $Id: mktoc,v 1.13 1997-12-09 00:08:46 ijacobs Exp $
8+
# $Id: mktoc,v 1.14 1997-12-11 00:13:46 ijacobs Exp $
99

1010
if (($_ = $ARGV[0], /^-l/) && $ARGV[0]) {
1111
shift;
@@ -163,9 +163,11 @@ LOOP: foreach $file (@ARGV) {
163163
$hasanchor = t;
164164
# let's reuse it
165165
$anch = $&;
166-
if ($anch =~ /name=(?:\"([^\"]+)\"|([^ \n\t>]+))/sig) {
166+
if ($anch =~ /name\s*=\s*(?:\"([^\"]+)\"|([^\s>]+))/sig) {
167+
#Only one of two will match.
167168
$anchor = "$1$2";
168-
$txt =~ s/name=\"?$anchor\"?/href=\"$hfil#$anchor\"/isg;
169+
$txt =~ s/name\s*=\s*\"$anchor\"/href=\"$hfil#$anchor\"/isg;
170+
$txt =~ s/name\s*=\s*$anchor\s/href=\"$hfil#$anchor\"\s/isg;
169171
}
170172
} else {
171173
$anchor = "h-$num";

css2/bin/mksubtoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# sub TOC builder
33
#
44
# Arnaud Le Hors - lehors@w3.org
5-
# $Id: mksubtoc,v 1.5 1997-12-09 15:16:00 ian Exp $
5+
# $Id: mksubtoc,v 1.6 1997-12-11 00:13:45 ijacobs Exp $
66

77
$startlvl = 0;
88
$maxlvl = 0;
@@ -93,9 +93,11 @@ while (/$file;(.*?);([0-9]*);([1-9A-Z].*?);(.*?)\n/sig) {
9393
$anchor = $4;
9494
if ($h > $startlvl && ($maxlvl == 0 || $h <= $maxlvl)) {
9595
ol($h);
96-
# If there's an anchor, reuse it.
96+
# If there's an anchor, it has a name attr (by mktoc).
97+
# Reuse it (and rename name -> href everywhere)
9798
if ($t =~ /<a[^>]+>/si) {
98-
$t =~ s/name=\"?.*?$anchor\"?/href=\"#$anchor\"/isg;
99+
$t =~ s/name\s*=\s*\"[^#]*?(#[^"]*?)\"/href=\"\1\"/isg;
100+
$t =~ s/name\s*=\s*[^#]*?(#[^\s>]*?)/href=\"\1\"/isg;
99101
print OUTPUT "<li>$t\n";
100102
} else {
101103
if ($h > 1) {

css2/bin/mktoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# 1. Some header - and its related comment
66
#
77
# Arnaud Le Hors - lehors@w3.org
8-
# $Id: mktoc,v 1.13 1997-12-09 00:08:46 ijacobs Exp $
8+
# $Id: mktoc,v 1.14 1997-12-11 00:13:46 ijacobs Exp $
99

1010
if (($_ = $ARGV[0], /^-l/) && $ARGV[0]) {
1111
shift;
@@ -163,9 +163,11 @@ LOOP: foreach $file (@ARGV) {
163163
$hasanchor = t;
164164
# let's reuse it
165165
$anch = $&;
166-
if ($anch =~ /name=(?:\"([^\"]+)\"|([^ \n\t>]+))/sig) {
166+
if ($anch =~ /name\s*=\s*(?:\"([^\"]+)\"|([^\s>]+))/sig) {
167+
#Only one of two will match.
167168
$anchor = "$1$2";
168-
$txt =~ s/name=\"?$anchor\"?/href=\"$hfil#$anchor\"/isg;
169+
$txt =~ s/name\s*=\s*\"$anchor\"/href=\"$hfil#$anchor\"/isg;
170+
$txt =~ s/name\s*=\s*$anchor\s/href=\"$hfil#$anchor\"\s/isg;
169171
}
170172
} else {
171173
$anchor = "h-$num";

0 commit comments

Comments
 (0)