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
12 map {push @extra_files, "html/GRAS_tut_$_.html"} qw (intro
13 tour tour_install tour_setup tour_simpleexchange tour_args tour_callbacks tour_globals
14 tour_logs tour_timers tour_exceptions tour_rpc);
17 map {push @extra_files, "html/GRAS_ex_$_.html"} qw (ping mmrpc token timer);
20 $debug{'parse'} = 0; # show how we parse the module tree
21 $debug{'input'} = 0; # display the resulting tree
22 $debug{'handle'}= 0; # Be verbose on the post-processing
23 $debug{'rename'}= 0; # do not overwrite the files (allows several debuging runs without rerunning doxygen)
27 ### Get the module definitions
30 open IN, "html/modules.html" || die "Cannot parse html/modules.html. Did you really run doxygen?\n";
34 last if /group__SimGrid__API.html/;
42 # $current->{'label'}="ROOT";
43 # push @{$top->{'down'}},$current;
44 # print "Push $current '".($current->{'label'})."' as child of $top '".($top->{'label'})."'\n" if $debug{'parse'};
46 $top->{'label'}="ROOT";
47 print "Create ROOT $top\n" if $debug{'parse'};
51 # Read the whole data to postprocess it a bit
56 $in =~ s/<ul>/\n<ul>\n/sg;
57 foreach $_ (split(/\n/,$in)) {
58 next unless length($_);
59 next if ($_ =~ m|^</li>$|);
60 print " Seen '$_'\n" if $debug{'parse'};
62 print "DOWN: $current '$current->{'label'}' -> " if $debug{'parse'};
63 $current = $current->{'down'}[scalar @{$current->{'down'}} - 1];
64 print "$current '$current->{'label'}'\n" if $debug{'parse'};
68 $current = $current->{'up'};
69 print "UP to $current '$current->{'label'}'\n" if $debug{'parse'};
76 m|href="([^"]*)">([^<]*)</a>|; #"
79 $entry->{'file'} = $1;
80 $entry->{'label'} = $2;
81 $entry->{'up'} = $current;
82 push @{$current->{'down'}},$entry;
83 print "Push file:$1 label:'$2' as child of $current '$current->{'label'}'\n" if $debug{'parse'};
84 push @allfiles,"html/$1";
88 # Check each file for extra information (short name, extra childs)
92 if (defined($current->{'file'})) {
93 open IN, "html/$current->{'file'}";
95 if (/DOXYGEN_NAVBAR_LABEL/) {
96 if (/DOXYGEN_NAVBAR_LABEL="([^"]*)"/) {#"
97 print "Extra info from $current->{'file'}: label=$1, not $current->{'label'}\n" if $debug{'parse'};
98 $current->{'label'}=$1;
100 die "Malformated DOXYGEN_NAVBAR_LABEL line in $current->{'file'}";
103 if (/DOXYGEN_NAVBAR_CHILD/) {
104 if (/DOXYGEN_NAVBAR_CHILD *"([^"]*)"=([^ ]*)/) {#"
106 $entry->{'label'} = $1;
107 $entry->{'file'} = $2;
108 chomp($entry->{'file'});
109 $entry->{'up'} = $current;
110 push @{$current->{'down'}},$entry;
111 print "Extra info from $current->{'file'}: New child $entry->{'label'}=$entry->{'file'}\n" if $debug{'parse'};
113 die "Malformated DOXYGEN_NAVBAR_CHILD line in $current->{'file'}";
119 foreach my $entry (@{$current->{'down'}}) {
130 print "$current: ".$current->{'label'}." ($current->{'file'})\n";
131 foreach my $entry (@{$current->{'down'}}) {
132 display($entry,$level+1);
136 display($top,0) if $debug{'input'};
139 ### Generate the navbar
142 # the root deserves some special handling
143 open IN,"html/modules.html" || die;
144 open OUT,">html/modules.new.html" || die;
146 while ($line = <IN>) {
147 last if $line =~ /<h1>SimGrid Modules</;
151 print OUT "<div class=\"tabs\">\n <ul class=\"tablist\">\n";
152 foreach $current (@{ ${$top->{'down'}}[0]->{'down'} }) {
153 print OUT " <li><a href=\"$current->{'file'}\"><span>$current->{'label'}</span></a></li>\n";
155 print OUT " </ul></div>\n";
163 rename("html/modules.new.html","html/modules.html") unless $debug{'rename'};
165 # the publication pages deserves some special handling too
166 my %pub_tabs = ("publis.html" =>"Reference publications",
167 "publis_core.html" =>"Other publication about SimGrid",
168 "publis_extern.html"=>"External papers using SimGrid",
169 "publis_intra.html"=>"Internal papers using SimGrid");
171 my @pub_titles = ("publis.html", "publis_core.html", "publis_extern.html", "publis_intra.html");
174 my $newname = $oldname;
175 $newname =~ s/\.html$/.new.html/;
177 # print "Handle_pub($oldname -> $newname)\n";
179 open IN,"html/$oldname" || die "Cannot open $oldname";
180 open OUT,">html/$newname" || die "Cannot open $newname";
182 while ($line = <IN>) {
183 last if $line =~ /<h1>/;
187 print OUT "<div class=\"tabs\">\n<ul class=\"tablist\">\n";
188 foreach my $page (@pub_titles) {
189 print OUT " <li".($page eq $oldname? " class=\"current\"":"" )."> <a href=\"$page\"><span>".($pub_tabs{$page})."</span></a></li>\n";
192 print OUT " </ul></div>\n";
194 while ($line = <IN>) {
199 rename("html/$newname","html/$oldname") unless $debug{'rename'};
201 map {handle_pub($_)} @pub_titles;
204 # Operate the recursion
209 print "Handle $current->{'file'} at level $level\n" if $debug{'handle'};
211 # we generate the tabs bottom up begining from where we are in the tree
212 # and display them top down, as it should in a file
214 my $found_div_tabs=0;
216 if (defined ($current->{'label'}) and $current->{'label'} ne 'ROOT') {
217 # print "handle $current->{'file'}, at level $level\n";
219 my $iterator = $current;
221 while ($lvl_it >= 0) {
222 my $father = $iterator->{'up'};
223 $tabs[$lvl_it] = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
224 foreach my $bro (@{$father->{'down'}}) {
225 $tabs[$lvl_it] .= " <li".($bro==$iterator?" class=\"current\"":"")."> <a href=\"$bro->{'file'}\"><span>$bro->{'label'}</span></a></li>\n";
227 $tabs[$lvl_it] .= " </ul></div>\n";
231 if (defined $current->{'down'}) { # there's some kid. Display them too
232 $tabs[$level+1] = "<div class=\"tabs2\">\n <ul class=\"tablist\">\n";
233 foreach my $kid (@{$current->{'down'}}) {
234 $tabs[$level+1] .= " <li> <a href=\"$kid->{'file'}\"><span>$kid->{'label'}</span></a></li>\n";
236 $tabs[$level+1] .= " </ul></div>\n";
240 open FROM,"html/$current->{'file'}" || die;
241 my $newname="html/$current->{'file'}";
242 $newname =~ s/.html/.handlepage.html/;
243 open TO,">$newname" || die;
244 # print "XXX Deal with html/$current->{'file'} -> $newname\n";
247 # add "current" to the module API granfather page
248 s|<li><a href="modules.html"><span>[^<]*</span></a></li>|<li class="current"><a href="modules.html"><span>Modules API</span></a></li>|;
249 # print "++Write $_";
250 $found_div_tabs=1 if m/div.*class="tabs"/;
252 last if ((m|</div>|)&&($found_div_tabs));
255 print TO "\n<!-- POST-PROCESSED TABS -->\n";
260 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
262 if ($current->{'file'} =~ m/^class/) {
269 if (m/POST-PROCESSED TABS/) {
271 last if (m/END OF POST-PROCESSED TABS/);
276 if (m/The documentation for/) {
285 rename("$newname","html/$current->{'file'}") unless $debug{'rename'};
289 foreach my $entry (@{$current->{'down'}}) {
290 handle_page($entry,$level+1);
295 ### Launch the modules navbar reworking
297 handle_page($top,-1);# skip roots (we have 2 roots) in level counting
300 ### Add the modules navbar reworking to the modules.html file
302 sub add_tabs_to_module_html {
303 my $found_div_tabs=0;
304 my $module_tabs = "<div class=\"tabs2\">\n<ul class=\"tablist\">\n";
305 foreach my $entry (@{$top->{'down'}}) {
306 $module_tabs .= " <li> <a href=\"$entry->{'file'}\"><span>$entry->{'label'}</span></a></li>\n";
308 $module_tabs .= " </ul></div>\n";
310 my $oldname = "html/modules.html";
311 open FROM,$oldname || die;
312 my $newname=$oldname;
313 $newname =~ s/.html/.handlepage.html/;
314 open TO,">$newname" || die;
316 $found_div_tabs=1 if m/div.*class="tabs"/;
318 last if ((m|</div>|)&&($found_div_tabs));
321 print TO "\n<!-- POST-PROCESSED TABS -->\n";
322 print TO $module_tabs;
323 print TO "\n<!-- END OF POST-PROCESSED TABS -->\n";
330 rename($newname, $oldname) unless $debug{'rename'};
335 add_tabs_to_module_html;
338 ### Post-processsing common to all pages
340 map {push @allfiles,$_} @extra_files;
341 print "All files: ".(join(", ",@allfiles))."\n" if $debug{'parse'};
345 foreach my $file (@allfiles) {
346 $file =~ s/.html/.handlepage.html/ if $debug{'rename'}; # Take right name if debugging
348 open FROM,"$file" || die;
349 my $outfile = "$file";
350 $outfile =~ s/.(html|php)$/.new.$1/;
351 open TO,">$outfile" || die;
352 # print "POSTPROCESSING $file (tmp=$outfile)\n";
354 # Add the simgrid css, just in case
355 print TO '<link href="simgrid.css" rel="stylesheet" type="text/css">'."\n"
359 if($file =~ /^html\/index\..*/){
360 $_ =~ s/<li class="current">/<li>/g;
361 $_ =~ s/<li><a href="index.html">/<li class="current"><a href="index.html">/g;
363 $_ =~ s/<li class="current"><a href="pages.html">/<li><a href="pages.html">/g;
365 if($file =~ /^html\/pages\..*/){
366 $_ =~ s/<li><a href="pages.html">/<li class="current"><a href="pages.html">/g;
370 if($file =~ /^html\/publis.*/){
371 $_ =~ s/<div class="header">/<div>/g;
372 $_ =~ s/<div class="headertitle">/<div>/g;
375 # Add the FAQ PUBLIS PEOPLE HISTORY and CONTRIB to the top navbar.
376 if( $_ =~ /<div.*class="tabs">/){
379 if( $_ =~ /<\/div>/){
382 if( $_ =~ /<\/ul>/ && $tabs){
384 $tmp_buff .= ' <li><a href="publis.html"><span>Publications</span></a></li>'."\n";
385 $tmp_buff .= ' <li><a href="people.html"><span>People</span></a></li>'."\n";
386 $tmp_buff .= ' <li><a href="history.html"><span>History</span></a></li>'."\n";
387 $tmp_buff .= ' <li><a href="contrib.html"><span>Contrib</span></a></li>'."\n";
388 $tmp_buff .= ' <li><a href="faq.html"><span>FAQ Page</span></a></li>'."\n";
389 $tmp_buff .= ' <li><a href="http://gforge.inria.fr/projects/simgrid"><span>Simgrid Forge</span></a></li>'."\n";
390 $tmp_buff .= ' <li><a href="http://simgrid.gforge.inria.fr/"><span>Home</span></a></li>'."\n";
395 # Fix the current "button" of buggy Doxygen tabs
396 if($file =~ /^html\/faq.*/
397 || $file =~ /^html\/publis.*/
398 || $file =~ /^html\/people.*/
399 || $file =~ /^html\/history.*/
400 || $file =~ /^html\/contrib.*/)
402 my $filename = $file;
403 $filename =~ s/html\///g;
404 $filename =~ s/\.html//g;
405 $filename =~ s/publis_.*/publis/g;
406 $tmp_buff =~ s/<li class="current">/<li>/g;
407 $tmp_buff =~ s/<li><a href="$filename.html">/<li class="current"><a href="$filename.html">/g;
413 s|<span>Modules</span>|<span>Modules API</span>|g;
414 s|<span>Related Pages</span>|<span>Site Plan</span>|g;
420 rename("$outfile", "$file") unless $debug{'rename'};