Subversion Repositories wimsdev

Rev

Rev 12665 | Rev 15403 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
12573 bpr 1
#!/usr/bin/perl
2
 
3
use warnings;
4
use strict;
5
my %ref;
6
my $ref=\%ref;
12665 bpr 7
my %strong;
8
my $strong=\%strong;
12573 bpr 9
my ($type, $add)=("","");
15361 bpr 10
my $glist="";
12573 bpr 11
for my $file (glob("*/*/*/*")) {
12
  open(IN, $file) ;
15361 bpr 13
  $glist .= "$file\n" if !($file=~/_\d\b/) && !($file=~/\/macro\//);
12573 bpr 14
  while (<IN>) { my $line = $_;
12665 bpr 15
    if ($line=~ /<strong>([^<]+)<\/strong>/) { $strong{$1} .= " $file"};
16
    next if !($line =~ /gl_keywords=/ || $line =~ /gl_type=/) ;
17
    $type=$1 if($line=~/gl_type=(.*)/);
12573 bpr 18
    $add =$1 if($line=~/!set gl_keywords=(.*)/);
19
    chomp $add; chomp $type;
20
  }
21
  $type='main' if !($type);
22
  $ref{$add} .= "$file/$type " if ($add);
23
  $type="";$add="";
24
};
12644 bpr 25
my $Text="generated by mkindex.pl\n\n";
12573 bpr 26
while (my ($key, $value) = each(%ref) ) {
27
  my $s= join(",",sortuniq(split(' ', $value)));
28
  $Text .= $key . ":" . $s . "\n" ;
29
}
30
out("connexe_domain",$Text);
31
 
12665 bpr 32
$Text="";
33
while (my ($key, $value) = each(%strong) ) {
34
  my $s= join(",",sortuniq(split(' ', $value)));
35
  $Text .= $key . ":" . $s . "\n" ;
36
}
37
out("strong_index",join("\n",sortuniq(split("\n",$Text))));
15361 bpr 38
out("glist",$glist);
12665 bpr 39
 
12573 bpr 40
sub sortuniq {
41
  my $prev = "not $_[0]";
42
  grep { $_ ne $prev && ($prev = $_, 1) } sort @_;
43
}
44
 
45
sub out { my ($bloc, $text) = @_;
46
  open  (OUT, ">$bloc") ;
47
  print OUT $text ; close OUT;
48
}