77# Table headers can be specified through the '-th' option.
88#
99# Arnaud Le Hors - lehors@w3.org
10- # $Id: mkidx,v 1.6 1997-08-01 17:03:11 ijacobs Exp $
10+ # $Id: mkidx,v 1.7 1997-08-06 14:02:57 ijacobs Exp $
1111
1212$PROGNAME = substr ($0 , rindex ($0 , " /" ) + 1);
1313
@@ -32,6 +32,8 @@ sub readdbfile {
3232 $index =~ s / ^&[^;]+;// ;
3333 # Sort on certain chars only.
3434 $index =~ s / ^[^a-zA-Z0-9\@ :]*// ;
35+ # Case-insensitive
36+ $index = lc ($index );
3537 $key = " $index$cmt " ;
3638 if ($indexes {$key }) {
3739 push (@{$indexes {$key }}, " $_ " );
@@ -50,7 +52,8 @@ foreach $file (@ARGV) {
5052}
5153
5254# print out index document
53- open (OUTPUT, " > $indexf " );
55+ $buf = " " ;
56+ @letters = ();
5457$curindex = ();
5558$curletter = ();
5659foreach $key (sort (keys %indexes )) {
@@ -60,15 +63,16 @@ foreach $key (sort(keys %indexes)) {
6063 ($index , $url , $cmt ) = split (/ \| / , $item , 3);
6164
6265 if (($curindex ) && ($curindex ne $index )) {
63- print OUTPUT " </dl>\n " ;
66+ $buf .= " </dl>\n " ;
6467 }
6568 if ($curletter ne ($letter = lc (substr ($key , 0, 1)))) {
6669 $curletter = $letter ;
67- print OUTPUT " <h2><a name=\" $letter \" >" .
70+ $buf .= " <h2><a name=\" $letter \" >" .
6871 uc ($letter ) . " </a></h2>\n " ;
72+ push (@letters , $letter );
6973 }
7074 if ($curindex ne $index ) {
71- print OUTPUT " \n <dl><dt>$index " ;
75+ $buf .= " \n <dl><dt>$index " ;
7276 $n = 1;
7377 $curindex = $index ;
7478 }
@@ -78,7 +82,7 @@ foreach $key (sort(keys %indexes)) {
7882 # If the subkey is not the same
7983 # as the previous one, start
8084 # a new subkey list.
81- print OUTPUT " \n <dd> $cmt " ;
85+ $buf .= " \n <dd> $cmt " ;
8286 $pre = " \n , <a href=\" $url \" >" ;
8387 $content = " 1" ;
8488 $post = " </a>" ;
@@ -102,8 +106,20 @@ foreach $key (sort(keys %indexes)) {
102106 if (/ \# didx-/ ) {
103107 $content = " <em>$content </em>" ;
104108 }
105- print OUTPUT " $pre$content$post " ;
109+ $buf .= " $pre$content$post " ;
106110 }
107111}
108- print OUTPUT " </dl>\n " ;
112+ $buf .= " </dl>\n " ;
113+
114+ # Print out the full buffer
115+ open (OUTPUT, " > $indexf " );
116+ print OUTPUT " <H2><P> " ;
117+ foreach $letter (@letters ) {
118+ print OUTPUT " <a href=\" #$letter \" >" . uc ($letter ) . " </a> " ;
119+ }
120+ print OUTPUT " </H2>" ;
121+ print OUTPUT $buf ;
109122close (OUTPUT);
123+
124+
125+
0 commit comments