~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to doc/tools/index-texi

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use Getopt::Long;
 
4
 
 
5
GetOptions( 'map=s'   => \%mapping ) || die "Wrong options\n";
 
6
 
 
7
for $file (@ARGV) {
 
8
 
 
9
        open(FILE, "$file") || die "File not found: $file\n";
 
10
 
 
11
        $indir = 0;
 
12
 
 
13
        while (<FILE>) {
 
14
 
 
15
                if (/\<H1\>\<A NAME=\".*\" HREF=\".*\"\>(.*)\<\/A\>\<\/H1\>/) {
 
16
                        $index = $mapping{$1};
 
17
#                        print "Index: $1 => $index\n";
 
18
                } elsif (/\<DIR\>/) {
 
19
                        $indir = 1;
 
20
                } elsif (/\<\/DIR>/) {
 
21
                        $indir = 0;
 
22
                } elsif ($indir) {
 
23
                        if (/\<LI\>\<A HREF=\"([^\"]*)\"\>([^<]*)\<\/A\>/) {
 
24
                                unless ($lastindex eq $index) {
 
25
                                        if ($lastindex) {
 
26
                                                print "</$lastindex>\n";
 
27
                                        }
 
28
                                        print "<$index>\n";
 
29
                                        $lastindex = $index;
 
30
                                }
 
31
                                $name = dehtml($2);
 
32
                                $url = $1;
 
33
                                print STDOUT "<entry name=\"$name\" url=\"$url\"/>\n";
 
34
                        }
 
35
                }
 
36
        }
 
37
 
 
38
        close(FILE);
 
39
}
 
40
 
 
41
if ($lastindex) {
 
42
        print "</$lastindex>\n";
 
43
}
 
44
 
 
45
sub dehtml
 
46
{
 
47
        my ( $str ) = @_;
 
48
 
 
49
        $str =~ s/\<CODE\>//g;
 
50
        $str =~ s/\<\/CODE\>//g;
 
51
        $str =~ s/\<TT\>//g;
 
52
        $str =~ s/\<\/TT\>//g;
 
53
 
 
54
        return $str;
 
55
}
 
56
 
 
57
# Local Variables:
 
58
# mode: perl
 
59
# fill-column: 120
 
60
# End: