Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow users to disable Java binding, even if the configure thinks it found the tools
[simgrid.git] / tools / doxygen / doxygen_postprocesser.pl
index 37f925c..d351a0d 100755 (executable)
@@ -3,7 +3,15 @@
 use strict;
 
 # Add here the pages of the documentation generated by a @page doxygen macro
-my @extra_files = qw(html/index.html html/faq.html html/publis.html html/pages.html html/modules.html html/contrib.html index.php);
+my @extra_files = qw(html/index.html html/faq.html html/publis.html html/pages.html html/modules.html html/contrib.html index.php html/GRAS_tut.html);
+
+# GRAS tutorial
+map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro 
+                                                     tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals 
+                                                          tour_logs tour_timers tour_exceptions tour_rpc);
+
+# GRAS examples
+map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
 
 my %debug;
 $debug{'parse'} = 0; # show how we parse the module tree
@@ -30,9 +38,9 @@ my $entry;
 
 $current->{'label'}="ROOT";
 push @{$top->{'down'}},$current;
+print "Push $current as child of $top\n" if $debug{'parse'};
 $current=$top;
 
-print "Push $current as child of $top\n" if $debug{'parse'};
 
 while (<IN>) {
   if (/<ul>/) {
@@ -71,6 +79,7 @@ sub extra_info {
     while (<IN>) {
       if (/DOXYGEN_NAVBAR_LABEL/) {
         if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
+          print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
           $current->{'label'}=$1;
         } else {
           die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
@@ -84,6 +93,7 @@ sub extra_info {
           chomp($entry->{'file'});
           $entry->{'up'} = $current;
           push @{$current->{'down'}},$entry;
+          print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n"  if $debug{'parse'};
         } else {
           die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
         }
@@ -157,7 +167,7 @@ sub handle_page {
       my $father = $iterator->{'up'};
       $tabs[$lvl_it] = "<div class=\"tabs\">\n  <ul>\n";
       foreach my $bro (@{$father->{'down'}}) {
-        $tabs[$lvl_it] .= "  <li".($bro==$iterator?" id=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";      
+        $tabs[$lvl_it] .= "  <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";      
       }
       $tabs[$lvl_it] .= "  </ul></div>\n";
       $iterator = $father;
@@ -174,24 +184,27 @@ sub handle_page {
     # put them in place
     open FROM,"html/$current->{'file'}" || die;
     my $newname="html/$current->{'file'}";
-    $newname =~ s/.html/.new.html/;
+    $newname =~ s/.html/.handlepage.html/;
     open TO,">$newname" || die;
+#    print "XXX Deal with html/$current->{'file'}  ->  $newname\n";
     while (<FROM>) {
+#      print "--Read  $_";
       # add "current" to the module API granfather page
-      s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li id="current"><a href="modules.html"><span>Modules API</span></a></li>|;
-      print TO $_;
-      last if m|</ul></div>|;
+      s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules&nbsp;API</span></a></li>|;
+#      print "++Write $_";
+      print TO "$_";
+      last if (m|</div>|);
     }
     foreach (@tabs) {
-      print TO $_;
+#      print "TAB: $_";
+      print TO "$_";
     }
     while (<FROM>) {
-      print TO $_;
+      print TO "$_";
     }    
     close FROM;
     close TO;
     rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
-#    print "mv $newname html/$current->{'file'}\n";
   } 
   
   # recurse on childs
@@ -212,6 +225,8 @@ handle_page($top,-2);# skip roots (we have 2 roots) in level counting
 map {push @allfiles,$_} @extra_files;
 
 foreach my $file (@allfiles) {
+    $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
+       
     open FROM,"$file" || die;
     my $outfile = "$file";
     $outfile =~ s/.(html|php)$/.new.$1/;
@@ -224,16 +239,16 @@ foreach my $file (@allfiles) {
 
       # Rework the navbar
       if (m,<li><a href="(doc/)?index.html"><span>Main\&nbsp;Page</span></a></li>,) {
-        print TO '<li><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
-        print TO '<li><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
+        print TO '    <li'.($file =~ m,(doc/)?index.html, ? " class='current'" :"").'><a href="'.$1.'index.html"><span>Overview</span></a></li>'."\n";
+        print TO '    <li'.($file =~ m,(doc/)?faq.html, ? " class='current'" :"").'><a href="'.$1.'faq.html"><span>FAQ</span></a></li>'."\n";
         next;
       }
       if (m,<li><a href="(doc/)?annotated.html"><span>Data\&nbsp;Structures</span></a></li>,) {
-        print TO '<li><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
+        print TO '    <li'.($file =~ m,(doc/)?publis.html, ? " class='current'" :"").'><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
         next;
       }
       s|<span>Modules</span>|<span>Modules API</span>|g;
-      s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
+#      s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
                                                                                                  
       print TO $_;
     }