5 # Add here the pages of the documentation generated by a @page doxygen macro
6 my @extra_files = qw(html/faq.html html/history.html html/contrib.html html/people.html
7 html/publis.html html/publis_core.html html/publis_extern.html html/publis_intra.html);
11 $debug{'parse'} = 0; # show how we parse the module tree
12 $debug{'input'} = 0; # display the resulting tree
13 $debug{'handle'}= 0; # Be verbose on the post-processing
14 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
18 ### Get the module definitions
21 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
25 last if /group__SimGrid__API.html/;
33 # $current->{'label'}="ROOT";
34 # push @{$top->{'down'}},$current;
35 # print "Push $current '".($current->{'label'})."' as child of $top '".($top->{'label'})."'\n" if $debug{'parse'};
37 $top->{'label'}="ROOT";
38 print "Create ROOT $top\n" if $debug{'parse'};
42 # Read the whole data to postprocess it a bit
47 $in =~ s/<ul>/\n<ul>\n/sg;
48 foreach $_ (split(/\n/,$in)) {
49 next unless length($_);
50 next if ($_ =~ m|^</li>$|);
51 print " Seen '$_'\n" if $debug{'parse'};
53 print "DOWN: $current '$current->{'label'}' -> " if $debug{'parse'};
54 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
55 print "$current '$current->{'label'}'\n" if $debug{'parse'};
59 $current = $current->{'up'};
60 print "UP to $current '$current->{'label'}'\n" if $debug{'parse'};
67 m|href="([^"]*)">([^<]*)</a>|; #"
70 $entry->{'file'} = $1;
71 $entry->{'label'} = $2;
72 $entry->{'up'} = $current;
73 push @{$current->{'down'}},$entry;
74 print "Push file:$1 label:'$2' as child of $current '$current->{'label'}'\n" if $debug{'parse'};
75 push @allfiles,"html/$1";
79 # Check each file for extra information (short name, extra childs)
83 if (defined($current->{'file'})) {
84 open IN, "html/$current->{'file'}";
86 if (/DOXYGEN_NAVBAR_LABEL/) {
87 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
88 print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
89 $current->{'label'}=$1;
91 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
94 if (/DOXYGEN_NAVBAR_CHILD/) {
95 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
97 $entry->{'label'} = $1;
98 $entry->{'file'} = $2;
99 chomp($entry->{'file'});
100 $entry->{'up'} = $current;
101 push @{$current->{'down'}},$entry;
102 print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n" if $debug{'parse'};
104 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
110 foreach my $entry (@{$current->{'down'}}) {
121 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
122 foreach my $entry (@{$current->{'down'}}) {
123 display($entry,$level+1);
127 display($top,0) if $debug{'input'};
130 ### Generate the navbar
133 # the root deserves some special handling
134 open IN,"html/modules.html" || die;
135 open OUT,">html/modules.new.html" || die;
137 while ($line = <IN>) {
138 last if $line =~ /<h1>SimGrid Modules</;
142 print OUT "<div class=\"tabs\">\n <ul class=\"tablist\">\n";
143 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
144 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
146 print OUT " </ul></div>\n";
154 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
156 # the publication pages deserves some special handling too
157 my %pub_tabs = ("publis.html" =>"Reference publications",
158 "publis_core.html" =>"Other publication about SimGrid",
159 "publis_extern.html"=>"External papers using SimGrid",
160 "publis_intra.html"=>"Internal papers using SimGrid");
162 my @pub_titles = ("publis.html", "publis_core.html", "publis_extern.html", "publis_intra.html");
165 my $newname = $oldname;
166 $newname =~ s/\.html$/.new.html/;
168 # print "Handle_pub($oldname -> $newname)\n";
170 open IN,"html/$oldname" || die "Cannot open $oldname";
171 open OUT,">html/$newname" || die "Cannot open $newname";
173 # BIG FAT WARNING : THIS HACK IS DEPENDANT OF THE DOXYGEN VERSION AND OUR TEXT (because of the string we are looking for, that is changing with doxygen version, either h1 or div class="title" ... So we're forced to use titles defined in doc files...
174 while ($line = <IN>) {
175 $line =~ s/<h1>/<h1 align="center">/g;
176 last if (($line =~ /Reference publications about SimGrid/)
177 or ($line =~ /Publications about the SimGrid framework/)
178 or ($line =~ /Papers that use SimGrid-generated results/)
179 or ($line =~ /Our own papers that use SimGrid-generated results/));
183 print OUT "<div class=\"tabs\" align=\"center\">\n<ul class=\"tablist\">\n";
184 foreach my $page (@pub_titles) {
185 print OUT " <li".($page eq $oldname? " class=\"current\"":"" )."> <a href=\"$page\"><span>".($pub_tabs{$page})."</span></a></li>\n";
188 print OUT " </ul></div>\n";
190 while ($line = <IN>) {
195 rename("html/$newname","html/$oldname") unless $debug{'rename'};
197 map {handle_pub($_)} @pub_titles;
200 # Operate the recursion
205 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
207 # we generate the tabs bottom up begining from where we are in the tree
208 # and display them top down, as it should in a file
210 my $found_div_tabs=0;
212 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
213 # print "handle $current->{'file'}, at level $level\n";
215 my $iterator = $current;
217 while ($lvl_it >= 0) {
218 my $father = $iterator->{'up'};
219 $tabs[$lvl_it] = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
220 foreach my $bro (@{$father->{'down'}}) {
221 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
223 $tabs[$lvl_it] .= " </ul></div>\n";
227 if (defined $current->{'down'}) { # there's some kid. Display them too
228 $tabs[$level+1] = "<div class=\"tabs2\">\n <ul class=\"tablist\">\n";
229 foreach my $kid (@{$current->{'down'}}) {
230 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
232 $tabs[$level+1] .= " </ul></div>\n";
236 open FROM,"html/$current->{'file'}" || die;
237 my $newname="html/$current->{'file'}";
238 $newname =~ s/.html/.handlepage.html/;
239 open TO,">$newname" || die;
240 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
243 # add "current" to the module API granfather page
244 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
245 # print "++Write $_";
246 $found_div_tabs=1 if m/div.*class="tabs"/;
248 last if ((m|</div>|)&&($found_div_tabs));
251 print TO "\n<!-- POST-PROCESSED TABS -->\n";
256 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
258 if ($current->{'file'} =~ m/^class/) {
265 if (m/POST-PROCESSED TABS/) {
267 last if (m/END OF POST-PROCESSED TABS/);
272 if (m/The documentation for/) {
281 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
285 foreach my $entry (@{$current->{'down'}}) {
286 handle_page($entry,$level+1);
291 ### Launch the modules navbar reworking
293 handle_page($top,-1);# skip roots (we have 2 roots) in level counting
296 ### Add the modules navbar reworking to the modules.html file
298 sub add_tabs_to_module_html {
299 my $found_div_tabs=0;
300 my $module_tabs = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
301 foreach my $entry (@{$top->{'down'}}) {
302 $module_tabs .= " <li> <a href=\"$entry->{'file'}\"><span>$entry->{'label'}</span></a></li>\n";
304 $module_tabs .= " </ul></div>\n";
306 my $oldname = "html/modules.html";
307 open FROM,$oldname || die;
308 my $newname=$oldname;
309 $newname =~ s/.html/.handlepage.html/;
310 open TO,">$newname" || die;
312 $found_div_tabs=1 if m/div.*class="tabs"/;
314 last if ((m|</div>|)&&($found_div_tabs));
317 print TO "\n<!-- POST-PROCESSED TABS -->\n";
318 print TO $module_tabs;
319 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
326 rename($newname, $oldname) unless $debug{'rename'};
331 add_tabs_to_module_html;
334 ### Post-processsing common to all pages
336 map {push @allfiles,$_} @extra_files;
337 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
341 foreach my $file (@allfiles) {
342 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
344 open FROM,"$file" || die;
345 my $outfile = "$file";
346 $outfile =~ s/.(html|php)$/.new.$1/;
347 open TO,">$outfile" || die;
348 # print "POSTPROCESSING $file (tmp=$outfile)\n";
354 if($file =~ /^html\/index\..*/){
355 $_ =~ s/<li class="current">/<li>/g;
356 $_ =~ s/<li><a href="index.html">/<li class="current"><a href="index.html">/g;
358 $_ =~ s/<li class="current"><a href="pages.html">/<li><a href="pages.html">/g;
360 if($file =~ /^html\/pages\..*/){
361 $_ =~ s/<li><a href="pages.html">/<li class="current"><a href="pages.html">/g;
365 if($file =~ /^html\/publis.*/){
366 $_ =~ s/<div class="header">/<div>/g;
367 $_ =~ s/<div class="headertitle">/<div>/g;
370 # Add the FAQ PUBLIS PEOPLE HISTORY and CONTRIB to the top navbar.
371 if( $_ =~ /<div.*class="tabs">/){
374 if( $_ =~ /<\/div>/){
377 if( $_ =~ /<\/ul>/ && $tabs){
380 # LBO : ugly way to separate doc in 2 separate stuff ...
381 $tmp_buff .= ' <li><a href="download.php"><span>Download</span></a></li>'."\n";
382 $tmp_buff .= ' <li><a href="documentation.php"><span>Online documentation</span></a></li>'."\n";
383 $tmp_buff .= ' <li><a href="publis.html"><span>Publications</span></a></li>'."\n";
384 $tmp_buff .= ' <li><a href="people.html"><span>People</span></a></li>'."\n";
385 $tmp_buff .= ' <li><a href="history.html"><span>History</span></a></li>'."\n";
386 $tmp_buff .= ' <li><a href="contrib.html"><span>Contrib</span></a></li>'."\n";
387 $tmp_buff .= ' <li><a href="faq.html"><span>FAQ Page</span></a></li>'."\n";
390 $tmp_buff .= ' <li><a href="http://gforge.inria.fr/projects/simgrid"><span>SimGrid Forge</span></a></li>'."\n";
396 # Rework the navbar and add menu for use.html
397 # Fix the current "button" of buggy Doxygen tabs
398 if($file =~ /^html\/use.*/
399 || $file =~ /^html\/installSimgrid.*/
400 || $file =~ /^html\/options.*/
401 || $file =~ /^html\/bindings.*/
402 || $file =~ /^html\/gtnets.*/
403 || $file =~ /^html\/ns3.*/
404 || $file =~ /^html\/modules.*/
405 || $file =~ /^html\/annotated.*/)
407 $tmp_buff .= ' <div class="tabs_group_use">'."\n";
408 $tmp_buff .= ' <ul class="tablist">'."\n";
409 $tmp_buff .= ' <li><a href="installSimgrid.html"><span>Install SimGrid</span></a></li>'."\n";
410 $tmp_buff .= ' <li><a href="modules.html"><span>Modules API</span></a></li>'."\n";
411 $tmp_buff .= ' <li><a href="annotated.html"><span>Data Structures</span></a></li>'."\n";
412 $tmp_buff .= ' <li><a href="options.html"><span>Options & configurations</span></a></li>'."\n";
413 $tmp_buff .= ' <li><a href="bindings.html"><span>Bindings</span></a></li>'."\n";
414 $tmp_buff .= ' <li><a href="gtnets.html"><span>GTNets</span></a></li>'."\n";
415 $tmp_buff .= ' <li><a href="ns3.html"><span>NS3</span></a></li>'."\n";
416 $tmp_buff .= ' </ul></div>'."\n";
417 $tmp_buff .= ' </div>'."\n";
419 my $filename = $file;
420 $filename =~ s/html\///g;
421 $filename =~ s/\.html//g;
422 $filename =~ s/publis_.*/publis/g;
423 $tmp_buff =~ s/<li class="current">/<li>/g;
424 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
425 $tmp_buff =~ s/<li><a href="use.html">/<li class="current"><a href="use.html">/g;
430 # Fix the current "button" of buggy Doxygen tabs
431 if($file =~ /^html\/publis.*/
432 || $file =~ /^html\/faq.*/
433 || $file =~ /^html\/people.*/
434 || $file =~ /^html\/history.*/
435 || $file =~ /^html\/contrib.*/
436 || $file =~ /^html\/pages.*/)
438 my $filename = $file;
439 $filename =~ s/html\///g;
440 $filename =~ s/\.html//g;
441 $filename =~ s/publis_.*/publis/g;
442 $tmp_buff =~ s/<li class="current">/<li>/g;
443 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
451 s|<li><a href="index.html"><span>Main Page</span>|<li><a href="index.php"><span>Home</span>|g;
452 s|<span>Main Page</span>|<span>Home</span>|g;
453 s|<span>Modules</span>|<span>Modules API</span>|g;
454 s|<li.*><a href="pages.html"><span>Related Pages</span></a></li>\n||g;
455 s|<li><a href="modules.html"><span>Modules API</span></a></li>\n||g;
456 s|<li><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
457 s|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n||g;
458 s|<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
459 s|Related Pages<|Documentation Index<|g;
460 s|<div id="navrow|<div align="center" id="navrow|g;
461 s|<div class="headertitle">|<div class="headertitle" align="center">|g;
466 rename("$outfile", "$file") unless $debug{'rename'};