Skip to content

Commit 3395e65

Browse files
committed
[css2] .
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%4024
1 parent 1ffd321 commit 3395e65

9 files changed

Lines changed: 717 additions & 90 deletions

File tree

css2/DOC/CONVENTIONS

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,15 @@ some combination of these three.
7070

7171
MarkUp all value definitions with:
7272

73-
<span class="value-def">value</span>
73+
<span class="value-def">
74+
<span class="index-def" title="value, definition of">
75+
value</span></span>
7476

7577
MarkUp all value instances with
7678

77-
<span class="value-inst">value</span>
79+
<span class="value-inst">
80+
<span class="index-inst" title="value, use">
81+
value</span></span>
7882

7983
************
8084
Indexes
@@ -90,19 +94,20 @@ Indexes
9094
index-inst
9195

9296
* If the title attribute is not set, the span content goes in the
93-
index (alphabetized) and links to the marked-up source.
94-
97+
index (alphabetized) and links to the marked-up source. This
98+
practice is supported, but discouraged since markup may appear
99+
in the content. Markup cannot occur in a title attribute.
100+
95101
* If the title attribute is set, it becomes the index entry key. The
96-
attribute value may be a comma-separated list of index keys. The
97-
title attribute must follow the class attribute.
98-
102+
attribute value is a "|" separated list of index entries. Each index
103+
entry may be either a single key or a primary key separated from
104+
a secondary key.
99105

100106
For example:
101107
--
102108
<span class="index-def"
103-
title="word-spacing, definition of">
109+
title="word-spacing, definition of|ian's second key">
104110
Word spacing is defined as ...</span>
105-
106111
<span class="index-inst"
107112
title="word-spacing, use with blah">
108113
In the context of blah blah, word spacing ...</span>
@@ -173,7 +178,7 @@ Document HEAD
173178

174179
<!DOCTYPE HTML SYSTEM "http://www.w3.org/TR/WD-html40/sgml/HTML4.dtd">
175180
<html lang="en">
176-
<!-- $Id: CONVENTIONS,v 1.4 1997-07-30 16:55:25 ijacobs Exp $ -->
181+
<!-- $Id: CONVENTIONS,v 1.5 1997-08-01 17:02:54 ijacobs Exp $ -->
177182
<HEAD>
178183
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
179184
<TITLE>CSS2 Specification</TITLE>

css2/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile to generate the CSS2 document based on its "source files"
22
# Arnaud Le Hors - lehors@w3.org
3-
# $Id: Makefile,v 1.4 1997-08-01 14:20:05 lehors Exp $
3+
# $Id: Makefile,v 1.5 1997-08-01 17:02:09 ijacobs Exp $
44

55
ROOT = .
66

@@ -97,7 +97,7 @@ HMKDEPEND= $(PERL) ./bin/hmkdep
9797
# make property anchor database
9898
MKANCHDB= $(PERL) ./bin/mkanchdb
9999
# add heading anchors
100-
ADDHANCH= $(PERL) ./bin/addhanch -n
100+
ADDHANCH= $(PERL) ./bin/addhanch -n -ml 3
101101
# add index anchors and generate related index database
102102
ADDIDXANCH= $(PERL) ./bin/addianch
103103
# add navigation bars

css2/bin/Attic/addianch

Lines changed: 54 additions & 28 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.4 1997-08-01 13:29:09 ijacobs Exp $
4+
# $Id: addianch,v 1.5 1997-08-01 17:03:03 ijacobs Exp $
55

66
if (($_ = $ARGV[0], /^-r/) && $ARGV[0]) {
77
shift;
@@ -45,20 +45,33 @@ sub readfile {
4545
close(INPUT);
4646
}
4747

48-
# store index and return unique anchor
48+
# store index and return an anchor.
49+
# Since each index markup can define several
50+
# links to the same anchor, create a unique
51+
# anchor the first time this function is
52+
# called (per markup) and reuse it thereafter
53+
4954
sub storeindex {
50-
($prefix, $index, $cmt) = @_;
55+
($prefix, $index, $cmt, $anchor) = @_;
5156
if ($indexes{$index}) {
52-
$n = $#{$indexes{$index}} + 1;
53-
$anchor = "$prefix-$index-$n";
54-
# change possible spaces to underscores
55-
$anchor =~ s/ /_/g;
56-
push(@{$indexes{$index}}, "$file#$anchor;$cmt");
57+
if (!$anchor) {
58+
$n = $#{$indexes{$index}} + 1;
59+
$anchor = "$prefix-$index-$n";
60+
# change possible spaces to underscores
61+
$anchor =~ s/ /_/g;
62+
# leave only alphanumeric characters
63+
$anchor =~ s/[^a-zA-Z0-9_-]//g;
64+
}
65+
push(@{$indexes{$index}}, "$file#$anchor|$cmt");
5766
} else {
58-
$anchor = "$prefix-$index";
59-
# change possible spaces to underscores
60-
$anchor =~ s/ /_/g;
61-
@{$indexes{$index}} = ("$file#$anchor;$cmt");
67+
if (!$anchor) {
68+
$anchor = "$prefix-$index";
69+
# change possible spaces to underscores
70+
$anchor =~ s/ /_/g;
71+
# leave only alphanumeric characters
72+
$anchor =~ s/[^a-zA-Z0-9_-]//g;
73+
}
74+
@{$indexes{$index}} = ("$file#$anchor|$cmt");
6275
}
6376

6477
return $anchor;
@@ -74,28 +87,38 @@ sub addanchor {
7487
# see if a title is specified
7588
$_ = $st;
7689
if (/${sep}title=(?:$qwd|($wd))/sgio) {
77-
# only $1 or $2 will actually be non null
78-
($index, $cmt) = split(/, */, "$1$2", 2);
90+
$anchor = ();
91+
# only $1 or $2 will actually be non null
92+
foreach $idxentry (split(/[\n \t]*\|[\n \t]*/, "$1$2", 2)) {
93+
($index, $cmt) = split(/, */, "$idxentry", 2);
94+
# New lines -> spaces in keys (title OR content)
95+
# And compress extra space
96+
$index =~ s/[\n \t]+/ /g;
97+
$cmt =~ s/[\n \t]+/ /g;
98+
#Remove initial white space
99+
$index =~ s/^[\n \t]+//;
100+
$cmt =~ s/^[\n \t]+//;
101+
$anchor = storeindex($prefix, $index, $cmt, $anchor);
102+
}
79103
} else {
80-
$index = $content;
81-
$cmt = ();
104+
$index = $content;
105+
$cmt = ();
106+
# New lines -> spaces in keys (title OR content)
107+
# And compress extra space
108+
$index =~ s/[\n \t]+/ /g;
109+
$cmt =~ s/[\n \t]+/ /g;
110+
#Remove initial white space
111+
$index =~ s/^[\n \t]+//;
112+
$cmt =~ s/^[\n \t]+//;
113+
$anchor = storeindex($prefix, $index, $cmt, ());
82114
}
83-
# New lines -> spaces in keys (title OR content)
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]+//;
90115

91116
# HACK!!!
92117
# add a non breakable space in the anchor to workaround
93118
# broken browsers which don't support correctly empty anchors
94-
return "$st<a name=\"" .
95-
storeindex($prefix, $index, $cmt) . "\">&nbsp;</a>$content$et";
119+
return "$st<a name=\"" . $anchor . "\">&nbsp;</a>$content$et";
96120
# if the span tags are to be removed use the following two lines instead
97-
# return "<a name=\"" .
98-
# storeindex($prefix, $index, $cmt) . "\">&nbsp;</a>$content";
121+
# return "<a name=\"" . $anchor . "\">&nbsp;</a>$content";
99122
}
100123

101124
### main
@@ -118,12 +141,15 @@ print OUTPUT $buf;
118141
close(OUTPUT);
119142

120143
# print out index database
144+
# Don't separate fields with ";" because keys may contain markup
145+
# With entities.
146+
121147
if (!open(DBASE, "> $dbasef")) {
122148
print STDERR "$PROGNAME Error: Cannot open dbfile: $dbasef\n";
123149
} else {
124150
foreach $index (sort(keys %indexes)) {
125151
foreach $item (@{$indexes{$index}}) {
126-
print DBASE "$index;$item\n";
152+
print DBASE "$index|$item\n";
127153
}
128154
}
129155
close(DBASE);

css2/bin/Attic/mkidx

Lines changed: 7 additions & 5 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.5 1997-08-01 14:37:37 ijacobs Exp $
10+
# $Id: mkidx,v 1.6 1997-08-01 17:03:11 ijacobs Exp $
1111

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

@@ -27,9 +27,11 @@ sub readdbfile {
2727
}
2828
while (<DBASE>) {
2929
chop;
30-
($index, $url, $cmt) = split(/;/, $_, 3);
31-
#Sort on alphanumeric characters only.
32-
$index =~ s/^[^a-zA-Z0-9]*//;
30+
($index, $url, $cmt) = split(/\|/, $_, 3);
31+
# Remove entity markup first (e.g. $lt;)
32+
$index =~ s/^&[^;]+;//;
33+
# Sort on certain chars only.
34+
$index =~ s/^[^a-zA-Z0-9\@:]*//;
3335
$key = "$index$cmt";
3436
if ($indexes{$key}) {
3537
push(@{$indexes{$key}}, "$_");
@@ -55,7 +57,7 @@ foreach $key (sort(keys %indexes)) {
5557
$lastcmt = ();
5658
foreach $item (@{$indexes{$key}}) {
5759
$cmt = ();
58-
($index, $url, $cmt) = split(/;/, $item, 3);
60+
($index, $url, $cmt) = split(/\|/, $item, 3);
5961

6062
if (($curindex) && ($curindex ne $index)) {
6163
print OUTPUT "</dl>\n";

css2/bin/addianch

Lines changed: 54 additions & 28 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.4 1997-08-01 13:29:09 ijacobs Exp $
4+
# $Id: addianch,v 1.5 1997-08-01 17:03:03 ijacobs Exp $
55

66
if (($_ = $ARGV[0], /^-r/) && $ARGV[0]) {
77
shift;
@@ -45,20 +45,33 @@ sub readfile {
4545
close(INPUT);
4646
}
4747

48-
# store index and return unique anchor
48+
# store index and return an anchor.
49+
# Since each index markup can define several
50+
# links to the same anchor, create a unique
51+
# anchor the first time this function is
52+
# called (per markup) and reuse it thereafter
53+
4954
sub storeindex {
50-
($prefix, $index, $cmt) = @_;
55+
($prefix, $index, $cmt, $anchor) = @_;
5156
if ($indexes{$index}) {
52-
$n = $#{$indexes{$index}} + 1;
53-
$anchor = "$prefix-$index-$n";
54-
# change possible spaces to underscores
55-
$anchor =~ s/ /_/g;
56-
push(@{$indexes{$index}}, "$file#$anchor;$cmt");
57+
if (!$anchor) {
58+
$n = $#{$indexes{$index}} + 1;
59+
$anchor = "$prefix-$index-$n";
60+
# change possible spaces to underscores
61+
$anchor =~ s/ /_/g;
62+
# leave only alphanumeric characters
63+
$anchor =~ s/[^a-zA-Z0-9_-]//g;
64+
}
65+
push(@{$indexes{$index}}, "$file#$anchor|$cmt");
5766
} else {
58-
$anchor = "$prefix-$index";
59-
# change possible spaces to underscores
60-
$anchor =~ s/ /_/g;
61-
@{$indexes{$index}} = ("$file#$anchor;$cmt");
67+
if (!$anchor) {
68+
$anchor = "$prefix-$index";
69+
# change possible spaces to underscores
70+
$anchor =~ s/ /_/g;
71+
# leave only alphanumeric characters
72+
$anchor =~ s/[^a-zA-Z0-9_-]//g;
73+
}
74+
@{$indexes{$index}} = ("$file#$anchor|$cmt");
6275
}
6376

6477
return $anchor;
@@ -74,28 +87,38 @@ sub addanchor {
7487
# see if a title is specified
7588
$_ = $st;
7689
if (/${sep}title=(?:$qwd|($wd))/sgio) {
77-
# only $1 or $2 will actually be non null
78-
($index, $cmt) = split(/, */, "$1$2", 2);
90+
$anchor = ();
91+
# only $1 or $2 will actually be non null
92+
foreach $idxentry (split(/[\n \t]*\|[\n \t]*/, "$1$2", 2)) {
93+
($index, $cmt) = split(/, */, "$idxentry", 2);
94+
# New lines -> spaces in keys (title OR content)
95+
# And compress extra space
96+
$index =~ s/[\n \t]+/ /g;
97+
$cmt =~ s/[\n \t]+/ /g;
98+
#Remove initial white space
99+
$index =~ s/^[\n \t]+//;
100+
$cmt =~ s/^[\n \t]+//;
101+
$anchor = storeindex($prefix, $index, $cmt, $anchor);
102+
}
79103
} else {
80-
$index = $content;
81-
$cmt = ();
104+
$index = $content;
105+
$cmt = ();
106+
# New lines -> spaces in keys (title OR content)
107+
# And compress extra space
108+
$index =~ s/[\n \t]+/ /g;
109+
$cmt =~ s/[\n \t]+/ /g;
110+
#Remove initial white space
111+
$index =~ s/^[\n \t]+//;
112+
$cmt =~ s/^[\n \t]+//;
113+
$anchor = storeindex($prefix, $index, $cmt, ());
82114
}
83-
# New lines -> spaces in keys (title OR content)
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]+//;
90115

91116
# HACK!!!
92117
# add a non breakable space in the anchor to workaround
93118
# broken browsers which don't support correctly empty anchors
94-
return "$st<a name=\"" .
95-
storeindex($prefix, $index, $cmt) . "\">&nbsp;</a>$content$et";
119+
return "$st<a name=\"" . $anchor . "\">&nbsp;</a>$content$et";
96120
# if the span tags are to be removed use the following two lines instead
97-
# return "<a name=\"" .
98-
# storeindex($prefix, $index, $cmt) . "\">&nbsp;</a>$content";
121+
# return "<a name=\"" . $anchor . "\">&nbsp;</a>$content";
99122
}
100123

101124
### main
@@ -118,12 +141,15 @@ print OUTPUT $buf;
118141
close(OUTPUT);
119142

120143
# print out index database
144+
# Don't separate fields with ";" because keys may contain markup
145+
# With entities.
146+
121147
if (!open(DBASE, "> $dbasef")) {
122148
print STDERR "$PROGNAME Error: Cannot open dbfile: $dbasef\n";
123149
} else {
124150
foreach $index (sort(keys %indexes)) {
125151
foreach $item (@{$indexes{$index}}) {
126-
print DBASE "$index;$item\n";
152+
print DBASE "$index|$item\n";
127153
}
128154
}
129155
close(DBASE);

css2/bin/mkidx

Lines changed: 7 additions & 5 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.5 1997-08-01 14:37:37 ijacobs Exp $
10+
# $Id: mkidx,v 1.6 1997-08-01 17:03:11 ijacobs Exp $
1111

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

@@ -27,9 +27,11 @@ sub readdbfile {
2727
}
2828
while (<DBASE>) {
2929
chop;
30-
($index, $url, $cmt) = split(/;/, $_, 3);
31-
#Sort on alphanumeric characters only.
32-
$index =~ s/^[^a-zA-Z0-9]*//;
30+
($index, $url, $cmt) = split(/\|/, $_, 3);
31+
# Remove entity markup first (e.g. $lt;)
32+
$index =~ s/^&[^;]+;//;
33+
# Sort on certain chars only.
34+
$index =~ s/^[^a-zA-Z0-9\@:]*//;
3335
$key = "$index$cmt";
3436
if ($indexes{$key}) {
3537
push(@{$indexes{$key}}, "$_");
@@ -55,7 +57,7 @@ foreach $key (sort(keys %indexes)) {
5557
$lastcmt = ();
5658
foreach $item (@{$indexes{$key}}) {
5759
$cmt = ();
58-
($index, $url, $cmt) = split(/;/, $item, 3);
60+
($index, $url, $cmt) = split(/\|/, $item, 3);
5961
if ($class eq 'index-def') {
6062
if (($curindex) && ($curindex ne $index)) {
6163
print OUTPUT "</dl>\n";

0 commit comments

Comments
 (0)