FFFF [CSS2] readd old pre-2016 anchors · w3c/csswg-drafts@b11694e · GitHub
Skip to content

Commit b11694e

Browse files
committed
[CSS2] readd old pre-2016 anchors
See #2551; these anchors were changed in the 2016 republication of CSS 2.1 as a result of 914790f. This commit undoes that, and adds the 2016 anchors as a second wrapper element.
1 parent c83bd8a commit b11694e

26 files changed

Lines changed: 98 additions & 87 deletions

css2/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</div>
2525
<hr class="navbar">
2626

27-
<H1><a name="q1.0">1 About the CSS&nbsp;2.2 Specification</a></H1>
27+
<H1><span id="q1.0"><a name="q0">1 About the CSS&nbsp;2.2 Specification</a></span></H1>
2828
<div class="subtoc">
2929
<p><strong>Contents</strong>
3030
<ul class="toc">

css2/aural.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</div>
2525
<hr class="navbar">
2626

27-
<H1><a name="q19.0">Appendix A. Aural style sheets</a></H1>
27+
<H1><span id="q19.0"><a name="q0">Appendix A. Aural style sheets</a></span></H1>
2828
<div class="subtoc">
2929
<p><strong>Contents</strong>
3030
<ul class="toc">

css2/bin/addhanch

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,19 @@ sub cleanup {
8585
# Generate a new header that includes the number and the target anchor
8686
sub addanchor {
8787
my ($chapno, $seqno, $stag, $lvl, $title, $content, $cmt, $etag) = @_;
88-
my ($anchor, $anchor1, $txt, $i);
88+
my ($anchor, $anchor1, $anchor2016, $txt, $i);
8989
my $file = $chapter[$chapno];
9090

9191
# Generate the anchor
9292
if ($content =~ /<a\s+[^>]*?name\s*=\s*(?:([^\s\">]+)|\"([^\"]+)\"|\'([^\']+)\')/io) { # Reuse first anchor in header.
9393
$anchor = "$1$2$3"; # Only one of $1, $2, $3 will match.
9494
$anchor1 = "#$anchor";
9595
} else {
96-
$anchor = "q$chapno.$seqno"; # Use simple sequence number
96+
$anchor = "q$seqno"; # Use simple sequence number
97+
$anchor2016 = "q$chapno.$seqno"; # 2016 anchors
9798
$anchor1 = "#$anchor";
9899
}
99-
# $anchor1 = "" if ($lvl == 1); # if H1, just go to the top of the page
100+
$anchor1 = "" if ($lvl == 1); # if H1, just go to the top of the page
100101

101102
# Increment the count, reset higher level counts
102103
$counts[$lvl]++;
@@ -121,12 +122,22 @@ sub addanchor {
121122
if ($content =~ /<a\s+[^>]*?name\s*=/sio) {
122123
# Don't add anchors if there is already an anchor
123124
return "$stag$num $content$etag";
124-
} elsif ($content =~ /<a\b/sio) {
125-
# There is an A tag, insert anchor before it
126-
return "$stag<a name=\"$anchor\">$num $`</a>$&$'$etag";
127125
} else {
128-
# There is no A tag, enclose whole content
129-
return "$stag<a name=\"$anchor\">$num $content</a>$etag";
126+
my ($anchor_start, $anchor_end);
127+
if (defined $anchor2016) {
128+
$anchor_start = "<span id=\"$anchor2016\"><a name=\"$anchor\">";
129+
$anchor_end = "</a></span>";
130+
} else {
131+
$anchor_start = "<a name=\"$anchor\">";
132+
$anchor_end = "</a>";
133+
}
134+
if ($content =~ /<a\b/sio) {
135+
# There is an A tag, insert anchor before it
136+
return "$stag$anchor_start$num $`$anchor_end$&$'$etag";
137+
} else {
138+
# There is no A tag, enclose whole content
139+
return "$stag$anchor_start$num $content$anchor_end$etag";
140+
}
130141
}
131142
}
132143

css2/cascade.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<hr class="navbar">
2525

2626

27-
<h1><a name="q6.0">6 Assigning property values, Cascading, and Inheritance</a></h1>
27+
<h1><span id="q6.0"><a name="q0">6 Assigning property values, Cascading, and Inheritance</a></span></h1>
2828
<div class="subtoc">
2929
<p><strong>Contents</strong>
3030
<ul class="toc">

css2/changes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</div>
2424
<hr class="navbar">
2525

26-
<H1><a name="q21.0">Appendix C. Changes</a></H1>
26+
<H1><span id="q21.0"><a name="q0">Appendix C. Changes</a></span></H1>
2727
<!-- warning -->
2828

2929
<!-- /warning -->

css2/colors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</div>
3232
<hr class="navbar">
< D576 /td>
3333

34-
<h1><a name="q14.0">14 Colors and Backgrounds</a></h1>
34+
<h1><span id="q14.0"><a name="q0">14 Colors and Backgrounds</a></span></h1>
3535
<div class="subtoc">
3636
<p><strong>Contents</strong>
3737
<ul class="toc">

css2/conform.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</div>
2525
<hr class="navbar">
2626

27-
<H1><a name="q3.0">3 Conformance: Requirements and Recommendations</a></H1>
27+
<H1><span id="q3.0"><a name="q0">3 Conformance: Requirements and Recommendations</a></span></H1>
2828
<div class="subtoc">
2929
<p><strong>Contents</strong>
3030
<ul class="toc">

css2/cover.html

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

css2/fonts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<hr class="navbar">
3636

3737

38-
<h1><a name="q15.0">15 Fonts</a></h1>
38+
<h1><span id="q15.0"><a name="q0">15 Fonts</a></span></h1>
3939
<div class="subtoc">
4040
<p><strong>Contents</strong>
4141
<ul class="toc">

css2/grammar.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
</div>
2424
<hr class="navbar">
2525

26-
<H1><a name="q25.0">Appendix G. Grammar of CSS&nbsp;2</a></H1>
26+
<H1><span id="q25.0"><a name="q0">Appendix G. Grammar of CSS&nbsp;2</a></span></H1>
2727
<div class="subtoc">
2828
<p><strong>Contents</strong>
2929
<ul class="toc">
3030
<li class="tocline2"><a href="grammar.html#grammar" class="tocxref">G.1 Grammar</a>
3131
<li class="tocline2"><a href="grammar.html#scanner" class="tocxref">G.2 Lexical scanner</a>
3232
<li class="tocline2"><a href="grammar.html#tokenizer-diffs" class="tocxref">G.3 Comparison of tokenization in CSS2&nbsp;(1998) and CSS1</a>
33-
<li class="tocline2"><a href="grammar.html#q25.4" class="tocxref">G.4 Implementation note</a>
33+
<li class="tocline2"><a href="grammar.html#q4" class="tocxref">G.4 Implementation note</a>
3434
</ul>
3535
</div>
3636
<!-- warning -->
@@ -325,7 +325,7 @@ <h2>G.3 <a name="tokenizer-diffs">Comparison of tokenization in CSS2&nbsp;(1998)
325325
escaped (".\35 5ft")
326326
</ul>
327327

328-
<h2><a name="q25.4">G.4 Implementation note</a></h2>
328+
<h2><span id="q25.4"><a name="q4">G.4 Implementation note</a></span></h2>
329329

330330
<p>The lexical scanner for the CSS core syntax in <a
331331
href="syndata.html#tokenization">section&nbsp;4.1.1</a> can be

0 commit comments

Comments
 (0)