Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
there is no publication page in the in-tarball documentation anymore (kill dead code)
[simgrid.git] / tools / doxygen / doxygen_postprocesser.pl
index da9a38c..d35168f 100755 (executable)
@@ -3,15 +3,17 @@
 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/history.html html/contrib.html html/people.html
-                     html/publis.html html/publis_core.html html/publis_extern.html html/publis_intra.html
-                     html/pages.html html/modules.html  html/annotated.html index.php 
-                     html/GRAS_tut.html);
+my @extra_files = qw(html/index.html html/pages.html html/modules.html html/annotated.html html/functions.html 
+                                        html/functions_vars.html index.php 
+                     html/GRAS_tut.html html/tracing.html html/platform.html html/install.html html/bindings.html
+                     html/options.html html/use.html html/pls.html html/FAQ.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);
+                                                          tour_logs tour_timers tour_exceptions tour_simpledata tour_rpc tour_explicitwait
+                                                          tour_message_recaping tour_staticstruct tour_pointers tour_dynar 
+                                                          tour_manualdatadef tour_exchangecb);
 
 # GRAS examples
 map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
@@ -162,45 +164,6 @@ close OUT;
 close IN;
 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
 
-# the publication pages deserves some special handling too
-my %pub_tabs = ("publis.html"       =>"Reference publications",
-                "publis_core.html"  =>"Other publication about SimGrid",
-                "publis_extern.html"=>"External papers using SimGrid",
-                "publis_intra.html"=>"Internal papers using SimGrid");
-# force ordering
-my @pub_titles = ("publis.html", "publis_core.html", "publis_extern.html", "publis_intra.html");
-sub handle_pub{
-    my $oldname = shift;
-    my $newname = $oldname;
-    $newname =~ s/\.html$/.new.html/;
-#    print "Handle_pub($oldname -> $newname)\n";
-    
-    open IN,"html/$oldname" || die "Cannot open $oldname";
-    open OUT,">html/$newname" || die "Cannot open $newname";
-    my $line;
-    while ($line = <IN>) {
-       last if $line =~ /<h1>/;
-       print OUT $line;
-    }
-
-    print OUT "<div class=\"tabs\">\n<ul class=\"tablist\">\n";
-    foreach my $page (@pub_titles) {
-       print OUT "         <li".($page eq $oldname? " class=\"current\"":"" )."> <a href=\"$page\"><span>".($pub_tabs{$page})."</span></a></li>\n";
-    }
-
-    print OUT "  </ul></div>\n";
-    print OUT $line;
-    while ($line = <IN>) {
-       print OUT $line;
-    }
-    close OUT;
-    close IN;
-    rename("html/$newname","html/$oldname") unless $debug{'rename'};
-}
-map {handle_pub($_)} @pub_titles;
-
-
 # Operate the recursion
 sub handle_page {
   my $current=shift;
@@ -211,7 +174,8 @@ sub handle_page {
   # we generate the tabs bottom up begining from where we are in the tree
   # and display them top down, as it should in a file
   my @tabs = ();
-
+  my $found_div_tabs=0;
+  
   if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
 #    print "handle $current->{'file'}, at level $level\n";
     # generate the tabs
@@ -246,11 +210,13 @@ sub handle_page {
       # add "current" to the module API granfather page
       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 $_";
+         $found_div_tabs=1 if m/div.*class="tabs"/;    
       print TO "$_";
-      last if (m|</div>|);
+      last if ((m|</div>|)&&($found_div_tabs));
     }
-      
+    
     print TO "\n<!-- POST-PROCESSED TABS -->\n";
+             
     foreach (@tabs) {
 #      print "TAB: $_";
       print TO "$_";
@@ -258,26 +224,26 @@ sub handle_page {
     print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
       
     if ($current->{'file'} =~ m/^class/) {
-       while (<FROM>) {
-           last if (m|</div>|);
-       }
+         while (<FROM>) {
+               last if (m|</div>|);
+         }
       print TO "$_";   
     }
     while (<FROM>) {
       if (m/POST-PROCESSED TABS/) {
-         while (<FROM>) {
+           while (<FROM>) {
              last if (m/END OF POST-PROCESSED TABS/);
-         }
-         next;
+           }
+           next;
       }
 
       if (m/The documentation for/) {
-         while (<FROM>) {
+           while (<FROM>) {
              last if (m/<p>/);
-         }
+           }
       }
       print TO "$_";
-    }    
+    }
     close FROM;
     close TO;
     rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
@@ -292,15 +258,51 @@ sub handle_page {
 ###
 ### Launch the modules navbar reworking
 ###
-handle_page($top,-2);# skip roots (we have 2 roots) in level counting
+handle_page($top,-1);# skip roots (we have 2 roots) in level counting
 
+###
+### Add the modules navbar reworking to the modules.html file
+###
+sub add_tabs_to_module_html {
+  my $found_div_tabs=0;
+  my $module_tabs = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
+  foreach my $entry (@{$top->{'down'}}) {
+      $module_tabs .= "  <li> <a href=\"$entry->{'file'}\"><span>$entry->{'label'}</span></a></li>\n";
+  }
+  $module_tabs .= "  </ul></div>\n";      
+  
+  my $oldname = "html/modules.html";
+  open FROM,$oldname || die;
+  my $newname=$oldname;
+  $newname =~ s/.html/.handlepage.html/;
+  open TO,">$newname" || die;
+  while (<FROM>) {
+    $found_div_tabs=1 if m/div.*class="tabs"/; 
+       print TO "$_";
+       last if ((m|</div>|)&&($found_div_tabs));
+  }
+  
+  print TO "\n<!-- POST-PROCESSED TABS -->\n";
+  print TO $module_tabs;
+  print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
+
+  while (<FROM>) {
+       print TO "$_";
+  }  
+  close FROM;
+  close TO;
+  rename($newname, $oldname) unless $debug{'rename'};
+  
+  # die;
+}   
+
+add_tabs_to_module_html;
 
 ###
 ### Post-processsing common to all pages
 ###
 map {push @allfiles,$_} @extra_files;
 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
-
 my $tabs;
 
 foreach my $file (@allfiles) {
@@ -316,46 +318,118 @@ foreach my $file (@allfiles) {
       print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
         if (m|</head>|);
 
+         if($tabs){
+                 if($file =~ /^html\/index\..*/){
+                       $_ =~ s/<li class="current">/<li>/g;
+                       $_ =~ s/<li><a href="index.html">/<li class="current"><a href="index.html">/g;
+                 }               
+                 $_ =~ s/<li class="current"><a href="pages.html">/<li><a href="pages.html">/g;
+                 
+                 if($file =~ /^html\/pages\..*/){
+                       $_ =~ s/<li><a href="pages.html">/<li class="current"><a href="pages.html">/g;
+                 }
+         }
+         
+         if($file =~ /^html\/publis.*/){
+                       $_ =~ s/<div class="header">/<div>/g;
+                       $_ =~ s/<div class="headertitle">/<div>/g;
+        }
+       
+         # Add the FAQ PUBLIS PEOPLE HISTORY and CONTRIB to the top navbar.
+      if( $_ =~ /<div.*class="tabs">/){
+       $tabs = 1;
+      }
+      if( $_ =~ /<\/div>/){
+       $tabs = 0;
+      }
+      if( $_ =~ /<\/ul>/ && $tabs){
+               my $tmp_buff="";
+               $tmp_buff .= '      <li><a href="use.html"><span>Using SimGrid</span></a></li>'."\n";
+               $tmp_buff .= '      <li><a href="http://gforge.inria.fr/projects/simgrid"><span>Forge</span></a></li>'."\n";
+               $tmp_buff .= '      <li><a href="http://simgrid.gforge.inria.fr/"><span>Website</span></a></li>'."\n";
+               $tmp_buff .= '      <li><a href="pages.html"><span>Documentation&nbsp;index</span></a></li>'."\n";
+               $tmp_buff .= '      <li><a href="FAQ.html"><span>FAQ</span></a></li>'."\n";
+               $tmp_buff .= $_;
+               $tabs = 0;
+
+             # Rework the navbar and add menu for use.html
+             # Fix the current "button" of buggy Doxygen tabs  
+             if($file =~ /^html\/use.*/
+             || $file =~ /^html\/install.*/
+             || $file =~ /^html\/options.*/
+             || $file =~ /^html\/tracing.*/ 
+             || $file =~ /^html\/platform.*/ 
+             || $file =~ /^html\/bindings.*/
+             || $file =~ /^html\/pls.*/
+             || $file =~ /^html\/modules.*/
+             || $file =~ /^html\/annotated.*/
+             || $file =~ /^html\/group__.*/
+             || $file =~ /^html\/functions.*/
+             || $file =~ /^html\/GRAS_tut_tour_.*/)
+             {
+                               $tmp_buff .= '      <div class="tabs_group_use">'."\n";
+                               $tmp_buff .= '          <ul class="tablist">'."\n";
+                               $tmp_buff .= '          <li><a href="install.html"><span>Installing SimGrid</span></a></li>'."\n";
+                               $tmp_buff .= '          <li><a href="modules.html"><span>Modules&#160;API</span></a></li>'."\n";
+                               $tmp_buff .= '          <li><a href="options.html"><span>Options & configurations</span></a></li>'."\n";
+                               $tmp_buff .= '          <li><a href="platform.html"><span>Platform Description</span></a></li>'."\n";
+                               $tmp_buff .= '          <li><a href="tracing.html"><span>Tracing Simulations</span></a></li>'."\n";
+                               $tmp_buff .= '          <li><a href="bindings.html"><span>Bindings</span></a></li>'."\n";
+                               $tmp_buff .= '          <li><a href="pls.html"><span>Packet-Level Simulation</span></a></li>'."\n";
+                               $tmp_buff .= '          </ul></div>'."\n";
+                               $tmp_buff .= '      </div>'."\n";
+                               
+                               my $filename = $file;
+                       $filename =~ s/html\///g;
+                       $filename =~ s/\.html//g;
+                       $filename =~ s/publis_.*/publis/g;
+                       $tmp_buff =~ s/<li class="current">/<li>/g;
+                       $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
+                       $tmp_buff =~ s/<li><a href="use.html">/<li class="current"><a href="use.html">/g; 
+                               
+             }
        
-      # Rework the navbar
-      if($file =~ "^html/index.*"){
-             if ($_ =~ /<li><a href="index.html"><span>Main&#160;Page<\/span><\/a><\/li>/) {
-               print TO '      <li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>'."\n";
-               next;
+             # Rework the navbar
+             # Fix the current "button" of buggy Doxygen tabs   
+             if($file =~ /^html\/pages.*/
+             || $file =~ /^html\/FAQ.*/)
+             {
+                     my $filename = $file;
+                     $filename =~ s/html\///g;
+                     $filename =~ s/\.html//g;
+                     $tmp_buff =~ s/<li class="current">/<li>/g;
+                     $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;     
              }
-             elsif ($_ =~ /[\ ]*<li class="current">.*/) {
-               $_ =~ s/ class="current"//g;
-               print TO $_;
-               next;
+             if($file =~ /^html\/group__.*/
+             || $file =~ /^html\/GRAS_tut_tour_.*/)
+             {
+               $tmp_buff =~ s/<li><a href="modules.html">/<li class="current"><a href="modules.html">/g;
              }
-      }
-      if($file =~ "^html/faq.*"){
-               if ($_ =~ /[\ ]*<li class="current">.*/) {
-               $_ =~ s/ class="current"//g;
-               print TO $_;
-               next;
+             if($file =~ /^html\/functions.*/)
+             {
+               $tmp_buff =~ s/<li><a href="annotated.html">/<li class="current"><a href="annotated.html">/g;
              }
+             
+             print TO $tmp_buff;             
+             next;
+    }
+      s|<span>Modules</span>|<span>Modules&#160;API</span>|g;
+      s|<li.*><a href="pages.html"><span>Related&#160;Pages</span></a></li>\n||g;
+      s|<li class="current"><a href="modules.html"><span>Modules&#160;API</span></a></li>\n||g;
+      s|<li class="current"><a href="modules.html"><span>Modules&nbsp;API</span></a></li>\n||g;
+      if($file =~ /^html\/group__.*/)
+      {
+       s|<li><a href="use.html">|<li class="current"><a href="use.html">|g;
+       s|<li><a href="modules.html"><span>Modules&#160;API</span></a></li>\n|<li class="current"><a href="modules.html"><span>Modules&#160;API</span></a></li>\n|g;
       }
-      if( $_ =~ /<div.*class="tabs">/){$tabs = 1;}
-      if( $_ =~ /<\/div>/){$tabs = 0;}
-      if( $_ =~ /<\/ul>/ && $tabs){
-               if($file =~ "^html/faq.*"){
-               print TO '      <li class="current"><a href="faq.html"><span>FAQ&#160;Page</span></a></li>'."\n";}
-               else{
-               print TO '      <li><a href="faq.html"><span>FAQ&#160;Page</span></a></li>'."\n";}
-               print TO $_;
-               next;
+      else
+      {
+       s|<li><a href="modules.html"><span>Modules&#160;API</span></a></li>\n||g;
       }
-#      if (m,<li><a href="(doc/)?annotated.html"><span>Data\&nbsp;Structures</span></a></li>,) {
-#        print TO '    <li'.($file =~ m,(doc/)?publis(_[^.]*)?.html, ? " class='current'" :"").'><a href="'.$1.'publis.html"><span>Publications</span></a></li>'."\n";
-#        print TO '    <li'.($file =~ m,(doc/)?people.html, ? " class='current'" :"").'><a href="'.$1.'people.html"><span>People</span></a></li>'."\n";
-#        print TO '    <li'.($file =~ m,(doc/)?history.html, ? " class='current'" :"").'><a href="'.$1.'history.html"><span>History</span></a></li>'."\n";
-#        print TO '    <li'.($file =~ m,(doc/)?contrib.html, ? " class='current'" :"").'><a href="'.$1.'contrib.html"><span>Contrib</span></a></li>'."\n";
-#        next;
-#      }
-      s|<span>Modules</span>|<span>Modules API</span>|g;
-      s|<span>Related&nbsp;Pages</span>|<span>Site&nbsp;Plan</span>|g;
-                                                                                                 
+      s|<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>\n||g;    
+      s|<li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>\n||g;
+      s|Related Pages<|Documentation&nbsp;index<|g;
+                                                                                           
       print TO $_;
     }
     close FROM;