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

« back to all changes in this revision

Viewing changes to doc/tools/index-python

  • 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
my $prefix = '';
 
6
GetOptions( 'prefix=s' => \$prefix ) || die "Wrong options\n";
 
7
 
 
8
$file = $ARGV[0];
 
9
open(FILE, "$file") || die "File not found: $file\n";
 
10
 
 
11
print "<conceptindex>\n";
 
12
 
 
13
$ingroup = 0;
 
14
while (<FILE>) {
 
15
 
 
16
      if (/\<dt\>\<a href=\'(.+)'\>(.+)\<\/a\>/) {
 
17
#              print "Index: $1, $2, $ingroup\n";
 
18
               if ($ingroup) {
 
19
                       $name = "$ingroup, $2";
 
20
               } else {
 
21
                       $name = $2;
 
22
               }
 
23
               $url = "$prefix/$1";
 
24
               print "<entry name=\"$name\" url=\"$url\"/>\n";
 
25
      } elsif (/\<dt\>(.+)/) {
 
26
#              print "Ingroup: $1\n";
 
27
              $ingroup = $1;
 
28
      } elsif (/\s+\<\/dl>/) {
 
29
              $ingroup = 0;
 
30
      }
 
31
}
 
32
 
 
33
print "</conceptindex>\n";
 
34
close(FILE);
 
35
 
 
36
 
 
37
sub dehtml
 
38
{
 
39
        my ( $str ) = @_;
 
40
 
 
41
        $str =~ s/\<CODE\>//g;
 
42
        $str =~ s/\<\/CODE\>//g;
 
43
        $str =~ s/\<TT\>//g;
 
44
        $str =~ s/\<\/TT\>//g;
 
45
 
 
46
        return $str;
 
47
}
 
48
 
 
49
# Local Variables:
 
50
# mode: perl
 
51
# fill-column: 120
 
52
# End: