Skip to content

Commit 65d2c81

Browse files
committed
[css2] Better index
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%4019
1 parent d1913a7 commit 65d2c81

5 files changed

Lines changed: 102 additions & 62 deletions

File tree

css2/bin/Attic/addianch

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/local/bin/perl
22
# Add index anchors to source file _and_ generate index database
33
# Arnaud Le Hors - lehors@w3.org
4-
# $Id: addianch,v 1.3 1997-07-31 11:00:01 ijacobs Exp $
4+
# $Id: addianch,v 1.4 1997-08-01 13:29:09 ijacobs Exp $
55

66
if (($_ = $ARGV[0], /^-r/) && $ARGV[0]) {
77
shift;
@@ -48,7 +48,6 @@ sub readfile {
4848
# store index and return unique anchor
4949
sub storeindex {
5050
($prefix, $index, $cmt) = @_;
51-
5251
if ($indexes{$index}) {
5352
$n = $#{$indexes{$index}} + 1;
5453
$anchor = "$prefix-$index-$n";
@@ -82,8 +81,12 @@ sub addanchor {
8281
$cmt = ();
8382
}
8483
# New lines -> spaces in keys (title OR content)
85-
# And compress extra spaces
86-
$index =~ s/[\n ]+/ /g;
84+
# And compress extra space
85+
$index =~ s/[\n \t]+/ /g;
86+
$cmt =~ s/[\n \t]+/ /g;
87+
#Remove initial white space
88+
$index =~ s/^[\n \t]+//;
89+
$cmt =~ s/^[\n \t]+//;
8790

8891
# HACK!!!
8992
# add a non breakable space in the anchor to workaround

css2/bin/Attic/mkidx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Table headers can be specified through the '-th' option.
88
#
99
# Arnaud Le Hors - lehors@w3.org
10-
# $Id: mkidx,v 1.3 1997-08-01 10:12:11 ijacobs Exp $
10+
# $Id: mkidx,v 1.4 1997-08-01 13:29:16 ijacobs Exp $
1111

1212
$PROGNAME = substr($0, rindex($0, "/") + 1);
1313

@@ -28,6 +28,7 @@ sub readdbfile {
2828
while (<DBASE>) {
2929
chop;
3030
($index, $url, $cmt) = split(/;/, $_, 3);
31+
#Sort on alphanumeric characters only.
3132
$index =~ s/^[^a-zA-Z0-9]*//;
3233
$key = "$index$cmt";
3334
if ($indexes{$key}) {
@@ -50,6 +51,7 @@ foreach $file (@ARGV) {
5051
open(OUTPUT, "> $indexf");
5152
$curindex = ();
5253
$curletter = ();
54+
$lastcmt = ();
5355
foreach $key (sort(keys %indexes)) {
5456
foreach $item (@{$indexes{$key}}) {
5557
$cmt = ();
@@ -64,26 +66,41 @@ foreach $key (sort(keys %indexes)) {
6466
uc($letter) . "</a></h2>\n";
6567
}
6668
if ($curindex ne $index) {
67-
print OUTPUT "<dl><dt>$index";
68-
$curindex = $index;
69+
print OUTPUT "\n<dl><dt>$index";
6970
$n = 1;
71+
$curindex = $index;
7072
}
71-
7273
if ($cmt ne "") {
73-
$pre = "\n<dd>";
74-
$content = $cmt;
75-
$post = "</dd>\n";
74+
# If there is an index subkey
75+
if ($lastcmt ne $cmt) {
76+
# If the subkey is not the same
77+
# as the previous one, start
78+
# a new subkey list.
79+
print OUTPUT "\n<dd> $cmt";
80+
$pre = "\n, <a href=\"$url\">";
81+
$content = "1";
82+
$post = "</a>";
83+
$n = 2;
84+
$lastcmt = $cmt;
85+
} else {
86+
# Add number to current subkey list.
87+
$pre = "\n, <a href=\"$url\">";
88+
$content = $n;
89+
$post = "</a>";
90+
$n++;
91+
}
7692
} else {
77-
$pre = ",\n";
93+
# Add number to current index line.
94+
$pre = "\n, <a href=\"$url\">";
7895
$content = $n;
79-
$post = "";
96+
$post = "</a>";
8097
$n++;
8198
}
8299
$_ = $url;
83100
if (/\#didx-/) {
84101
$content = "<em>$content</em>";
85102
}
86-
print OUTPUT "$pre<a href=\"$url\">$content</a>$post";
103+
print OUTPUT "$pre$content$post";
87104
}
88105
}
89106
print OUTPUT "</dl>\n";

css2/bin/addianch

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/local/bin/perl
22
# Add index anchors to source file _and_ generate index database
33
# Arnaud Le Hors - lehors@w3.org
4-
# $Id: addianch,v 1.3 1997-07-31 11:00:01 ijacobs Exp $
4+
# $Id: addianch,v 1.4 1997-08-01 13:29:09 ijacobs Exp $
55

66
if (($_ = $ARGV[0], /^-r/) && $ARGV[0]) {
77
shift;
@@ -48,7 +48,6 @@ sub readfile {
4848
# store index and return unique anchor
4949
sub storeindex {
5050
($prefix, $index, $cmt) = @_;
51-
5251
if ($indexes{$index}) {
5352
$n = $#{$indexes{$index}} + 1;
5453
$anchor = "$prefix-$index-$n";
@@ -82,8 +81,12 @@ sub addanchor {
8281
$cmt = ();
8382
}
8483
# New lines -> spaces in keys (title OR content)
85-
# And compress extra spaces
86-
$index =~ s/[\n ]+/ /g;
84+
# And compress extra space
85+
$index =~ s/[\n \t]+/ /g;
86+
$cmt =~ s/[\n \t]+/ /g;
87+
#Remove initial white space
88+
$index =~ s/^[\n \t]+//;
89+
$cmt =~ s/^[\n \t]+//;
8790

8891
# HACK!!!
8992
# add a non breakable space in the anchor to workaround

css2/bin/mkidx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Table headers can be specified through the '-th' option.
88
#
99
# Arnaud Le Hors - lehors@w3.org
10-
# $Id: mkidx,v 1.3 1997-08-01 10:12:11 ijacobs Exp $
10+
# $Id: mkidx,v 1.4 1997-08-01 13:29:16 ijacobs Exp $
1111

1212
$PROGNAME = substr($0, rindex($0, "/") + 1);
1313

@@ -28,6 +28,7 @@ sub readdbfile {
2828
while (<DBASE>) {
2929
chop;
3030
($index, $url, $cmt) = split(/;/, $_, 3);
31+
#Sort on alphanumeric characters only.
3132
$index =~ s/^[^a-zA-Z0-9]*//;
3233
$key = "$index$cmt";
3334
if ($indexes{$key}) {
@@ -50,6 +51,7 @@ foreach $file (@ARGV) {
5051
open(OUTPUT, "> $indexf");
5152
$curindex = ();
5253
$curletter = ();
54+
$lastcmt = ();
5355
foreach $key (sort(keys %indexes)) {
5456
foreach $item (@{$indexes{$key}}) {
5557
$cmt = ();
@@ -64,26 +66,41 @@ foreach $key (sort(keys %indexes)) {
6466
uc($letter) . "</a></h2>\n";
6567
}
6668
if ($curindex ne $index) {
67-
print OUTPUT "<dl><dt>$index";
68-
$curindex = $index;
69+
print OUTPUT "\n<dl><dt>$index";
6970
$n = 1;
71+
$curindex = $index;
7072
}
71-
7273
if ($cmt ne "") {
73-
$pre = "\n<dd>";
74-
$content = $cmt;
75-
$post = "</dd>\n";
74+
# If there is an index subkey
75+
if ($lastcmt ne $cmt) {
76+
# If the subkey is not the same
77+
# as the previous one, start
78+
# a new subkey list.
79+
print OUTPUT "\n<dd> $cmt";
80+
$pre = "\n, <a href=\"$url\">";
81+
$content = "1";
82+
$post = "</a>";
83+
$n = 2;
84+
$lastcmt = $cmt;
85+
} else {
86+
# Add number to current subkey list.
87+
$pre = "\n, <a href=\"$url\">";
88+
$content = $n;
89+
$post = "</a>";
90+
$n++;
91+
}
7692
} else {
77-
$pre = ",\n";
93+
# Add number to current index line.
94+
$pre = "\n, <a href=\"$url\">";
7895
$content = $n;
79-
$post = "";
96+
$post = "</a>";
8097
$n++;
8198
}
8299
$_ = $url;
83100
if (/\#didx-/) {
84101
$content = "<em>$content</em>";
85102
}
86-
print OUTPUT "$pre<a href=\"$url\">$content</a>$post";
103+
print OUTPUT "$pre$content$post";
87104
}
88105
$lvl--;
89106
print OUTPUT "</dl>\n";

css2/selector.src

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE HTML SYSTEM "http://www.w3.org/TR/WD-html40/sgml/HTML4.dtd">
22
<html lang="en">
3-
<!-- $Id: selector.src,v 1.4 1997-07-31 15:38:06 ijacobs Exp $ -->
3+
<!-- $Id: selector.src,v 1.5 1997-08-01 13:28:42 ijacobs Exp $ -->
44
<HEAD>
55
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
66
<TITLE>Selectors</TITLE>
@@ -73,7 +73,7 @@ element types.
7373

7474
<P> In a contextual selector, pseudo-elements are only allowed at the
7575
end of the selector. The following example illustrates this with the
76-
<span class="index-inst" title="first-letter">first-letter</span>
76+
<span class="index-inst" title=":first-letter">:first-letter</span>
7777
pseudo element (defined below).
7878

7979
<PRE>
@@ -99,8 +99,8 @@ pseudo-elements must be specified at the end of the selector.
9999

100100
<P> Several pseudo elements can be combined. The following examples
101101
use the <span class="index-inst"
102-
title="first-letter">first-letter</span> and <span class="index-inst"
103-
title="first-line">first-line</span> pseudo elements defined below.
102+
title=":first-letter">:first-letter</span> and <span class="index-inst"
103+
title=":first-line">:first-line</span> pseudo elements defined below.
104104

105105
<PRE>
106106
P { color: red; font-size: 12pt }
@@ -127,10 +127,10 @@ would be red. Assuming that a line break will occur before the word
127127
&lt;/P&gt;
128128
</PRE>
129129

130-
<P> Note that the first-letter element is inside the first-line
131-
element. Properties set on first-line will be inherited by
132-
first-letter, but are overridden if the same property is set on
133-
first-letter.
130+
<P> Note that the :first-letter element is inside the :first-line
131+
element. Properties set on :first-line will be inherited by
132+
:first-letter, but are overridden if the same property is set on
133+
:first-letter.
134134

135135
<P> If a pseudo-element breaks up a real element the necessary extra
136136
tags must be regenerated in the fictional tag sequence. For example,
@@ -151,10 +151,10 @@ tag sequence becomes:
151151
</PRE>
152152

153153
<H3>Typographical pseudo-elements:
154-
<span class="index-inst" title="pseudo-elements,
155-
first-line">first-line</span> and
154+
<span class="index-inst" title="pseudo-elements,
155+
:first-line">:first-line</span> and
156156
<span class="index-inst"
157-
title="pseudo-elements,first-letter">first-letter</span>
157+
title="pseudo-elements,:first-letter">:first-letter</span>
158158
</H3>
159159

160160
<P> Some common typographical effects are associated not with
@@ -166,18 +166,18 @@ element, and the first letter.
166166

167167
<div class="note"><P>
168168
<em><strong>Note.</strong>
169-
Conforming UAs MAY ignore all rules with ':first-line' or
170-
':first-letter' in the selector, or, alternatively, MAY only support a
169+
Conforming UAs MAY ignore all rules with :first-line or
170+
:first-letter in the selector, or, alternatively, MAY only support a
171171
subset of the properties on these pseudo-elements. See the section on
172172
<a href="conformance.html">conformance</a> for further information.
173173
</em>
174174
</div>
175175

176176
<H4><span class="index-def" title="pseudo-elements,
177-
first-line">first-line</span></H4>
178-
<span class="index-def" title="first-line">&nbsp;</span>
177+
:first-line">:first-line</span></H4>
178+
<span class="index-def" title=":first-line">&nbsp;</span>
179179

180-
<P> The first-line pseudo-element is used to apply special styles to
180+
<P> The :first-line pseudo-element is used to apply special styles to
181181
the first line as formatted on the canvas:
182182

183183
<PRE>
@@ -206,16 +206,16 @@ the first line as formatted on the canvas:
206206
&lt;/P&gt;
207207
</PRE>
208208

209-
<P> The first-line end tag is inserted at the end of the first line
209+
<P> The :first-line end tag is inserted at the end of the first line
210210
as formatted on the canvas.
211211

212212
<P> The <span class="index-inst" title="pseudo-elements,
213-
first-line">first-line</span> pseudo-element can only be attached to a
213+
:first-line">:first-line</span> pseudo-element can only be attached to a
214214
block-level element.
215215

216-
<P> The first-line pseudo-element is similar to an inline element,
216+
<P> The :first-line pseudo-element is similar to an inline element,
217217
but with certain restrictions. Only the following properties apply to
218-
a first-line element:
218+
a :first-line element:
219219
<a href="fonts.html#font-properties">font properties</a>,
220220
<a href="colors.html#color-properties">color properties</a>,
221221
<a href="colors.html#background-properties">background properties</a>,
@@ -228,17 +228,17 @@ class="propinst">'line-height'</span>, and <span
228228
class="propinst">'clear'</span>,
229229

230230
<H4><span class="index-def" title="pseudo-elements,
231-
first-letter">first-letter</span></H4>
232-
<span class="index-def" title="first-letter">&nbsp;</span>
231+
:first-letter">:first-letter</span></H4>
232+
<span class="index-def" title=":first-letter">&nbsp;</span>
233233

234-
<P> The first-letter pseudo-element is used for <span
234+
<P> The :first-letter pseudo-element is used for <span
235235
class="index-inst" title="initial caps">"initial caps"</span> and
236236
<span class="index-inst" title="drop caps">"drop caps"</span>, which
237237
are common typographical effects. It is similar to an inline element
238238
if its <span class="propinst">'float'</span> property is 'none',
239239
otherwise it is similar to a floating element.
240240

241-
<P>These are the properties that apply to first-letter pseudo-elements:
241+
<P>These are the properties that apply to :first-letter pseudo-elements:
242242
<a href="fonts.html#font-properties">font properties</a>,
243243
<a href="colors.html#color-properties">color properties</a>,
244244
<a href="colors.html#background-properties">background properties</a>,
@@ -272,7 +272,7 @@ class="propinst">'clear'</span>.
272272
&lt;/HTML&gt;
273273
</PRE>
274274

275-
<P> If a text-based UA supports the first-letter pseudo-element
275+
<P> If a text-based UA supports the :first-letter pseudo-element
276276
the above could be formatted as:
277277

278278
<PRE>
@@ -297,12 +297,12 @@ the above could be formatted as:
297297
&lt;/P&gt;
298298
</PRE>
299299

300-
<P> Note that the first-letter pseudo-element tags abut the content
301-
(i.e., the initial character), while the first-line pseudo-element
300+
<P> Note that the :first-letter pseudo-element tags abut the content
301+
(i.e., the initial character), while the :first-line pseudo-element
302302
start tag is inserted right after the start tag of the element to
303303
which it is attached.
304304

305-
<P> The UA defines what characters are inside the first-letter
305+
<P> The UA defines what characters are inside the :first-letter
306306
element. Quotes that precede the first letter SHOULD be
307307
included:
308308

@@ -318,17 +318,17 @@ included:
318318
<P> When the paragraph starts with other punctuation (e.g., parenthesis
319319
and ellipsis points) or other characters that are normally not
320320
considered letters (e.g., digits and mathematical symbols),
321-
first-letter pseudo-elements are usually ignored.
321+
:first-letter pseudo-elements are usually ignored.
322322

323-
<P> The first-letter pseudo-element can only be attached to a
323+
<P> The :first-letter pseudo-element can only be attached to a
324324
block-level element.
325325

326326
<div class="note"><P>
327327
<em><strong>Note.</strong>
328328
Some languages may have specific rules about how to treat certain
329329
letter combinations. In Dutch, for example, if the letter combination
330330
"ij" appears at the beginning of a word, they should both be
331-
considered within the first-letter pseudo-element.
331+
considered within the :first-letter pseudo-element.
332332
</em>
333333
</div>
334334

@@ -418,10 +418,10 @@ elements of HTML. This use of style sheets is discouraged.
418418
</div>
419419

420420
<H3>Anchor pseudo-classes:
421-
<span class="index-def" title="pseudo-classes, link">link</span>,
422-
<span class="index-def" title="pseudo-classes, visited">visited</span>,
421+
<span class="index-def" title="pseudo-classes, :link">:link</span>,
422+
<span class="index-def" title="pseudo-classes, :visited">:visited</span>,
423423
and
424-
<span class="index-def" title="pseudo-classes, active">active</span>
424+
<span class="index-def" title="pseudo-classes, :active">:active</span>
425425
</H3>
426426

427427
<P> User agents commonly display newly visited HTML anchors

0 commit comments

Comments
 (0)