allow sections in contents file
authorkleing
Mon Mar 29 08:54:26 2004 +0200 (2004-03-29)
changeset 144907b37aa726d2d
parent 14489 3676def6b8b9
child 14491 df007bdff9bf
allow sections in contents file
Admin/page/Contents
Admin/page/bin/mkcontents
     1.1 --- a/Admin/page/Contents	Fri Mar 26 19:58:43 2004 +0100
     1.2 +++ b/Admin/page/Contents	Mon Mar 29 08:54:26 2004 +0200
     1.3 @@ -1,1 +1,2 @@
     1.4 -dummy	Dummy Isabelle documentation entry
     1.5 +Dummy Heading
     1.6 +  dummy	Dummy Isabelle documentation entry
     2.1 --- a/Admin/page/bin/mkcontents	Fri Mar 26 19:58:43 2004 +0100
     2.2 +++ b/Admin/page/bin/mkcontents	Mon Mar 29 08:54:26 2004 +0200
     2.3 @@ -24,25 +24,39 @@
     2.4  $infile  = $ARGV[0];
     2.5  $outfile = $ARGV[1];
     2.6  
     2.7 -$fileHeader = "<ul>\n";
     2.8 +$listHeader = "<ul>\n";
     2.9  $lineHeader = "  <li>";
    2.10  $lineEnd    = "</li>\n";
    2.11 -$fileFooter = "</ul>\n";
    2.12 +$listFooter = "</ul>\n";
    2.13 +
    2.14 +$topicStart = "<h2>";
    2.15 +$topicEnd   = "</h2>\n";
    2.16  
    2.17  open(IN, "<$infile") || die "cannot read input file <$infile>";
    2.18  open(OUT, ">$outfile") || die "cannot write output file <$outfile>";
    2.19  
    2.20 -print OUT $fileHeader;
    2.21 -
    2.22 +$first = 1;
    2.23  while (<IN>) {
    2.24 -  if (/[ \t]*([^ \t]+)[ \t]+(.+)\n/) {
    2.25 +  if (/^([^ \t].*)\n/) {
    2.26 +    if ($first == 1) {
    2.27 +      $first = 0;
    2.28 +    }
    2.29 +    else {
    2.30 +      print OUT $listFooter;
    2.31 +    }
    2.32 +    print OUT $topicStart;
    2.33 +    print OUT $1;
    2.34 +    print OUT $topicEnd;
    2.35 +    print OUT $listHeader;
    2.36 +  }
    2.37 +  elsif (/^[ \t]+([^ \t]+)[ \t]+(.+)\n/) {
    2.38      print OUT $lineHeader;
    2.39      print OUT "<a href=\"$path$1.pdf\">$2</a>";
    2.40      print OUT $lineEnd;
    2.41    }
    2.42  }
    2.43  
    2.44 -print OUT $fileFooter;
    2.45 +print OUT $listFooter;
    2.46  
    2.47  close(OUT);
    2.48  close(IN);