summaryrefslogtreecommitdiffstats
path: root/doc/tools/toc-gsdoc
blob: 69785d91a94feef3666c5de3037317cb2c7005b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use Getopt::Long;

my $prefix = '';
GetOptions( 'title=s'  => \$title,
            'main=s'   => \$main ) || die "Wrong options\n";

$file = $ARGV[0];
open(FILE, "$file") || die "File not found: $file\n";

print "<tocsect1 name=\"$title\" url=\"$main.html\">\n";

while (<FILE>) {

      if (/\<item\>\<uref url=\"(.+)\.html\"\>(.+)\<\/uref\>\<\/item\>/) {
            $name = $1;
            $url = "$1.html";
            print "  <tocsect2 name=\"$name\" url=\"$url\"/>\n";
      }

}

print "</tocsect1>\n";