5 # Add here the pages of the documentation generated by a @page doxygen macro
6 my @extra_files = qw(html/index.html 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
8 html/pages.html html/modules.html html/annotated.html html/functions.html html/functions_vars.html index.php
9 html/GRAS_tut.html html/installSimgrid.html html/bindings.html html/options.html html/use.html html/gtnets.html
13 map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
14 tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
15 tour_logs tour_timers tour_exceptions tour_rpc);
18 map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
21 $debug{'parse'} = 0; # show how we parse the module tree
22 $debug{'input'} = 0; # display the resulting tree
23 $debug{'handle'}= 0; # Be verbose on the post-processing
24 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
28 ### Get the module definitions
31 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
35 last if /group__SimGrid__API.html/;
43 # $current->{'label'}="ROOT";
44 # push @{$top->{'down'}},$current;
45 # print "Push $current '".($current->{'label'})."' as child of $top '".($top->{'label'})."'\n" if $debug{'parse'};
47 $top->{'label'}="ROOT";
48 print "Create ROOT $top\n" if $debug{'parse'};
52 # Read the whole data to postprocess it a bit
57 $in =~ s/<ul>/\n<ul>\n/sg;
58 foreach $_ (split(/\n/,$in)) {
59 next unless length($_);
60 next if ($_ =~ m|^</li>$|);
61 print " Seen '$_'\n" if $debug{'parse'};
63 print "DOWN: $current '$current->{'label'}' -> " if $debug{'parse'};
64 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
65 print "$current '$current->{'label'}'\n" if $debug{'parse'};
69 $current = $current->{'up'};
70 print "UP to $current '$current->{'label'}'\n" if $debug{'parse'};
77 m|href="([^"]*)">([^<]*)</a>|; #"
80 $entry->{'file'} = $1;
81 $entry->{'label'} = $2;
82 $entry->{'up'} = $current;
83 push @{$current->{'down'}},$entry;
84 print "Push file:$1 label:'$2' as child of $current '$current->{'label'}'\n" if $debug{'parse'};
85 push @allfiles,"html/$1";
89 # Check each file for extra information (short name, extra childs)
93 if (defined($current->{'file'})) {
94 open IN, "html/$current->{'file'}";
96 if (/DOXYGEN_NAVBAR_LABEL/) {
97 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
98 print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
99 $current->{'label'}=$1;
101 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
104 if (/DOXYGEN_NAVBAR_CHILD/) {
105 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
107 $entry->{'label'} = $1;
108 $entry->{'file'} = $2;
109 chomp($entry->{'file'});
110 $entry->{'up'} = $current;
111 push @{$current->{'down'}},$entry;
112 print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n" if $debug{'parse'};
114 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
120 foreach my $entry (@{$current->{'down'}}) {
131 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
132 foreach my $entry (@{$current->{'down'}}) {
133 display($entry,$level+1);
137 display($top,0) if $debug{'input'};
140 ### Generate the navbar
143 # the root deserves some special handling
144 open IN,"html/modules.html" || die;
145 open OUT,">html/modules.new.html" || die;
147 while ($line = <IN>) {
148 last if $line =~ /<h1>SimGrid Modules</;
152 print OUT "<div class=\"tabs\">\n <ul class=\"tablist\">\n";
153 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
154 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
156 print OUT " </ul></div>\n";
164 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
166 # the publication pages deserves some special handling too
167 my %pub_tabs = ("publis.html" =>"Reference publications",
168 "publis_core.html" =>"Other publication about SimGrid",
169 "publis_extern.html"=>"External papers using SimGrid",
170 "publis_intra.html"=>"Internal papers using SimGrid");
172 my @pub_titles = ("publis.html", "publis_core.html", "publis_extern.html", "publis_intra.html");
175 my $newname = $oldname;
176 $newname =~ s/\.html$/.new.html/;
178 # print "Handle_pub($oldname -> $newname)\n";
180 open IN,"html/$oldname" || die "Cannot open $oldname";
181 open OUT,">html/$newname" || die "Cannot open $newname";
183 while ($line = <IN>) {
184 last if $line =~ /<h1>/;
188 print OUT "<div class=\"tabs\">\n<ul class=\"tablist\">\n";
189 foreach my $page (@pub_titles) {
190 print OUT " <li".($page eq $oldname? " class=\"current\"":"" )."> <a href=\"$page\"><span>".($pub_tabs{$page})."</span></a></li>\n";
193 print OUT " </ul></div>\n";
195 while ($line = <IN>) {
200 rename("html/$newname","html/$oldname") unless $debug{'rename'};
202 map {handle_pub($_)} @pub_titles;
205 # Operate the recursion
210 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
212 # we generate the tabs bottom up begining from where we are in the tree
213 # and display them top down, as it should in a file
215 my $found_div_tabs=0;
217 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
218 # print "handle $current->{'file'}, at level $level\n";
220 my $iterator = $current;
222 while ($lvl_it >= 0) {
223 my $father = $iterator->{'up'};
224 $tabs[$lvl_it] = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
225 foreach my $bro (@{$father->{'down'}}) {
226 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
228 $tabs[$lvl_it] .= " </ul></div>\n";
232 if (defined $current->{'down'}) { # there's some kid. Display them too
233 $tabs[$level+1] = "<div class=\"tabs2\">\n <ul class=\"tablist\">\n";
234 foreach my $kid (@{$current->{'down'}}) {
235 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
237 $tabs[$level+1] .= " </ul></div>\n";
241 open FROM,"html/$current->{'file'}" || die;
242 my $newname="html/$current->{'file'}";
243 $newname =~ s/.html/.handlepage.html/;
244 open TO,">$newname" || die;
245 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
248 # add "current" to the module API granfather page
249 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
250 # print "++Write $_";
251 $found_div_tabs=1 if m/div.*class="tabs"/;
253 last if ((m|</div>|)&&($found_div_tabs));
256 print TO "\n<!-- POST-PROCESSED TABS -->\n";
261 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
263 if ($current->{'file'} =~ m/^class/) {
270 if (m/POST-PROCESSED TABS/) {
272 last if (m/END OF POST-PROCESSED TABS/);
277 if (m/The documentation for/) {
286 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
290 foreach my $entry (@{$current->{'down'}}) {
291 handle_page($entry,$level+1);
296 ### Launch the modules navbar reworking
298 handle_page($top,-1);# skip roots (we have 2 roots) in level counting
301 ### Add the modules navbar reworking to the modules.html file
303 sub add_tabs_to_module_html {
304 my $found_div_tabs=0;
305 my $module_tabs = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
306 foreach my $entry (@{$top->{'down'}}) {
307 $module_tabs .= " <li> <a href=\"$entry->{'file'}\"><span>$entry->{'label'}</span></a></li>\n";
309 $module_tabs .= " </ul></div>\n";
311 my $oldname = "html/modules.html";
312 open FROM,$oldname || die;
313 my $newname=$oldname;
314 $newname =~ s/.html/.handlepage.html/;
315 open TO,">$newname" || die;
317 $found_div_tabs=1 if m/div.*class="tabs"/;
319 last if ((m|</div>|)&&($found_div_tabs));
322 print TO "\n<!-- POST-PROCESSED TABS -->\n";
323 print TO $module_tabs;
324 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
331 rename($newname, $oldname) unless $debug{'rename'};
336 add_tabs_to_module_html;
339 ### Post-processsing common to all pages
341 map {push @allfiles,$_} @extra_files;
342 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
346 foreach my $file (@allfiles) {
347 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
349 open FROM,"$file" || die;
350 my $outfile = "$file";
351 $outfile =~ s/.(html|php)$/.new.$1/;
352 open TO,">$outfile" || die;
353 # print "POSTPROCESSING $file (tmp=$outfile)\n";
355 # Add the simgrid css, just in case
356 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
360 if($file =~ /^html\/index\..*/){
361 $_ =~ s/<li class="current">/<li>/g;
362 $_ =~ s/<li><a href="index.html">/<li class="current"><a href="index.html">/g;
364 $_ =~ s/<li class="current"><a href="pages.html">/<li><a href="pages.html">/g;
366 if($file =~ /^html\/pages\..*/){
367 $_ =~ s/<li><a href="pages.html">/<li class="current"><a href="pages.html">/g;
371 if($file =~ /^html\/publis.*/){
372 $_ =~ s/<div class="header">/<div>/g;
373 $_ =~ s/<div class="headertitle">/<div>/g;
376 # Add the FAQ PUBLIS PEOPLE HISTORY and CONTRIB to the top navbar.
377 if( $_ =~ /<div.*class="tabs">/){
380 if( $_ =~ /<\/div>/){
383 if( $_ =~ /<\/ul>/ && $tabs){
385 $tmp_buff .= ' <li><a href="use.html"><span>Using SimGrid</span></a></li>'."\n";
386 $tmp_buff .= ' <li><a href="faq.html"><span>FAQ Page</span></a></li>'."\n";
387 $tmp_buff .= ' <li><a href="publis.html"><span>Publications</span></a></li>'."\n";
388 $tmp_buff .= ' <li><a href="people.html"><span>People</span></a></li>'."\n";
389 $tmp_buff .= ' <li><a href="history.html"><span>History</span></a></li>'."\n";
390 $tmp_buff .= ' <li><a href="contrib.html"><span>Contrib</span></a></li>'."\n";
391 $tmp_buff .= ' <li><a href="http://gforge.inria.fr/projects/simgrid"><span>Simgrid Forge</span></a></li>'."\n";
392 $tmp_buff .= ' <li><a href="http://simgrid.gforge.inria.fr/"><span>Home</span></a></li>'."\n";
393 $tmp_buff .= ' <li><a href="pages.html"><span>Site Map</span></a></li>'."\n";
397 # Rework the navbar and add menu for use.html
398 # Fix the current "button" of buggy Doxygen tabs
399 if($file =~ /^html\/use.*/
400 || $file =~ /^html\/installSimgrid.*/
401 || $file =~ /^html\/options.*/
402 || $file =~ /^html\/bindings.*/
403 || $file =~ /^html\/gtnets.*/
404 || $file =~ /^html\/ns3.*/
405 || $file =~ /^html\/modules.*/
406 || $file =~ /^html\/annotated.*/)
408 $tmp_buff .= ' <div class="tabs_group_use">'."\n";
409 $tmp_buff .= ' <ul class="tablist">'."\n";
410 $tmp_buff .= ' <li><a href="installSimgrid.html"><span>Install SimGrid</span></a></li>'."\n";
411 $tmp_buff .= ' <li><a href="modules.html"><span>Modules API</span></a></li>'."\n";
412 $tmp_buff .= ' <li><a href="annotated.html"><span>Data Structures</span></a></li>'."\n";
413 $tmp_buff .= ' <li><a href="options.html"><span>Options & configurations</span></a></li>'."\n";
414 $tmp_buff .= ' <li><a href="bindings.html"><span>Bindings</span></a></li>'."\n";
415 $tmp_buff .= ' <li><a href="gtnets.html"><span>GTNets</span></a></li>'."\n";
416 $tmp_buff .= ' <li><a href="ns3.html"><span>NS3</span></a></li>'."\n";
417 $tmp_buff .= ' </ul></div>'."\n";
418 $tmp_buff .= ' </div>'."\n";
420 my $filename = $file;
421 $filename =~ s/html\///g;
422 $filename =~ s/\.html//g;
423 $filename =~ s/publis_.*/publis/g;
424 $tmp_buff =~ s/<li class="current">/<li>/g;
425 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
426 $tmp_buff =~ s/<li><a href="use.html">/<li class="current"><a href="use.html">/g;
431 # Fix the current "button" of buggy Doxygen tabs
432 if($file =~ /^html\/publis.*/
433 || $file =~ /^html\/faq.*/
434 || $file =~ /^html\/people.*/
435 || $file =~ /^html\/history.*/
436 || $file =~ /^html\/contrib.*/
437 || $file =~ /^html\/pages.*/)
439 my $filename = $file;
440 $filename =~ s/html\///g;
441 $filename =~ s/\.html//g;
442 $filename =~ s/publis_.*/publis/g;
443 $tmp_buff =~ s/<li class="current">/<li>/g;
444 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
451 s|<span>Modules</span>|<span>Modules API</span>|g;
452 s|<li.*><a href="pages.html"><span>Related Pages</span></a></li>\n||g;
453 s|<li><a href="modules.html"><span>Modules API</span></a></li>\n||g;
454 s|<li><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
455 s|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>\n||g;
456 s|<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>\n||g;
457 s|Related Pages<|Site Map<|g;
463 rename("$outfile", "$file") unless $debug{'rename'};