Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure our granfather is highlighted too (bugfix)
[simgrid.git] / tools / doxygen / doxygen_postprocesser.pl
index b5c4803..37f925c 100755 (executable)
@@ -2,11 +2,16 @@
 
 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 %debug;
 $debug{'parse'} = 0; # show how we parse the module tree
 $debug{'input'} = 0; # display the resulting tree
+$debug{'handle'}= 0; # Be verbose on the post-processing
 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
 
+my @allfiles;
 ###
 ### Get the module definitions
 ###
@@ -53,6 +58,7 @@ while (<IN>) {
   $entry->{'up'} = $current;
   push @{$current->{'down'}},$entry;
   print "Push $1 $2 as child of $current\n" if $debug{'parse'};
+  push @allfiles,"html/$1";
 }
 close IN;
 
@@ -136,6 +142,8 @@ sub handle_page {
   my $current=shift;
   my $level=shift;
 
+  print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
+    
   # 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 = ();
@@ -169,9 +177,8 @@ sub handle_page {
     $newname =~ s/.html/.new.html/;
     open TO,">$newname" || die;
     while (<FROM>) {
-      # add "current" to the module API granfather page
-      s|<li><a href="modules.html"><span>Modules API</span></a></li>|<li id="current"><a href="modules.html"><span>Modules API</span></a></li>|;
-      
+      # 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>|;
     }
@@ -184,6 +191,7 @@ sub handle_page {
     close FROM;
     close TO;
     rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
+#    print "mv $newname html/$current->{'file'}\n";
   } 
   
   # recurse on childs
@@ -192,4 +200,47 @@ sub handle_page {
   }
 }
 
+###
+### Launch the modules navbar reworking
+###
 handle_page($top,-2);# skip roots (we have 2 roots) in level counting
+
+
+###
+### Post-processsing common to all pages
+###
+map {push @allfiles,$_} @extra_files;
+
+foreach my $file (@allfiles) {
+    open FROM,"$file" || die;
+    my $outfile = "$file";
+    $outfile =~ s/.(html|php)$/.new.$1/;
+    open TO,">$outfile" || die;
+#    print "POSTPROCESSING $file (tmp=$outfile)\n";
+    while (<FROM>) {
+      # Add the simgrid css, just in case
+      print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
+        if (m|</head>|);
+
+      # 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";
+        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";
+        next;
+      }
+      s|<span>Modules</span>|<span>Modules API</span>|g;
+      s|<li><a href="(doc/)?dirs.html"><span>Directories</span></a></li>||g;
+                                                                                                 
+      print TO $_;
+    }
+    close FROM;
+    close TO;
+    rename("$outfile", "$file") unless $debug{'rename'};
+}
+
+
+