#!/usr/bin/perl -w
-($#ARGV >= 1) or die "Usage: index_create.pl <input-tag-file> <output-doc-file>";
+($#ARGV >= 1) or die "Usage: toc_create.pl <input-doc-file> <output-toc-file>";
my(@toc);
my($level,$label,$name);
foreach $entry (@toc) {
($level,$label,$name) = @$entry;
- if($current_level<$level) {
+ while($current_level<$level) {
print OUTPUT "<ol type=\"1\">\n";
+ $current_level++;
}
- if($current_level>$level) {
+ while($current_level>$level) {
print OUTPUT "</ol>\n";
+ $current_level--;
}
- $current_level = $level;
foreach (1..$current_level) {
print OUTPUT "\t";
}
print OUTPUT "<li> <a href=\"#$label\">$name</a>\n";
}
-$current_level=-1;
-print OUTPUT "</ol>\n";
+while($current_level>-1) {
+ print OUTPUT "</ol>\n";
+ $current_level--;
+}
print OUTPUT "<!-- End of automatically generated table of contents --!>\n";
-
-# foreach $type qw(define enumeration enumvalue function typedef) {
-# if(defined $database{$type}) {
-# print OUTPUT "<h2>$type</h2> \n <ul>\n";
-# foreach $name (sort keys %{$database{$type}}) {
-# if($type eq "function") {
-# print OUTPUT "\t<LI> $name()</LI>\n";
-# } else {
-# print OUTPUT "\t<LI> #$name</LI>\n";
-# }
-# }
-# print OUTPUT "\n </ul>\n";
-# }
-# }
-# print OUTPUT "*/";
-# close OUTPUT;
-