Skip to content

Commit 89233d4

Browse files
committed
[css2] New ToC, uses lists instead of BR and nbsp. Doesn't work too well in
NS4 (wrong indents, some bullets where there should be none), but does the right thing in IE4. --HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%40558
1 parent ed4c79a commit 89233d4

3 files changed

Lines changed: 74 additions & 95 deletions

File tree

css2/Makefile

Lines changed: 14 additions & 7 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.56 1997-12-11 23:43:32 ijacobs Exp $
3+
# $Id: Makefile,v 1.57 1997-12-12 17:12:13 bbos Exp $
44

55
# what needs to be set for every new release:
66
THIS_VERSION= http://www.w3.org/Style/Group/9712/WD-css2-971211
@@ -170,7 +170,7 @@ ADDREFCLASS= $(PERL) ./bin/addrefclass
170170

171171
# utility to generate the PostScript version
172172
#
173-
HTML2PS= $(PERL) html2ps -f html2psrc
173+
HTML2PS= $(PERL) bin/html2ps -f html2psrc
174174

175175
# IDRAW -> PS -> GIF tools
176176
#PSTOPNM = ./bin/mypstopnm -r 75
@@ -222,6 +222,7 @@ install: all css2.tgz
222222
$(CP) css2.tgz $(INSTALLDIR)
223223
(cd $(INSTALLDIR); zcat css2.tgz | $(TAR) xvf -)
224224
-(cd $(CSSGROUPDIR); rm -f issues.html; \
225+
$(RM) css2-issues.html; \
225226
$(LN) -s $(INSTALLDIR)/issues.html css2-issues.html)
226227
$(CP) Overview.html html2psrc $(INSTALLDIR)
227228

@@ -275,7 +276,7 @@ $(DESCRIPTORDB): $(SPECSRCS)
275276
$(VALUEDB): $(SPECSRCS)
276277
$(MKANCHDB) value-def - $(SPECSRCS) | $(SED) 's/\.src/\.html/' > $@
277278

278-
cover.html: cover.src build/contents.srb
279+
cover.html: cover.src build/contents.srb build/minicontents.srb
279280
$(SED) -e 's|_THIS_VERSION_|$(THIS_VERSION)|g' \
280281
-e 's|_THE_PREVIOUS_VERSION_|$(THE_PREVIOUS_VERSION)|g' \
281282
-e 's|_THE_LATEST_VERSION_|$(THE_LATEST_VERSION)|g' \
@@ -285,13 +286,19 @@ cover.html: cover.src build/contents.srb
285286
$(ADDNAVBAR) -hr -r $@ - $@ "table of contents" "#toc" properties propidx.html descriptors descidx.html index indexlist.html
286287

287288
build/contents.srb: $(MAINSRCS) $(INDEXSRCS) $(APPSRCS) $(REFSRCS)
288-
$(MKTOC) -ml 5 $@ build/minicontents.srb $(HEADINGDB) $(MAINSRCS)\
289-
-ul -roman $(APPSRCS) -ol -none $(REFSRCS) $(INDEXSRCS)
289+
$(MKTOC) -ml 5 $@ $(HEADINGDB) \
290+
-ul -none $(MAINSRCS)\
291+
-ul -none $(APPSRCS) -ol -none $(REFSRCS) $(INDEXSRCS)
290292
$(ADDLINKS) -r $< $@ $@ propinst $(PROPERTYDB) \
291293
descinst $(DESCRIPTORDB) value-inst $(VALUEDB)
292-
$(ADDLINKS) -r $< build/minicontents.srb build/minicontents.srb \
293-
propinst $(PROPERTYDB) \
294+
295+
build/minicontents.srb: $(MAINSRCS) $(INDEXSRCS) $(APPSRCS) $(REFSRCS)
296+
$(MKTOC) -ml 1 $@ $(HEADINGDB) \
297+
-ol $(MAINSRCS)\
298+
-ol -roman $(APPSRCS) -ol -none $(REFSRCS) $(INDEXSRCS)
299+
$(ADDLINKS) -r $< $@ $@ propinst $(PROPERTYDB) \
294300
descinst $(DESCRIPTORDB) value-inst $(VALUEDB)
301+
295302
$(HEADINGDB): build/contents.srb
296303

297304
# special rule with different numbering

css2/bin/Attic/mktoc

Lines changed: 30 additions & 44 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.16 1997-12-11 23:44:08 ijacobs Exp $
8+
# $Id: mktoc,v 1.17 1997-12-12 17:12:33 bbos Exp $
99

1010
if (($_ = $ARGV[0], /^-l/) && $ARGV[0]) {
1111
shift;
@@ -34,7 +34,7 @@ if (($_ = $ARGV[0], /^-mol/) && $ARGV[0]) {
3434
$PROGNAME = substr($0, rindex($0, "/") + 1);
3535

3636
if ($#ARGV < 2) {
37-
print STDERR "Usage: $PROGNAME [-l startlvl] [-ml level] [-mol level] toc minitoc tocdb src1 src2 ...
37+
print STDERR "Usage: $PROGNAME [-l startlvl] [-ml level] [-mol level] toc tocdb src1 src2 ...
3838
\t-l to give the level from which headings should be put into the toc
3939
\t-ml set the maximum level to be put into the toc
4040
\t-mol set the level from which to use an unordered list
@@ -45,8 +45,6 @@ unordered lists and -roman for roman ordered lists\n";
4545
} else {
4646
$tocf = $ARGV[0];
4747
shift;
48-
$minitocf = $ARGV[0];
49-
shift;
5048
$tocdb = $ARGV[0];
5149
shift;
5250
}
@@ -120,20 +118,27 @@ $headingp = "<h([1-6]).*?>(.*?)(?:<!--(.*?)-->)?</h[1-6]>";
120118

121119
open(DBASE, "> $tocdb");
122120
open(OUTPUT, "> $tocf");
123-
open(MINIOUTPUT, "> $minitocf");
124121
hnuminit();
125122
$list = "ol";
126123
$listtype = "";
127-
print OUTPUT "<DIV CLASS=\"toc\">";
128-
print MINIOUTPUT "<DIV CLASS=\"toc\">";
124+
$prevh = 0;
125+
print OUTPUT "<DIV CLASS=\"toc\">\n";
129126
LOOP: foreach $file (@ARGV) {
130127
if ($file eq "-ul") { # start a new unordered list
128+
while ($prevh > 0) {
129+
print OUTPUT "</$list>\n";
130+
$prevh -= 1;
131+
}
131132
$list = "ul";
132133
$listtype = "";
133134
hnum(0);
134135
hnuminit();
135136
next LOOP;
136137
} elsif ($file eq "-ol") { # start a new ordered list
138+
while ($prevh > 0) {
139+
print OUTPUT "</$list>\n";
140+
$prevh -= 1;
141+
}
137142
$list = "ol";
138143
$listtype = "";
139144
hnum(0);
@@ -182,47 +187,26 @@ LOOP: foreach $file (@ARGV) {
182187
$rel = "";
183188
}
184189
}
185-
if ($list eq "ol" && $listtype ne " class=\"toc\"") {
186-
$tnum = "$num ";
190+
if ($list eq "ul" && $listtype eq " class=\"toc\"") {
191+
$tnum = "$num&nbsp; ";
187192
} else {
188193
$tnum ="";
189194
}
190-
if ($h == 1) {
191-
if ($hasanchor) {
192-
print OUTPUT "<P CLASS=\"tocline\"><strong>$tnum$txt</strong>\n";
193-
print MINIOUTPUT "<strong>$tnum$txt</strong><BR>\n";
194-
} else {
195-
print OUTPUT "<P CLASS=\"tocline\"><strong>$tnum</strong><a href=\"$url\"$rel><strong>$txt</strong></a>\n";
196-
print MINIOUTPUT "<strong>$tnum</strong><a href=\"$url\"$rel><strong>$txt</strong></a><BR>\n";
197-
}
198-
} elsif ($h == 2) {
199-
if ($hasanchor) {
200-
print OUTPUT "<BR>$tnum$txt\n";
201-
} else {
202-
print OUTPUT "<BR>$tnum<a href=\"$url\"$rel>$txt</a>\n";
203-
}
204-
} elsif ($h == 3) {
205-
if ($hasanchor) {
206-
print OUTPUT
207-
"<BR>&nbsp;&nbsp;&nbsp;$tnum$txt\n";
208-
} else {
209-
print OUTPUT
210-
"<BR>&nbsp;&nbsp;&nbsp;$tnum<a href=\"$url\"$rel>$txt</a>\n";
211-
}
195+
while ($h > $prevh) {
196+
print OUTPUT "<$list$listtype>\n";
197+
$prevh += 1;
198+
}
199+
while ($h < $prevh) {
200+
print OUTPUT "</$list>\n";
201+
$prevh -= 1;
202+
}
203+
if ($hasanchor) {
204+
print OUTPUT "<li class=tocline$h>$tnum$txt\n";
212205
} else {
213-
if ($hasanchor) {
214-
print OUTPUT
215-
"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$txt\n";
216-
} else {
217-
print OUTPUT
218-
"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"$url\"$rel>$txt</a>\n";
219-
}
206+
print OUTPUT "<li class=tocline$h>$tnum<a href=\"$url\"$rel>$txt</a>\n";
220207
}
221208
if ($cmt) {
222209
print OUTPUT " <em>-$cmt</em>";
223-
if ($h == 1) {
224-
print MINIOUTPUT " <em>-$cmt</em>";
225-
}
226210
}
227211

228212
# dbase format: file;headingtext;h;hnum
@@ -231,9 +215,11 @@ LOOP: foreach $file (@ARGV) {
231215
$_ = $';
232216
}
233217
}
234-
print OUTPUT "</DIV>";
235-
print MINIOUTPUT "</DIV>";
218+
while ($prevh > 0) {
219+
print OUTPUT "</$list>\n";
220+
$prevh -= 1;
221+
}
222+
print OUTPUT "</DIV>\n";
236223
hnum(0); # close all open lists
237224
close(OUTPUT);
238-
close(MINIOUTPUT);
239225
close(DBASE);

css2/bin/mktoc

Lines changed: 30 additions & 44 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.16 1997-12-11 23:44:08 ijacobs Exp $
8+
# $Id: mktoc,v 1.17 1997-12-12 17:12:33 bbos Exp $
99

1010
if (($_ = $ARGV[0], /^-l/) && $ARGV[0]) {
1111
shift;
@@ -34,7 +34,7 @@ if (($_ = $ARGV[0], /^-mol/) && $ARGV[0]) {
3434
$PROGNAME = substr($0, rindex($0, "/") + 1);
3535

3636
if ($#ARGV < 2) {
37-
print STDERR "Usage: $PROGNAME [-l startlvl] [-ml level] [-mol level] toc minitoc tocdb src1 src2 ...
37+
print STDERR "Usage: $PROGNAME [-l startlvl] [-ml level] [-mol level] toc tocdb src1 src2 ...
3838
\t-l to give the level from which headings should be put into the toc
3939
\t-ml set the maximum level to be put into the toc
4040
\t-mol set the level from which to use an unordered list
@@ -45,8 +45,6 @@ unordered lists and -roman for roman ordered lists\n";
4545
} else {
4646
$tocf = $ARGV[0];
4747
shift;
48-
$minitocf = $ARGV[0];
49-
shift;
5048
$tocdb = $ARGV[0];
5149
shift;
5250
}
@@ -120,20 +118,27 @@ $headingp = "<h([1-6]).*?>(.*?)(?:<!--(.*?)-->)?</h[1-6]>";
120118

121119
open(DBASE, "> $tocdb");
122120
open(OUTPUT, "> $tocf");
123-
open(MINIOUTPUT, "> $minitocf");
124121
hnuminit();
125122
$list = "ol";
126123
$listtype = "";
127-
print OUTPUT "<DIV CLASS=\"toc\">";
128-
print MINIOUTPUT "<DIV CLASS=\"toc\">";
124+
$prevh = 0;
125+
print OUTPUT "<DIV CLASS=\"toc\">\n";
129126
LOOP: foreach $file (@ARGV) {
130127
if ($file eq "-ul") { # start a new unordered list
128+
while ($prevh > 0) {
129+
print OUTPUT "</$list>\n";
130+
$prevh -= 1;
131+
}
131132
$list = "ul";
132133
$listtype = "";
133134
hnum(0);
134135
hnuminit();
135136
next LOOP;
136137
} elsif ($file eq "-ol") { # start a new ordered list
138+
while ($prevh > 0) {
139+
print OUTPUT "</$list>\n";
140+
$prevh -= 1;
141+
}
137142
$list = "ol";
138143
$listtype = "";
139144
hnum(0);
@@ -182,47 +187,26 @@ LOOP: foreach $file (@ARGV) {
182187
$rel = "";
183188
}
184189
}
185-
if ($list eq "ol" && $listtype ne " class=\"toc\"") {
186-
$tnum = "$num ";
190+
if ($list eq "ul" && $listtype eq " class=\"toc\"") {
191+
$tnum = "$num&nbsp; ";
187192
} else {
188193
$tnum ="";
189194
}
190-
if ($h == 1) {
191-
if ($hasanchor) {
192-
print OUTPUT "<P CLASS=\"tocline\"><strong>$tnum$txt</strong>\n";
193-
print MINIOUTPUT "<strong>$tnum$txt</strong><BR>\n";
194-
} else {
195-
print OUTPUT "<P CLASS=\"tocline\"><strong>$tnum</strong><a href=\"$url\"$rel><strong>$txt</strong></a>\n";
196-
print MINIOUTPUT "<strong>$tnum</strong><a href=\"$url\"$rel><strong>$txt</strong></a><BR>\n";
197-
}
198-
} elsif ($h == 2) {
199-
if ($hasanchor) {
200-
print OUTPUT "<BR>$tnum$txt\n";
201-
} else {
202-
print OUTPUT "<BR>$tnum<a href=\"$url\"$rel>$txt</a>\n";
203-
}
204-
} elsif ($h == 3) {
205-
if ($hasanchor) {
206-
print OUTPUT
207-
"<BR>&nbsp;&nbsp;&nbsp;$tnum$txt\n";
208-
} else {
209-
print OUTPUT
210-
"<BR>&nbsp;&nbsp;&nbsp;$tnum<a href=\"$url\"$rel>$txt</a>\n";
211-
}
195+
while ($h > $prevh) {
196+
print OUTPUT "<$list$listtype>\n";
197+
$prevh += 1;
198+
}
199+
while ($h < $prevh) {
200+
print OUTPUT "</$list>\n";
201+
$prevh -= 1;
202+
}
203+
if ($hasanchor) {
204+
print OUTPUT "<li class=tocline$h>$tnum$txt\n";
212205
} else {
213-
if ($hasanchor) {
214-
print OUTPUT
215-
"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$txt\n";
216-
} else {
217-
print OUTPUT
218-
"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"$url\"$rel>$txt</a>\n";
219-
}
206+
print OUTPUT "<li class=tocline$h>$tnum<a href=\"$url\"$rel>$txt</a>\n";
220207
}
221208
if ($cmt) {
222209
print OUTPUT " <em>-$cmt</em>";
223-
if ($h == 1) {
224-
print MINIOUTPUT " <em>-$cmt</em>";
225-
}
226210
}
227211

228212
# dbase format: file;headingtext;h;hnum
@@ -231,9 +215,11 @@ LOOP: foreach $file (@ARGV) {
231215
$_ = $';
232216
}
233217
}
234-
print OUTPUT "</DIV>";
235-
print MINIOUTPUT "</DIV>";
218+
while ($prevh > 0) {
219+
print OUTPUT "</$list>\n";
220+
$prevh -= 1;
221+
}
222+
print OUTPUT "</DIV>\n";
236223
hnum(0); # close all open lists
237224
close(OUTPUT);
238-
close(MINIOUTPUT);
239225
close(DBASE);

0 commit comments

Comments
 (0)