Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix some bugs, but not all
[simgrid.git] / tools / doxygen / index_php.pl
1 #!/usr/bin/perl -w
2
3 ($#ARGV >= 2) or die "Usage: index_php.pl <input-php.in-file> <input-html-file> <output-php-file>";
4
5 my(@toc);
6 my($level,$label,$name);
7
8 $inputphp  = $ARGV[0];
9 $inputhtml  = $ARGV[1];
10 $output = $ARGV[2];
11
12 my($onglets) = "";
13 my($body) = "";
14
15 open FILE,$inputhtml;
16 while(defined($line=<FILE>)) {
17     if($line =~/<div class="tabs">/) {
18         $onglets = $line;
19         while(defined($line=<FILE>) && !($line =~/<\/div>/)) {
20             $onglets.=$line;
21         }
22         $onglets.=$line;
23         $onglets.="<center></center><p><br>\n"
24     } 
25     if($line =~/<!-- ______BODY_BEGIN______ --!>(.*)$/) {
26         $tmp=$1;
27         if($tmp =~/(.*)<!-- ______BODY_END______ --!>/) {
28             $body .= $1;
29         } else {
30             $body .= $tmp;
31             while(defined($line=<FILE>) && !($line =~/<!-- ______BODY_END______ --!>/)) {
32                 $body.=$line;
33             }
34             $line =~/^(.*)<!-- ______BODY_END______ --!>/;
35             $body.=$1;
36         }
37     }
38 }
39 close FILE;
40
41 $onglets =~ s/href=\"/href=\"doc\//gi;
42 $onglets =~ s/src=\"/src=\"doc\//gi;
43
44 $body =~ s/href=\"/href=\"doc\//gi;
45 $body =~ s/src=\"/src=\"doc\//gi;
46
47 open FILE,$inputphp;
48 open OUTPUT,"> $output";
49
50 while(defined($line=<FILE>)) {
51     chomp $line;
52     if($line =~/______ONGLETS______/) {
53         $line =~ s/______ONGLETS______/$onglets/g;
54     } elsif($line =~/______BODY______/) {
55         $line =~ s/______BODY______/$body/g;
56     }
57     print OUTPUT "$line\n";
58 }
59
60 close(FILE);
61 close(OUTPUT);